Game Development Reference
In-Depth Information
{
return false;
}
public void StopSound(Sound sound)
{
}
}
Sound hardware can only play a limited number of sounds at the same time. The
number of sounds that can be played is known as the number of channels.
Modern sound hardware can often play up to 256 sounds at the same time. The
OpenAL way to discover how many sound channels are available is to keep re-
questing channels and when the hardware can't give any more, then you have the
maximum number.
readonly int MaxSoundChannels = 256;
List <int> _soundChannels = new List<int>();
public SoundManager()
{
Alut.alutInit();
DicoverSoundChannels();
}
private void DicoverSoundChannels()
{
while (_soundChannels.Count < MaxSoundChannels)
{
int src;
Al.alGenSources(1, out src);
if (Al.alGetError()== Al.AL_NO_ERROR)
{
_soundChannels.Add(src);
}
else
{
break; // there's been an error - we've filled all the channels.
}
}
}
Search WWH ::




Custom Search