Filled Polygon "nearby" sound effect

When red & green endpoint dots are being dragged near each other,
play a different sound.

Based on CC Attribution 4.0 sound by Eliot Lash
(see CHANGES.txt & AUTHORS.txt).
This commit is contained in:
Bill Kendrick 2024-05-28 23:47:54 -07:00
parent a2fece280b
commit c00cf991f9
4 changed files with 41 additions and 6 deletions

View file

@ -153,13 +153,19 @@ June 17, 2002 - May 28, 2024
Scanline polygon fill routine based on public-domain code
by Darel Rex Finley, 2007 <https://alienryderflex.com/polygon_fill/>
Filled Polygon sound effects (place, move, finish) based on
Filled Polygon "place", "move", and "finish" sound effects based on
"success_02.wav" (https://freesound.org/people/Kenneth_Cooney/sounds/463067/),
"success.wav" (https://freesound.org/people/Kenneth_Cooney/sounds/457547/), &
"Completed.wav" (https://freesound.org/people/Kenneth_Cooney/sounds/609336/)
respectively.
Creative Commons 0 by Kenneth Cooney <https://www.kennethcooney.com/>
Filled Polygon "nearby" sound effect based on "JacobsLadderSingle2.flac"
<https://freesound.org/people/Halleck/sounds/19487/>.
Creative Commons Attribution 4.0 by Eliot Lash
<https://freesound.org/people/Halleck/>
<https://www.eliotlash.com/>
Bloom magic tool
by Bill Kendrick <bill@newbreedsoftware.com>
Googly Eyes sound effect: "Torch Crackle.wav"

View file

@ -21,10 +21,15 @@ https://tuxpaint.org/
+ Code & icon by Bill Kendrick <bill@newbreedsoftware.com>
+ Scanline polygon fill routine based on public-domain code
by Darel Rex Finley, 2007 <https://alienryderflex.com/polygon_fill/
+ Sound effects based on "success.wav", "success_02.wav", and
"Completed.wav", Creative Commons 0 by Kenneth Cooney
+ Sound effects based on
- "success.wav", "success_02.wav", and "Completed.wav",
Creative Commons 0 by Kenneth Cooney
<https://freesound.org/people/Kenneth_Cooney>
<https://www.kennethcooney.com/>
- "JacobsLadderSingle2.flac",
Creative Commons Attribution 4.0 by Eliot Lash
<https://freesound.org/people/Halleck/>
<https://www.eliotlash.com/>
Closes https://sourceforge.net/p/tuxpaint/feature-requests/251/
* Magic Tool Improvements:

Binary file not shown.

View file

@ -41,6 +41,7 @@ char *polyfill_icon_filenames[NUM_TOOLS] = {
enum {
SND_PLACE,
SND_MOVE,
SND_NEARBY,
SND_FINISH,
NUM_SOUNDS
};
@ -48,6 +49,7 @@ enum {
char *polyfill_snd_filenames[NUM_SOUNDS] = {
"polyfill_place.ogg",
"polyfill_move.ogg",
"polyfill_nearby.ogg",
"polyfill_finish.ogg",
};
@ -281,7 +283,29 @@ polyfill_drag(magic_api * api, int which ATTRIBUTE_UNUSED,
polyfill_pt_y[polyfill_editing] = y;
polyfill_draw_preview(api, canvas, 1);
if (polyfill_editing == polyfill_num_pts - 1 &&
polyfill_num_pts >= 3 &&
x >= polyfill_pt_x[0] - SNAP_SIZE &&
x <= polyfill_pt_x[0] + SNAP_SIZE &&
y >= polyfill_pt_y[0] - SNAP_SIZE &&
y <= polyfill_pt_y[0] + SNAP_SIZE) {
/* If placing/moving the final (red) point, and it's
near the initial (green) point, play an electrostatic sound */
api->playsound(snd_effects[SND_NEARBY], (x * 255) / canvas->w, 255);
} else if (polyfill_editing == 0 &&
polyfill_num_pts >= 3 &&
x >= polyfill_pt_x[polyfill_num_pts - 1] - SNAP_SIZE &&
x <= polyfill_pt_x[polyfill_num_pts - 1] + SNAP_SIZE &&
y >= polyfill_pt_y[polyfill_num_pts - 1] - SNAP_SIZE &&
y <= polyfill_pt_y[polyfill_num_pts - 1] + SNAP_SIZE) {
/* If moving the initial (green) point, and it's
near the final (red) point, also play an electrostatic sound */
api->playsound(snd_effects[SND_NEARBY], (x * 255) / canvas->w, 255);
} else {
/* Otherwise, play the normal "moving a point" sound */
api->playsound(snd_effects[SND_MOVE], (x * 255) / canvas->w, 255);
}
update_rect->x = 0;
update_rect->y = 0;