Re: [Plib-users] Damage to sound hardware
Brought to you by:
sjbaker
|
From: Steve B. <sjb...@ai...> - 2000-10-01 18:37:08
|
Risto S Varanka wrote:
>
> I gather it is possible to damage your audio hardware, eg. the
> speakers, if you for example turn the volume high enough and play
> some clicks or noise. I imagine this could happen with badly
> coded / pre-alpha / prototype applications.
I guess it's theoretically possible with really high powered amplifiers
and such - I've never heard of anyone actually doing that though.
> How do you guard against this using Plib, so you can avoid
> problems with your users?
I don't - it's really impossible to write a bullet-proof check without
doing some realtime signal analysis - and that's really not going to
happen while the computer is busy doing graphics, etc.
In the end, if your amp/speakers are set up in such a way that damage
could occur, then it could happen because a program crashed - or you
played back an MP3 that had a click in it - anything really.
I just don't think you should worry about it. If you are overdriving
your speakers to that degree then it's all your own fault IMHO.
> Should you always set your safetyMargin
> high enough and check that you get the same from getRate etc. for
> your slSample and slScheduler?
Safety margin should certainly be set to the longest expected interval
between calls to the SL update routine - or else there can be gaps
in the audio stream. It's hard for an application writer to get that
right because in a multitasking system, another program could come along
and lock up the CPU for a couple of seconds...so sound breakup is
always a possibility.
Again though, this is nothing unique to PLIB's sound replayer - it could
happen with any of them.
It's a good idea to ensure that your sounds are sampled at the same rate
that they will be replayed - or else they'll be too fast or too slow.
In most applications, you'll be shipping the sound files with the program,
so you can just record them at a suitably high speed and have PLIB downsample
them for you.
> (Btw, what would happen if you call
> slSample::adjustVolume in a loop?)
Not good - the quality of the audio will gradually degrade due to roundoff
errors. The sample adjust routines make a permenant change to the actual
sound sample data itself.
If you need runtime volume/frequency control, use a one-step slEnvelope
which is applied as the sound is replayed.
--
Steve Baker HomeEmail: <sjb...@ai...>
WorkEmail: <sj...@li...>
HomePage : http://web2.airmail.net/sjbaker1
Projects : http://plib.sourceforge.net
http://tuxaqfh.sourceforge.net
http://tuxkart.sourceforge.net
http://prettypoly.sourceforge.net
|