[racket] sound + universe report: success.

From: Neil Toronto (neil.toronto at gmail.com)
Date: Thu Oct 20 18:12:37 EDT 2011

On 10/20/2011 12:49 PM, John Clements wrote:
> To frame the discussion better, I think that we should probably divide the set of possible sounds into "momentary" and "ongoing" sounds.  If I associate a "pop" with a ball hitting the ground, I'm probably not interested in thinking about whether the sound from the previous frame is still going on. If I'm playing a soundtrack, then I definitely agree that I might want to alter the ongoing sound.

FWIW, this is the right way to think about it. Most sane game engines 
make this distinction. One-shot sounds are call-and-forget; persistent 
sounds are managed and can be turned off at will, or not refreshed.

Further, there is often support for two kinds of persistent sounds: 
those that loop, and those that don't. Example looping sounds: 
soundtrack, rocket engine, running water. Example non-looping: speech. 
Sometimes a game engine further distinguishes the soundtrack, which is 
ambient and has its own volume, from other persistent sound effects, 
which are positional, so their volumes attenuate with distance.

It's common for 3D engines to play only the few closest sounds 
(ephemeral or persistent) to keep from overloading the speakers, mixer, 
or player. (That depends on the viewer having a position in the world, 
so I don't know how that would work in 2D.) It's also common to have a 
fixed-size FIFO that holds the sounds currently playing - when a sound 
gets bumped off, it stops - but I expect that's mostly C/C++'s fault.

Neil T



Posted on the users mailing list.