Change Sound Folder's default volume by script?

Started by abstauber, Wed 16/09/2009 09:52:06

Previous topic - Next topic

abstauber

I'm planning to update my in-game options panel. But with the new sound system AGS 3.2, it seems to be a little tricky to differ between sound and music.

So I'd like to link the sliders to the audio folders and change their default volume with those sliders. Is this possible somehow?

edit
Well, I've kind of helped myself :)

Code: ags

int setMusicChannelVol(int newVol) {
  int i = 0;
  while (i<System.AudioChannelCount) {
    AudioChannel *channel = System.AudioChannels[i];
    if (channel.PlayingClip != null && channel.PlayingClip.Type==eAudioTypeMusic) {
      channel.Volume=newVol;
      return channel.Volume;
    }
    i++;
  }
}
int setSoundChannelVol(int newVol) {
  int i = 0;
  while (i<System.AudioChannelCount) {
    AudioChannel *channel = System.AudioChannels[i];
    if (channel.PlayingClip != null && channel.PlayingClip.Type==eAudioTypeSound) {
      channel.Volume=newVol;
      return channel.Volume;
    }
    i++;
  }
}


Although it only affect currently playing music and the currently playing sound effect. For newly played effects, I link the volume directly to the sliders value.

Pumaman

Interesting point about the new audio system, if there is no easy way to control sound and music volume separately now. Hmm.

Also, please post issues with the beta in the beta thread, so as not to confuse people using the current official version :)

SMF spam blocked by CleanTalk