Browse Source

Fixes for plAudio errors.

Darryl Pogue 13 years ago
parent
commit
0bb10287c5
  1. 3
      Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp
  2. 2
      Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h
  3. 10
      Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp
  4. 18
      Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp
  5. 6
      Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp
  6. 13
      Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp
  7. 1
      Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h
  8. 3
      Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp
  9. 4
      Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h

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

@ -43,7 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <al.h> #include <al.h>
#include <alc.h> #include <alc.h>
#include <efx.h> #include <efx.h>
#include <MMREG.H>
#ifdef EAX_SDK_AVAILABLE #ifdef EAX_SDK_AVAILABLE
#include <eax.h> #include <eax.h>
#endif #endif
@ -1296,4 +1295,4 @@ void plgAudioSys::SetListenerOrientation(const hsVector3 view, const hsVector3 u
{ {
fSys->SetListenerOrientation(view, up); fSys->SetListenerOrientation(view, up);
} }
} }

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

@ -134,7 +134,7 @@ protected:
hsPoint3 fCurrListenerPos;//, fCommittedListenerPos; hsPoint3 fCurrListenerPos;//, fCommittedListenerPos;
hsBool fActive, fUsingEAX, fRestartOnDestruct, fWaitingForShutdown; hsBool fActive, fUsingEAX, fRestartOnDestruct, fWaitingForShutdown;
__int64 fStartTime; Int64 fStartTime;
hsTArray<hsKeyedObject *> fMyRefs; hsTArray<hsKeyedObject *> fMyRefs;
hsTArray<plEAXListenerMod *> fEAXRegions; hsTArray<plEAXListenerMod *> fEAXRegions;

10
Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp

@ -60,10 +60,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plAudioSystem.h" #include "plAudioSystem.h"
#include <al.h> #include <al.h>
#ifdef DX_OLD_SDK #if HS_BUILD_FOR_WIN32
#include <dxerr9.h> # ifdef DX_OLD_SDK
#else # include <dxerr9.h>
#include <dxerr.h> # else
# include <dxerr.h>
# endif
#endif #endif
#ifdef EAX_SDK_AVAILABLE #ifdef EAX_SDK_AVAILABLE

18
Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp

