Adding sound effects to Clone tool
Source https://commons.wikimedia.org/wiki/File:Sheep_bleating.ogg (Public domain)
This commit is contained in:
parent
5f7a1c68e6
commit
cea4c3f87e
4 changed files with 15 additions and 5 deletions
|
|
@ -2,12 +2,12 @@ AUTHORS.txt for Tux Paint
|
||||||
|
|
||||||
Tux Paint - A simple drawing program for children.
|
Tux Paint - A simple drawing program for children.
|
||||||
|
|
||||||
Copyright (c) 2002-2020
|
Copyright (c) 2002-2021
|
||||||
Various contributors (see below, and CHANGES.txt)
|
Various contributors (see below, and CHANGES.txt)
|
||||||
http://www.tuxpaint.org/
|
http://www.tuxpaint.org/
|
||||||
|
|
||||||
|
|
||||||
June 17, 2002 - August 29, 2020
|
June 17, 2002 - February 10, 2021
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
|
|
@ -358,6 +358,10 @@ $Id$
|
||||||
* Cartoon
|
* Cartoon
|
||||||
* "cartoon6.wav" from http://www.grsites.com/
|
* "cartoon6.wav" from http://www.grsites.com/
|
||||||
|
|
||||||
|
* Clone
|
||||||
|
* https://commons.wikimedia.org/wiki/File:Sheep_bleating.ogg
|
||||||
|
Public domain
|
||||||
|
|
||||||
* Many others taken from various sources on the web.
|
* Many others taken from various sources on the web.
|
||||||
|
|
||||||
* Edited using SOX
|
* Edited using SOX
|
||||||
|
|
|
||||||
BIN
magic/sounds/clone.ogg
Normal file
BIN
magic/sounds/clone.ogg
Normal file
Binary file not shown.
BIN
magic/sounds/clone_start.ogg
Normal file
BIN
magic/sounds/clone_start.ogg
Normal file
Binary file not shown.
|
|
@ -23,7 +23,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
(See COPYING.txt)
|
(See COPYING.txt)
|
||||||
|
|
||||||
Last updated: January 10, 2021
|
Last updated: February 10, 2021
|
||||||
$Id$
|
$Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ enum
|
||||||
|
|
||||||
/* Our globals: */
|
/* Our globals: */
|
||||||
|
|
||||||
static Mix_Chunk *clone_snd;
|
static Mix_Chunk *clone_start_snd, *clone_snd;
|
||||||
int clone_state;
|
int clone_state;
|
||||||
int clone_src_x, clone_src_y;
|
int clone_src_x, clone_src_y;
|
||||||
int clone_drag_start_x, clone_drag_start_y;
|
int clone_drag_start_x, clone_drag_start_y;
|
||||||
|
|
@ -86,6 +86,9 @@ int clone_init(magic_api * api)
|
||||||
{
|
{
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
|
|
||||||
|
snprintf(fname, sizeof(fname), "%s/sounds/magic/clone_start.ogg", api->data_directory);
|
||||||
|
clone_start_snd = Mix_LoadWAV(fname);
|
||||||
|
|
||||||
snprintf(fname, sizeof(fname), "%s/sounds/magic/clone.ogg", api->data_directory);
|
snprintf(fname, sizeof(fname), "%s/sounds/magic/clone.ogg", api->data_directory);
|
||||||
clone_snd = Mix_LoadWAV(fname);
|
clone_snd = Mix_LoadWAV(fname);
|
||||||
|
|
||||||
|
|
@ -203,6 +206,7 @@ void clone_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||||
clone_src_x = x;
|
clone_src_x = x;
|
||||||
clone_src_y = y;
|
clone_src_y = y;
|
||||||
clone_state = CLONE_STARTING;
|
clone_state = CLONE_STARTING;
|
||||||
|
api->playsound(clone_start_snd, (x * 255) / canvas->w, 255);
|
||||||
} else if (clone_state == CLONE_CLONING) {
|
} else if (clone_state == CLONE_CLONING) {
|
||||||
clone_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
clone_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||||
}
|
}
|
||||||
|
|
@ -216,8 +220,8 @@ void clone_release(magic_api * api, int which ATTRIBUTE_UNUSED,
|
||||||
clone_state = CLONE_CLONING;
|
clone_state = CLONE_CLONING;
|
||||||
} else {
|
} else {
|
||||||
clone_state = CLONE_READY_TO_START;
|
clone_state = CLONE_READY_TO_START;
|
||||||
|
api->stopsound();
|
||||||
}
|
}
|
||||||
api->stopsound();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No setup happened:
|
// No setup happened:
|
||||||
|
|
@ -225,6 +229,8 @@ void clone_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
if (clone_snd != NULL)
|
if (clone_snd != NULL)
|
||||||
Mix_FreeChunk(clone_snd);
|
Mix_FreeChunk(clone_snd);
|
||||||
|
if (clone_start_snd != NULL)
|
||||||
|
Mix_FreeChunk(clone_start_snd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record the color from Tux Paint:
|
// Record the color from Tux Paint:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue