diff --git a/docs/AUTHORS.txt b/docs/AUTHORS.txt index 9928be4b9..a94b3f59f 100644 --- a/docs/AUTHORS.txt +++ b/docs/AUTHORS.txt @@ -6,7 +6,7 @@ Copyright (c) 2002-2024 Various contributors (see below, and CHANGES.txt) https://tuxpaint.org/ -June 17, 2002 - September 17, 2024 +June 17, 2002 - September 24, 2024 * Design and Coding: @@ -189,6 +189,14 @@ June 17, 2002 - September 17, 2024 Creative Commons 0 by DigitalUnderglow + Rotate magic tool + by Bill Kendrick + + Rotate sound effects + Sound effects based on "Rotating tank turret planetary electric motor" + + Creative Commons 0 by lorefold + Bloom magic tool by Bill Kendrick diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index ff704f949..322948c50 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -18,8 +18,10 @@ https://tuxpaint.org/ + Closes https://sourceforge.net/p/tuxpaint/feature-requests/257/ * "Rotate", rotate's the entire image on the canvas. - + Bill Kendrick - + TODO Sound effect + + Code Bill Kendrick + + Sound effects based on "Rotating tank turret planetary electric motor" + Creative Commons 0 by lorefold + + TODO Icon + TODO Documentation diff --git a/magic/sounds/rotate-drag.ogg b/magic/sounds/rotate-drag.ogg new file mode 100644 index 000000000..6cf78cd4d Binary files /dev/null and b/magic/sounds/rotate-drag.ogg differ diff --git a/magic/sounds/rotate-release.ogg b/magic/sounds/rotate-release.ogg new file mode 100644 index 000000000..e58fd9fac Binary files /dev/null and b/magic/sounds/rotate-release.ogg differ diff --git a/magic/src/rotate.c b/magic/src/rotate.c index a6428f423..c15ad837d 100644 --- a/magic/src/rotate.c +++ b/magic/src/rotate.c @@ -32,7 +32,7 @@ #include "SDL_mixer.h" #include "SDL2_rotozoom.h" -static Mix_Chunk *rotate_snd; +static Mix_Chunk *rotate_snd_drag, *rotate_snd_release; SDL_Surface * rotate_snapshot = NULL; Uint32 rotate_color; float rotate_last_angle = 0.0; @@ -79,8 +79,11 @@ int rotate_init(magic_api * api, Uint8 disabled_features ATTRIBUTE_UNUSED, Uint8 { char fname[1024]; - snprintf(fname, sizeof(fname), "%ssounds/magic/xor.ogg", api->data_directory); // FIXME - rotate_snd = Mix_LoadWAV(fname); + snprintf(fname, sizeof(fname), "%ssounds/magic/rotate-drag.ogg", api->data_directory); + rotate_snd_drag = Mix_LoadWAV(fname); + + snprintf(fname, sizeof(fname), "%ssounds/magic/rotate-release.ogg", api->data_directory); + rotate_snd_release = Mix_LoadWAV(fname); return (1); } @@ -166,7 +169,7 @@ void rotate_drag(magic_api * api, int which ATTRIBUTE_UNUSED, SDL_Surface * canv update_rect->w = canvas->w; update_rect->h = canvas->h; - api->playsound(rotate_snd, 128, 255); + api->playsound(rotate_snd_drag, 128, 255); } void rotate_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED, @@ -181,6 +184,10 @@ void rotate_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED, * switching [back] to thsi tool */ rotate_clicked_since_switchin = 1; + /* Stop any sound (in case "release" version is playing), + so we can play the main "drag" sound immediately */ + api->stopsound(); + /* Call the drag function to do the work * (it will add the click positions angle, making it a net * 0-radian rotation _this time_) */ @@ -202,12 +209,19 @@ void rotate_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED update_rect->y = 0; update_rect->w = canvas->w; update_rect->h = canvas->h; + + /* Stop any "drag" sound, and play "release" immediately */ + api->stopsound(); + api->playsound(rotate_snd_release, 128, 255); } void rotate_shutdown(magic_api * api ATTRIBUTE_UNUSED) { - if (rotate_snd != NULL) - Mix_FreeChunk(rotate_snd); + if (rotate_snd_drag != NULL) + Mix_FreeChunk(rotate_snd_drag); + + if (rotate_snd_release != NULL) + Mix_FreeChunk(rotate_snd_release); if (rotate_snapshot != NULL) {