Game Development Community

Music and Sound Channels

by Nikos Beck · in Technical Issues · 10/01/2008 (9:00 am) · 2 replies

I have two audio descriptions: Music and Sound.

new AudioDescription(Music)
{
Type = $GuiAudioType; //defined in the engine

IsLooping = true;

Is3D = false;
};

new AudioDescription(Sound)
{
Type = $GuiAudioType; //defined in the engine

IsLooping = false;

Is3D = false;
};

Right now they are both on channel zero. I can adjust the volume with

alxSetChannelVolume(0, 0.5); //50% volume on channel 0

...but everything is on channel zero. When I set the channel volume it does affect all currently playing sounds. How can I play audio on a particular channel. If I can keep music on channel zero and sound on channel one then I can adjust their volumes separately.

I haven't managed to find anything that would let me pick a channel. Any help would be greatly appreciated.

#1
10/01/2008 (11:30 am)
If you look in your client/scripts/audioProfiles.cs at the top you should see this variable: $GuiAudioType along with some others. These are just simply numbers that range from 1-8. I think you can have more than 8 channels but I'm not too sure. Anyways, If you create a variable called $SomeAudioType or whatever you want and set it to equal 3 or 4... then for your AudioDescriptions set the Type = "$SomeAudioType". That audioDescription will now use that sound channel. In your Options screen where people can adjust volumes, you may have to create a new field or some how manage it so that when the user changes a setting then in the options code part you will need to be changing that new $SomeAudioType as well. Ultimately to change the volume it's just alxSetChannelVolume(%shaaa, %BAAAMMM); Where %shaaa will be your channel, and %BAAAMMM will be the volume ranging from 0.0 to 1.0.
Does this answer your question?
#2
10/01/2008 (1:59 pm)
*jaw dropped*

Oh my. Thank you so much. I was hoping it'd be that simple. I had no idea that $GuiAudioType was the variable I should be looking at. Thanks DALQ.

I tried it and it works exactly as I wanted.