Browse Source

Merge pull request #517 from Hoikas/audio

Fix loud sound issue
Darryl Pogue 9 years ago
parent
commit
916c3ef276
  1. 9
      Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp
  2. 9
      Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp

9
Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp

@ -134,6 +134,15 @@ bool plWin32StaticSound::LoadSound( bool is3D )
}
uint32_t bufferSize = buffer->GetDataLength();
if( header.fNumChannels > 1 && is3D )
{
// We can only do a single channel of 3D sound. So copy over one (later)
bufferSize /= header.fNumChannels;
header.fBlockAlign /= header.fNumChannels;
header.fAvgBytesPerSec /= header.fNumChannels;
header.fNumChannels = 1;
}
bool tryStatic = true;
// If we want FX, we can't use a static voice, but EAX doesn't fit under that limitation :)
if( 0 )

9
Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp

@ -269,6 +269,15 @@ bool plWin32StreamingSound::LoadSound( bool is3D )
return false;
}
if( header.fNumChannels > 1 && is3D )
{
// We can only do a single channel of 3D sound. So copy over one (later)
bufferSize /= header.fNumChannels;
header.fBlockAlign /= header.fNumChannels;
header.fAvgBytesPerSec /= header.fNumChannels;
header.fNumChannels = 1;
}
// Actually create the buffer now (always looping)
fDSoundBuffer = new plDSoundBuffer( bufferSize, header, is3D, IsPropertySet(kPropLooping), false, true );
if( !fDSoundBuffer->IsValid() )

Loading…
Cancel
Save