Never quite understood sound management in AGS

Started by Monsieur OUXX, Fri 07/03/2014 22:45:37

Previous topic - Next topic

Monsieur OUXX

Could someone either direct me to a place where it's explained how the new sound system works (not in terms of scripting or channels, but in terms of concepts: 1. sounds types: music, ambient, etc. 2. volume management) ,..or briefly walk me through it?

I've never been very familiar with the old system either. I just new how to play a music, or a sound, and repeat them, but I never knew how to control the volumes of sound and music separately, etc.
 

Ghost

#1
It depends on how involved you want to go. There is one command to globally alter the volume of sound, music, and speech: static Game.SetAudioTypeVolume(AudioType, int volume, ChangeVolumeType) If you just use PlaySound and related simple commands, that's often enough; I've been using the command for dozens of "option" GUIs now and it's easy to set up.

Alternatively, if you want more control, you can use AudioChannels for sound and music. This is a bit more complicated because you need to declare a channel somewhere in your script, but it allows for much more control: you keep a pointer to a sound/music file and can change its volume and even panning at run-time, and other nifty tricks. Since you have a pointer you can also check easily if a file is currently being played, so setting up loops and conditions is easy enough.

"AudioChannel functions and properties" in the AGS manual has the whole info on the system. "Upgrading to AGS 3.2" is also helpful.



monkey0506

The new sound system was definitely a step forward in most regards, but it did fall short in one important aspect -- generics. There's no way to iterate through all of the AudioClips in a game generically, so if you're wanting to do that then you're out of luck unless you stick to pre-3.2 versions of AGS and use the old sound system.

The purpose behind having separate types of audio is so that you can control them as separate classes. There is System.Volume for the overall volume, but you may want to offer sliders so your player can control separately the volume controls for music, sound effects, and speech. As Ghost noted this is controlled by Game.SetAudioTypeVolume (except for speech which uses SetSpeechVolume). You can also create your own custom types of audio if you have a need to do so. The only things really shared among AudioClips of a given type are the volume drop during speech, default volume, and current AudioType volume.

I'm not sure what else you might be confused about beyond that.

Monsieur OUXX

Quote from: monkey_05_06 on Sat 08/03/2014 06:56:35
I'm not sure what else you might be confused about beyond that.

Nothing. Yours and Ghost's explanations were perfectly clear. Thanks guys!
For example I never realized that speech had a separate status because of the volume drop when someone speaks. Also, I thought that channels were just a technical aspect of sounds playing simultaneously (you may have up to that-many channels available, no more), but I didn't know they were useful for volume management of sounds of the same type.

It's all much clearer now. Thanks again.
 

SMF spam blocked by CleanTalk