[sdlsound] volume control?

Ryan C. Gordon icculus at clutteredmind.org
Tue Mar 5 19:25:57 EST 2002


> so does SDL have volume control capabilities that i've just been unable to
> find? is there a reason it isn't in SDL? can someone recommend a
> reasonable replacement?

No, but it's easy enough to do in the audio callback.

Before writing data to a stream, multiply each sample by the volume you'd
like. 0.0 is silence, 1.0 is regular volume (and can be replaced with a
memcpy for extra speed), 2.0 is double volume.

I could add this to playsound as an example (--volume 0.5 or something).

--ryan.







More information about the sdlsound mailing list