mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 22:44:32 +00:00
Horrible hack to attenuate stereo sources properly.
OpenAL refuses to pan stereo sources, so apparently it needs to be done this way.
This commit is contained in:
parent
e6680da428
commit
f5da61fe78
4 changed files with 84 additions and 11 deletions
|
@ -1060,8 +1060,8 @@ bool SoundManager::playVoice(const std::string &name, SoundVoiceType svt, float
|
|||
voiceChannel->setCallback(NULL);
|
||||
voiceChannel->setUserData(NULL);
|
||||
voiceChannel->set3DMinMaxDistance(0.0f, 0.0f);
|
||||
setSoundPos(voiceChannel, 0, 0);
|
||||
setSoundRelative(voiceChannel, true);
|
||||
setSoundPos(voiceChannel, 0, 0);
|
||||
|
||||
result = voiceChannel->setPaused(false);
|
||||
checkError();
|
||||
|
@ -1158,10 +1158,6 @@ void *SoundManager::playSfx(const PlaySfx &play)
|
|||
channel->setCallback(NULL);
|
||||
channel->setUserData(NULL);
|
||||
|
||||
// position in space
|
||||
setSoundPos(channel, play.x, play.y);
|
||||
setSoundRelative(channel, play.relative);
|
||||
|
||||
// distance gain attenuation: stereo separation + silence at further away than maxdist
|
||||
float maxdist = play.maxdist;
|
||||
if (!maxdist)
|
||||
|
@ -1172,6 +1168,10 @@ void *SoundManager::playSfx(const PlaySfx &play)
|
|||
else
|
||||
channel->set3DMinMaxDistance(0, 0); // no attenuation
|
||||
|
||||
// position in space
|
||||
setSoundRelative(channel, play.relative);
|
||||
setSoundPos(channel, play.x, play.y); // must be set after everything else (See hack in OpenALChannel::set3DAttributes())
|
||||
|
||||
|
||||
|
||||
result = channel->setPaused(false);
|
||||
|
@ -1344,9 +1344,9 @@ bool SoundManager::playMusic(const std::string &name, SoundLoopType slt, SoundFa
|
|||
musicChannel->setPan(0);
|
||||
musicChannel->setCallback(NULL);
|
||||
musicChannel->setUserData(NULL);
|
||||
musicChannel->set3DMinMaxDistance(0.0f, 0.0f); // disable attenuation // FIXME: is that right?
|
||||
setSoundPos(musicChannel, 0, 0);
|
||||
musicChannel->set3DMinMaxDistance(0.0f, 0.0f); // disable attenuation
|
||||
setSoundRelative(musicChannel, true);
|
||||
setSoundPos(musicChannel, 0, 0);
|
||||
|
||||
result = musicChannel->setPaused(false); // This is where the sound really starts.
|
||||
checkError();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue