diff --git a/magic/docs/README.txt b/magic/docs/README.txt
index 1d381cbf3..7578377b9 100644
--- a/magic/docs/README.txt
+++ b/magic/docs/README.txt
@@ -6,7 +6,7 @@
bill@newbreedsoftware.com
http://www.tuxpaint.org/
- July 5, 2007 - August 23, 2007
+ July 5, 2007 - November 21, 2007
--------------------------------------------------------------------------
@@ -460,6 +460,10 @@ Interfaces
The 'pan' and 'dist' values can be used to simulate location and
distance of the 'Magic' tool effect.
+ * void stopsound(void)
+ This function stops playing a sound played by playsound(). It is
+ useful to silence effects when the user stops using the tool (in
+ your 'release' function).
* void special_notify(int flag)
This function notifies Tux Paint of special events. Various
values defined in "tp_magic_api.h" can be 'or'ed together (using
diff --git a/magic/docs/html/README.html b/magic/docs/html/README.html
index 1bce5c22a..9a1d744a7 100644
--- a/magic/docs/html/README.html
+++ b/magic/docs/html/README.html
@@ -15,7 +15,7 @@ New Breed Software
bill@newbreedsoftware.com
http://www.tuxpaint.org/
-July 5, 2007 - August 23, 2007
+July 5, 2007 - November 21, 2007
@@ -579,6 +579,12 @@ plugin's functions.
simulate location and distance of the 'Magic' tool effect.
+void stopsound(void)
+ This function stops playing a sound played by playsound().
+ It is useful to silence effects when the user stops using the tool
+ (in your 'release' function).
+
+
void special_notify(int flag)
diff --git a/magic/src/kalidescope.c b/magic/src/kalidescope.c
index aad49c5f5..307e17611 100644
--- a/magic/src/kalidescope.c
+++ b/magic/src/kalidescope.c
@@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
- Last updated: November 6, 2007
+ Last updated: November 21, 2007
$Id$
*/
@@ -141,6 +141,7 @@ void kalidescope_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect)
{
+ api->stopsound();
}
// No setup happened:
diff --git a/magic/src/shift.c b/magic/src/shift.c
index 08aa15c64..45dc4f37b 100644
--- a/magic/src/shift.c
+++ b/magic/src/shift.c
@@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
- Last updated: August 20, 2007
+ Last updated: November 21, 2007
$Id$
*/
@@ -282,6 +282,7 @@ void shift_release(magic_api * api, int which,
int x, int y, SDL_Rect * update_rect)
{
shift_doit(api, which, canvas, last, x, y, x, y, update_rect, 0);
+ api->stopsound();
}
diff --git a/src/tuxpaint.c b/src/tuxpaint.c
index f159a4f06..ea08744fd 100644
--- a/src/tuxpaint.c
+++ b/src/tuxpaint.c
@@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
- June 14, 2002 - October 26, 2007
+ June 14, 2002 - November 21, 2007
$Id$
*/
@@ -1501,6 +1501,7 @@ int magic_sort(const void * a, const void * b);
Mix_Chunk * magic_current_snd_ptr;
void magic_playsound(Mix_Chunk * snd, int left_right, int up_down);
+void magic_stopsound(void);
void magic_line_func(void * mapi,
int which, SDL_Surface * canvas, SDL_Surface * last,
int x1, int y1, int x2, int y2, int step,
@@ -16748,6 +16749,7 @@ void load_magic_plugins(void)
magic_api_struct[plc]->putpixel = putpixels[canvas->format->BytesPerPixel];
magic_api_struct[plc]->line = magic_line_func;
magic_api_struct[plc]->playsound = magic_playsound;
+ magic_api_struct[plc]->stopsound = magic_stopsound;
magic_api_struct[plc]->special_notify = special_notify;
magic_api_struct[plc]->button_down = magic_button_down;
magic_api_struct[plc]->rgbtohsv = rgbtohsv;
@@ -17176,6 +17178,13 @@ void special_notify(int flags)
}
}
+void magic_stopsound(void)
+{
+#ifndef NOSOUND
+ Mix_HaltChannel(0);
+#endif
+}
+
void magic_playsound(Mix_Chunk * snd, int left_right, int up_down)
{
#ifndef NOSOUND