Browse Source

plgAudioSys doesn't need to take hsWindowHndl.

Darryl Pogue 10 years ago
parent
commit
39eab13d9d
  1. 3
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 8
      Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp
  3. 6
      Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h
  4. 2
      Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp

3
Sources/Plasma/Apps/plClient/plClient.cpp

@ -1385,10 +1385,9 @@ bool plClient::StartInit()
// the dx8 audio system MUST be initialized // the dx8 audio system MUST be initialized
// before the database is loaded // before the database is loaded
HWND hWnd = fWindowHndl;
SetForegroundWindow(fWindowHndl); SetForegroundWindow(fWindowHndl);
plgAudioSys::Init(hWnd); plgAudioSys::Init();
gAudio = plgAudioSys::Sys(); gAudio = plgAudioSys::Sys();
RegisterAs( kClient_KEY ); RegisterAs( kClient_KEY );

8
Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp

@ -264,7 +264,7 @@ void plAudioSystem::IEnumerateDevices()
} }
//// Init //////////////////////////////////////////////////////////////////// //// Init ////////////////////////////////////////////////////////////////////
bool plAudioSystem::Init( hsWindowHndl hWnd ) bool plAudioSystem::Init()
{ {
plgAudioSys::fRestarting = false; plgAudioSys::fRestarting = false;
static bool firstTimeInit = true; static bool firstTimeInit = true;
@ -996,7 +996,6 @@ bool plgAudioSys::fUseHardware = false;
bool plgAudioSys::fMuted = true; bool plgAudioSys::fMuted = true;
bool plgAudioSys::fDelayedActivate = false; bool plgAudioSys::fDelayedActivate = false;
bool plgAudioSys::fEnableEAX = false; bool plgAudioSys::fEnableEAX = false;
hsWindowHndl plgAudioSys::fWnd = nil;
float plgAudioSys::fChannelVolumes[ kNumChannels ] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f }; float plgAudioSys::fChannelVolumes[ kNumChannels ] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f };
float plgAudioSys::f2D3DBias = 0.75f; float plgAudioSys::f2D3DBias = 0.75f;
uint32_t plgAudioSys::fDebugFlags = 0; uint32_t plgAudioSys::fDebugFlags = 0;
@ -1010,13 +1009,12 @@ std::string plgAudioSys::fDeviceName;
bool plgAudioSys::fRestarting = false; bool plgAudioSys::fRestarting = false;
bool plgAudioSys::fMutedStateChange = false; bool plgAudioSys::fMutedStateChange = false;
void plgAudioSys::Init(hsWindowHndl hWnd) void plgAudioSys::Init()
{ {
fSys = new plAudioSystem; fSys = new plAudioSystem;
fSys->RegisterAs( kAudioSystem_KEY ); fSys->RegisterAs( kAudioSystem_KEY );
plgDispatch::Dispatch()->RegisterForExactType( plAudioSysMsg::Index(), fSys->GetKey() ); plgDispatch::Dispatch()->RegisterForExactType( plAudioSysMsg::Index(), fSys->GetKey() );
plgDispatch::Dispatch()->RegisterForExactType( plRenderMsg::Index(), fSys->GetKey() ); plgDispatch::Dispatch()->RegisterForExactType( plRenderMsg::Index(), fSys->GetKey() );
fWnd = hWnd;
if(fMuted) if(fMuted)
SetGlobalFadeVolume(0.0f); SetGlobalFadeVolume(0.0f);
@ -1143,7 +1141,7 @@ void plgAudioSys::Activate(bool b)
if( b ) if( b )
{ {
plStatusLog::AddLineS( "audio.log", plStatusLog::kBlue, "ASYS: -- Attempting audio system init --" ); plStatusLog::AddLineS( "audio.log", plStatusLog::kBlue, "ASYS: -- Attempting audio system init --" );
if( !fSys->Init( fWnd ) ) if( !fSys->Init() )
{ {
// Cannot init audio system. Don't activate // Cannot init audio system. Don't activate
return; return;

6
Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h

@ -94,7 +94,7 @@ public:
kRefEAXRegion kRefEAXRegion
}; };
bool Init(hsWindowHndl hWnd); bool Init();
void Shutdown(); void Shutdown();
void SetActive( bool b ); void SetActive( bool b );
@ -189,7 +189,7 @@ public:
kHardware, kHardware,
kHardwarePlusEAX, kHardwarePlusEAX,
}; };
static void Init(hsWindowHndl hWnd); static void Init();
static bool Hardware() { return fUseHardware; } static bool Hardware() { return fUseHardware; }
static void SetUseHardware(bool b); static void SetUseHardware(bool b);
static void SetActive(bool b); static void SetActive(bool b);
@ -199,7 +199,6 @@ public:
static void Shutdown(); static void Shutdown();
static void Activate(bool b); static void Activate(bool b);
static bool IsMuted( void ) { return fMuted; } static bool IsMuted( void ) { return fMuted; }
static hsWindowHndl hWnd() { return fWnd; }
static plAudioSystem* Sys() { return fSys; } static plAudioSystem* Sys() { return fSys; }
static void Restart( void ); static void Restart( void );
static bool UsingEAX( void ) { return fSys->fUsingEAX; } static bool UsingEAX( void ) { return fSys->fUsingEAX; }
@ -259,7 +258,6 @@ private:
static bool fInit; static bool fInit;
static bool fActive; static bool fActive;
static bool fMuted; static bool fMuted;
static hsWindowHndl fWnd;
static bool fUseHardware; static bool fUseHardware;
static bool fDelayedActivate; static bool fDelayedActivate;
static float fChannelVolumes[ kNumChannels ]; static float fChannelVolumes[ kNumChannels ];

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

@ -447,7 +447,7 @@ unsigned plWin32StreamingSound::GetByteOffset()
unsigned offset = fDSoundBuffer->GetByteOffset(); unsigned offset = fDSoundBuffer->GetByteOffset();
long byteoffset = ((fDataStream->GetDataSize() - fDataStream->NumBytesLeft()) - bytesQueued) + offset; long byteoffset = ((fDataStream->GetDataSize() - fDataStream->NumBytesLeft()) - bytesQueued) + offset;
return byteoffset < 0 ? fDataStream->GetDataSize() - abs(byteoffset) : byteoffset; return byteoffset < 0 ? fDataStream->GetDataSize() - std::abs(byteoffset) : byteoffset;
} }
return 0; return 0;
} }

Loading…
Cancel
Save