@ -361,8 +361,8 @@ void plVoicePlayer::PlaybackVoiceMessage(void* data, unsigned size, int numFrame
return; return;
} }
BYTE* newBuff; UInt8* newBuff;
newBuff = (BYTE*)nBuff; // Convert to byte data newBuff = (UInt8*)nBuff; // Convert to byte data
PlaybackUncompressedVoiceMessage(newBuff, numBytes); // playback uncompressed data PlaybackUncompressedVoiceMessage(newBuff, numBytes); // playback uncompressed data
delete[] nBuff; delete[] nBuff;
} }
@ -411,7 +411,7 @@ plVoiceSound::plVoiceSound()
fLastUpdate = 0; fLastUpdate = 0;
char keyName[32]; char keyName[32];
StrPrintf(keyName, arrsize(keyName), "VoiceSound_%d", fCount); snprintf(keyName, arrsize(keyName), "VoiceSound_%d", fCount);
fCount++; fCount++;
hsgResMgr::ResMgr()->NewKey(keyName, this, plLocation::kGlobalFixedLoc); hsgResMgr::ResMgr()->NewKey(keyName, this, plLocation::kGlobalFixedLoc);
} }
@ -431,7 +431,7 @@ hsBool plVoiceSound::LoadSound( hsBool is3D )
return false; // Don't set the failed flag, just return return false; // Don't set the failed flag, just return
plWAVHeader header; plWAVHeader header;
header.fFormatTag = WAVE_FORMAT_PCM; header.fFormatTag = 0x1; // WAVE_FORMAT_PCM
header.fBitsPerSample = 16; header.fBitsPerSample = 16;
header.fNumChannels = 1; header.fNumChannels = 1;
header.fNumSamplesPerSec = FREQUENCY; header.fNumSamplesPerSec = FREQUENCY;
@ -605,8 +605,8 @@ hsBool plSpeex::Encode(short *data, int numFrames, int *packedLength, hsRAMStrea
short *pData = data; // pointer to input data short *pData = data; // pointer to input data
float *input = TRACKED_NEW float[fFrameSize]; // input to speex - used as am intermediate array since speex requires float data float *input = TRACKED_NEW float[fFrameSize]; // input to speex - used as am intermediate array since speex requires float data
BYTE frameLength; // number of bytes speex compressed frame to UInt8 frameLength; // number of bytes speex compressed frame to
BYTE *frameData = TRACKED_NEW BYTE[fFrameSize]; // holds one frame of encoded data UInt8 *frameData = TRACKED_NEW UInt8[fFrameSize]; // holds one frame of encoded data
// encode data // encode data
for( int i = 0; i < numFrames; i++ ) for( int i = 0; i < numFrames; i++ )
@ -647,8 +647,8 @@ hsBool plSpeex::Decode(UInt8 *data, int size, int numFrames, int *numOutputBytes
short *pOut = out; // pointer to output short buffer short *pOut = out; // pointer to output short buffer
// create buffer for input data // create buffer for input data
BYTE *frameData = TRACKED_NEW BYTE[fFrameSize]; // holds the current frames data to be decoded UInt8 *frameData = TRACKED_NEW UInt8[fFrameSize]; // holds the current frames data to be decoded
BYTE frameLen; // holds the length of the current frame being decoded. UInt8 frameLen; // holds the length of the current frame being decoded.
// Decode data // Decode data
@ -711,4 +711,4 @@ void plSpeex::SetComplexity(UInt8 c)
{ {
fComplexity = c; fComplexity = c;
speex_encoder_ctl(fEncoderState, SPEEX_SET_COMPLEXITY, &fComplexity); speex_encoder_ctl(fEncoderState, SPEEX_SET_COMPLEXITY, &fComplexity);
} }

6
Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp

@ -39,7 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021 Mead, WA 99021
*==LICENSE==*/ *==LICENSE==*/
#include <direct.h> #if HS_BUILD_FOR_WIN32
# include <direct.h>
#else
# include <unistd.h>
#endif
#include "HeadSpin.h" #include "HeadSpin.h"
#include "hsGeometry3.h" #include "hsGeometry3.h"
#include "hsTimer.h" #include "hsTimer.h"

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

@ -39,12 +39,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021 Mead, WA 99021
*==LICENSE==*/ *==LICENSE==*/
#include <direct.h> #if HS_BUILD_FOR_WIN32
# include <direct.h>
#else
# include <unistd.h>
#endif
#include "HeadSpin.h" #include "HeadSpin.h"
#include "hsTimer.h" #include "hsTimer.h"
#include "hsGeometry3.h" #include "hsGeometry3.h"
#include "plgDispatch.h" #include "plgDispatch.h"
#include "plProfile.h" #include "plProfile.h"
#include "plFile/hsFiles.h"
#include "plWin32Sound.h" #include "plWin32Sound.h"
#include "plWin32StreamingSound.h" #include "plWin32StreamingSound.h"
@ -179,9 +184,9 @@ plSoundBuffer::ELoadReturnVal plWin32StreamingSound::IPreLoadBuffer( hsBool play
bool streamCompressed = (buffer->HasFlag(plSoundBuffer::kStreamCompressed) != 0); bool streamCompressed = (buffer->HasFlag(plSoundBuffer::kStreamCompressed) != 0);
/// Open da file /// Open da file
CHAR strPath[ MAX_PATH ]; char strPath[ kFolderIterator_MaxPath ];
_getcwd(strPath, MAX_PATH); getcwd(strPath, kFolderIterator_MaxPath);
if(sfxPath) if(sfxPath)
strcat( strPath, "\\sfx\\" ); strcat( strPath, "\\sfx\\" );
else else
@ -506,4 +511,4 @@ void plWin32StreamingSound::IAddCallback( plEventCallbackMsg *pCBMsg )
return; return;
} }
plWin32Sound::IAddCallback( pCBMsg ); plWin32Sound::IAddCallback( pCBMsg );
} }

1
Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h

@ -43,7 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define plWin32StreamingSound_h #define plWin32StreamingSound_h
#include "plWin32Sound.h" #include "plWin32Sound.h"
#include "pnUtils/pnUtils.h"
class plDSoundBuffer; class plDSoundBuffer;
class DSoundCallbackHandle; class DSoundCallbackHandle;

3
Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp

@ -51,6 +51,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// // // //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#if HS_BUILD_FOR_WIN32
#include "hsTypes.h" #include "hsTypes.h"
#include "plWinMicLevel.h" #include "plWinMicLevel.h"
#include "hsWindows.h" #include "hsWindows.h"
@ -375,3 +377,4 @@ MIXERLINE *IGetMixerSubLineByType( MIXERCONTROL *mux, DWORD type )
return nil; return nil;
} }
#endif

4
Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h

@ -42,6 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef _plWinMicLevel_h #ifndef _plWinMicLevel_h
#define _plWinMicLevel_h #define _plWinMicLevel_h
#if HS_BUILD_FOR_WIN32
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// // // //
// plWinMicLevel - Annoying class to deal with the annoying problem of // // plWinMicLevel - Annoying class to deal with the annoying problem of //
@ -76,5 +77,6 @@ protected:
static plWinMicLevel &IGetInstance( void ); static plWinMicLevel &IGetInstance( void );
void IShutdown( void ); void IShutdown( void );
}; };
#endif // HS_BUILD_FOR_WIN32
#endif // _plWinMicLevel_h #endif // _plWinMicLevel_h

Loading…
Cancel
Save