Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Cassiebsg on Tue 29/11/2016 20:03:14

Title: Controling volume for extrenal MP3 and Audio CD
Post by: Cassiebsg on Tue 29/11/2016 20:03:14
Uhm... Sorry if this is basic, but I didn't found an answer to this in either the manual or by searching the forum.

So at this point I'm guessing the answer is: You can't do that. In which case I'll just add a note that music volume control does not work for using external audio files or music CD.

Question is simple:
I have a slider to set the volume of the music, which I wrongly assumed worked for external files (PlayMP3File) and CDAudio... realizing today that these don't get affected when changing the slider back and forth. :(
So... is there a way to achieve this? Or should I just add the "doesn't work for this type of sound" warning?
Title: Re: Controling volume for extrenal MP3 and Audio CD
Post by: Crimson Wizard on Tue 29/11/2016 20:29:17
What does the slider do exactly, what is inside script function?

I think that since PlayMP3File do not return AudioChannel, you can only use Game.SetAudioTypeVolume(eAudioTypeMusic, ...).

As for CDAudio, it uses operating system to play CD, which means the sound is totally beyond AGS control.
Title: Re: Controling volume for extrenal MP3 and Audio CD
Post by: Cassiebsg on Wed 30/11/2016 16:54:31
Yeah, that's the code am using:

Code (ags) Select

function SldMusic_OnChange(GUIControl *control)
{
    Game.SetAudioTypeVolume(eAudioTypeMusic, SldMusic.Value, eVolExistingAndFuture);
    Game.SetAudioTypeVolume(eAudioTypeAmbientSound, SldMusic.Value, eVolExistingAndFuture);
}


But this doesn't seem to affect the mp3. :-\

As for the CD, guess I was surprised not to find a function for setting the volume, since there are so many options to pick track, find how many tracks there are, and so on...