Cytopia icon indicating copy to clipboard operation
Cytopia copied to clipboard

Separate music and sound FX volume

Open lizzyd710 opened this issue 2 years ago • 1 comments

Right now setMusicVolume changes all sound volume, not just music, and setSoundEffectsVolume does nothing. It's been like this for a while, I just wanted to create an issue so it wasn't forgotten about.

lizzyd710 avatar May 30 '22 23:05 lizzyd710

The relevant bit from AudioMixer.cxx.

void AudioMixer::setMusicVolume(float volume)
{
  // alSourcef(currentSourceID, AL_GAIN, newVolume);
  // this would set the volume, but idk how to get the "currentSourceID"

  // for now set the volume for everything.
  alListenerf(AL_GAIN, volume);
  // update the settings accordingly
  Settings::instance().musicVolume = volume;
}

void AudioMixer::setSoundEffectVolume(float volume)
{
  // find out how to set those volumes seperately
  //alListenerf(AL_GAIN, volume);
  
  // for now, just set the settings value, even if it doesnt do anything
  Settings::instance().soundEffectsVolume = volume;
}

Might have to generate more sources in Soundtrack.cxx, because right now only one is generated, so I think we might need one source for music and one for SFX.

lizzyd710 avatar Jul 14 '22 13:07 lizzyd710