mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-20 04:09:16 +00:00
First effort to port HUru MKV/WEBM Movie Player to Minkata
Type restructuring for C++98 and build configuration updates. This version compiles successfully, but without webm libraries yet linked in.
This commit is contained in:
@ -105,21 +105,10 @@ plDSoundBuffer::~plDSoundBuffer()
|
||||
void plDSoundBuffer::IAllocate( UInt32 size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool tryStatic )
|
||||
{
|
||||
// Create a DSound buffer description
|
||||
fBufferDesc = TRACKED_NEW DSBUFFERDESC;
|
||||
fBufferDesc->dwSize = sizeof( DSBUFFERDESC );
|
||||
|
||||
fBufferDesc->dwBufferBytes = size;
|
||||
fBufferDesc->dwReserved = 0;
|
||||
fBufferDesc = new plWAVHeader;
|
||||
*fBufferDesc = bufferDesc;
|
||||
fBufferSize = size;
|
||||
|
||||
fBufferDesc->lpwfxFormat = TRACKED_NEW WAVEFORMATEX;
|
||||
fBufferDesc->lpwfxFormat->cbSize = 0;
|
||||
fBufferDesc->lpwfxFormat->nAvgBytesPerSec = bufferDesc.fAvgBytesPerSec;
|
||||
fBufferDesc->lpwfxFormat->nBlockAlign = bufferDesc.fBlockAlign;
|
||||
fBufferDesc->lpwfxFormat->nChannels = bufferDesc.fNumChannels;
|
||||
fBufferDesc->lpwfxFormat->nSamplesPerSec = bufferDesc.fNumSamplesPerSec;
|
||||
fBufferDesc->lpwfxFormat->wBitsPerSample = bufferDesc.fBitsPerSample;
|
||||
fBufferDesc->lpwfxFormat->wFormatTag = bufferDesc.fFormatTag;
|
||||
|
||||
// Do we want to try EAX?
|
||||
if( plgAudioSys::UsingEAX() )
|
||||
fEAXSource.Init( this );
|
||||
@ -149,14 +138,9 @@ void plDSoundBuffer::IRelease( void )
|
||||
alGetError();
|
||||
|
||||
memset(streamingBuffers, 0, STREAMING_BUFFERS * sizeof(unsigned));
|
||||
if( fBufferDesc != nil )
|
||||
{
|
||||
delete fBufferDesc->lpwfxFormat;
|
||||
fBufferDesc->lpwfxFormat = nil;
|
||||
}
|
||||
|
||||
delete fBufferDesc;
|
||||
fBufferDesc = nil;
|
||||
fBufferSize = 0;
|
||||
|
||||
fValid = false;
|
||||
plProfile_Dec( NumAllocated );
|
||||
@ -197,7 +181,7 @@ bool plDSoundBuffer::FillBuffer(void *data, unsigned bytes, plWAVHeader *header)
|
||||
source = 0;
|
||||
buffer = 0;
|
||||
|
||||
ALenum format = IGetALFormat(fBufferDesc->lpwfxFormat->wBitsPerSample, fBufferDesc->lpwfxFormat->nChannels);
|
||||
ALenum format = IGetALFormat(fBufferDesc->fBitsPerSample, fBufferDesc->fNumChannels);
|
||||
ALenum error = alGetError();
|
||||
alGenBuffers(1, &buffer);
|
||||
error = alGetError();
|
||||
@ -280,8 +264,8 @@ bool plDSoundBuffer::SetupStreamingSource(plAudioFileReader *stream)
|
||||
return false;
|
||||
}
|
||||
|
||||
ALenum format = IGetALFormat(fBufferDesc->lpwfxFormat->wBitsPerSample, fBufferDesc->lpwfxFormat->nChannels);
|
||||
alBufferData( streamingBuffers[i], format, data, size, fBufferDesc->lpwfxFormat->nSamplesPerSec );
|
||||
ALenum format = IGetALFormat(fBufferDesc->fBitsPerSample, fBufferDesc->fNumChannels);
|
||||
alBufferData( streamingBuffers[i], format, data, size, fBufferDesc->fNumSamplesPerSec );
|
||||
if( (error = alGetError()) != AL_NO_ERROR )
|
||||
plStatusLog::AddLineS("audio.log", "alBufferData");
|
||||
}
|
||||
@ -346,8 +330,8 @@ bool plDSoundBuffer::SetupStreamingSource(void *data, unsigned bytes)
|
||||
return false;
|
||||
}
|
||||
|
||||
ALenum format = IGetALFormat(fBufferDesc->lpwfxFormat->wBitsPerSample, fBufferDesc->lpwfxFormat->nChannels);
|
||||
alBufferData( streamingBuffers[i], format, bufferData, size, fBufferDesc->lpwfxFormat->nSamplesPerSec );
|
||||
ALenum format = IGetALFormat(fBufferDesc->fBitsPerSample, fBufferDesc->fNumChannels);
|
||||
alBufferData( streamingBuffers[i], format, bufferData, size, fBufferDesc->fNumSamplesPerSec );
|
||||
if( (error = alGetError()) != AL_NO_ERROR )
|
||||
plStatusLog::AddLineS("audio.log", "alBufferData");
|
||||
}
|
||||
@ -364,7 +348,7 @@ bool plDSoundBuffer::SetupStreamingSource(void *data, unsigned bytes)
|
||||
SetScalarVolume(0);
|
||||
|
||||
alSourcef(source, AL_ROLLOFF_FACTOR, 0.3048);
|
||||
alGetError();
|
||||
error = alGetError();
|
||||
if( error != AL_NO_ERROR )
|
||||
{
|
||||
return false;
|
||||
@ -381,7 +365,7 @@ bool plDSoundBuffer::SetupStreamingSource(void *data, unsigned bytes)
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
int plDSoundBuffer::BuffersProcessed()
|
||||
int plDSoundBuffer::BuffersProcessed( void )
|
||||
{
|
||||
if(alIsSource(source)==AL_FALSE)
|
||||
{
|
||||
@ -399,7 +383,7 @@ int plDSoundBuffer::BuffersProcessed()
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
int plDSoundBuffer::BuffersQueued()
|
||||
int plDSoundBuffer::BuffersQueued( void )
|
||||
{
|
||||
if(alIsSource(source)==AL_FALSE) return 0;
|
||||
ALint queued = 0;
|
||||
@ -450,8 +434,8 @@ bool plDSoundBuffer::StreamingFillBuffer(plAudioFileReader *stream)
|
||||
{ unsigned int size = stream->NumBytesLeft() < STREAM_BUFFER_SIZE ? stream->NumBytesLeft() : STREAM_BUFFER_SIZE;
|
||||
stream->Read(size, data);
|
||||
|
||||
ALenum format = IGetALFormat(fBufferDesc->lpwfxFormat->wBitsPerSample, fBufferDesc->lpwfxFormat->nChannels);
|
||||
alBufferData( bufferId, format, data, size, fBufferDesc->lpwfxFormat->nSamplesPerSec );
|
||||
ALenum format = IGetALFormat(fBufferDesc->fBitsPerSample, fBufferDesc->fNumChannels);
|
||||
alBufferData( bufferId, format, data, size, fBufferDesc->fNumSamplesPerSec );
|
||||
if( (error = alGetError()) != AL_NO_ERROR )
|
||||
{
|
||||
plStatusLog::AddLineS("audio.log", "Failed to copy data to sound buffer %d", error);
|
||||
@ -492,10 +476,9 @@ bool plDSoundBuffer::GetAvailableBufferId(unsigned *bufferId)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool plDSoundBuffer::SetupVoiceSource()
|
||||
bool plDSoundBuffer::SetupVoiceSource( void )
|
||||
{
|
||||
ALenum error;
|
||||
alGetError();
|
||||
ALenum error = alGetError();
|
||||
|
||||
// Generate AL Buffers
|
||||
alGenBuffers( STREAMING_BUFFERS, streamingBuffers );
|
||||
@ -523,13 +506,13 @@ bool plDSoundBuffer::SetupVoiceSource()
|
||||
SetScalarVolume(0);
|
||||
|
||||
alSourcef(source, AL_ROLLOFF_FACTOR, 0.3048);
|
||||
alGetError();
|
||||
error = alGetError();
|
||||
if( error != AL_NO_ERROR )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
alSourcei(source, AL_BUFFER, nil);
|
||||
alGetError();
|
||||
error = alGetError();
|
||||
//alSourcei(source, AL_PITCH, 0);
|
||||
|
||||
// dont queue any buffers here
|
||||
@ -537,7 +520,7 @@ bool plDSoundBuffer::SetupVoiceSource()
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void plDSoundBuffer::UnQueueVoiceBuffers()
|
||||
void plDSoundBuffer::UnQueueVoiceBuffers( void )
|
||||
{
|
||||
unsigned buffersProcessed = BuffersProcessed();
|
||||
if(buffersProcessed)
|
||||
@ -566,8 +549,8 @@ bool plDSoundBuffer::VoiceFillBuffer(void *data, unsigned bytes, unsigned buffer
|
||||
ALenum error;
|
||||
unsigned int size = bytes < STREAM_BUFFER_SIZE ? bytes : STREAM_BUFFER_SIZE;
|
||||
|
||||
ALenum format = IGetALFormat(fBufferDesc->lpwfxFormat->wBitsPerSample, fBufferDesc->lpwfxFormat->nChannels);
|
||||
alBufferData( bufferId, format, data, size, fBufferDesc->lpwfxFormat->nSamplesPerSec );
|
||||
ALenum format = IGetALFormat(fBufferDesc->fBitsPerSample, fBufferDesc->fNumChannels);
|
||||
alBufferData( bufferId, format, data, size, fBufferDesc->fNumSamplesPerSec );
|
||||
if( (error = alGetError()) != AL_NO_ERROR )
|
||||
{
|
||||
plStatusLog::AddLineS("audio.log", "Failed to copy data to sound buffer %d", error);
|
||||
@ -635,6 +618,16 @@ void plDSoundBuffer::Play( void )
|
||||
|
||||
}
|
||||
|
||||
//// Pause ////////////////////////////////////////////////////////////////////
|
||||
|
||||
void plDSoundBuffer::Pause( void )
|
||||
{
|
||||
if (!source)
|
||||
return;
|
||||
alSourcePause(source);
|
||||
alGetError();
|
||||
}
|
||||
|
||||
//// Stop ////////////////////////////////////////////////////////////////////
|
||||
|
||||
void plDSoundBuffer::Stop( void )
|
||||
@ -692,7 +685,7 @@ void plDSoundBuffer::SetConeOutsideVolume(int vol)
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void plDSoundBuffer::Rewind()
|
||||
void plDSoundBuffer::Rewind( void )
|
||||
{
|
||||
alSourceRewind(source);
|
||||
alGetError();
|
||||
@ -719,17 +712,17 @@ hsBool plDSoundBuffer::IsEAXAccelerated( void ) const
|
||||
|
||||
UInt32 plDSoundBuffer::BytePosToMSecs( UInt32 bytePos ) const
|
||||
{
|
||||
return (UInt32)(bytePos * 1000 / (hsScalar)fBufferDesc->lpwfxFormat->nAvgBytesPerSec);
|
||||
return (UInt32)(bytePos * 1000 / (hsScalar)fBufferDesc->fAvgBytesPerSec);
|
||||
}
|
||||
|
||||
//// GetBufferBytePos ////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plDSoundBuffer::GetBufferBytePos( hsScalar timeInSecs ) const
|
||||
{
|
||||
hsAssert( fBufferDesc != nil && fBufferDesc->lpwfxFormat != nil, "Nil buffer description when calling GetBufferBytePos()" );
|
||||
hsAssert( fBufferDesc != nil, "Nil buffer description when calling GetBufferBytePos()" );
|
||||
|
||||
UInt32 byte = (UInt32)( timeInSecs * (hsScalar)fBufferDesc->lpwfxFormat->nSamplesPerSec );
|
||||
byte *= fBufferDesc->lpwfxFormat->nBlockAlign;
|
||||
UInt32 byte = (UInt32)( timeInSecs * (hsScalar)fBufferDesc->fNumSamplesPerSec );
|
||||
byte *= fBufferDesc->fBlockAlign;
|
||||
|
||||
return byte;
|
||||
}
|
||||
@ -738,7 +731,7 @@ UInt32 plDSoundBuffer::GetBufferBytePos( hsScalar timeInSecs ) const
|
||||
|
||||
UInt32 plDSoundBuffer::GetLengthInBytes( void ) const
|
||||
{
|
||||
return (UInt32)fBufferDesc->dwBufferBytes;
|
||||
return fBufferSize;
|
||||
}
|
||||
|
||||
//// SetEAXSettings //////////////////////////////////////////////////////////
|
||||
@ -752,7 +745,7 @@ void plDSoundBuffer::SetEAXSettings( plEAXSourceSettings *settings, hsBool forc
|
||||
|
||||
UInt8 plDSoundBuffer::GetBlockAlign( void ) const
|
||||
{
|
||||
return ( fBufferDesc != nil && fBufferDesc->lpwfxFormat != nil ) ? fBufferDesc->lpwfxFormat->nBlockAlign : 0;
|
||||
return ( fBufferDesc != nil ) ? fBufferDesc->fBlockAlign : 0;
|
||||
}
|
||||
|
||||
//// SetScalarVolume /////////////////////////////////////////////////////////
|
||||
@ -769,7 +762,7 @@ void plDSoundBuffer::SetScalarVolume( hsScalar volume )
|
||||
}
|
||||
}
|
||||
|
||||
unsigned plDSoundBuffer::GetByteOffset()
|
||||
unsigned plDSoundBuffer::GetByteOffset( void )
|
||||
{
|
||||
ALint bytes;
|
||||
alGetSourcei(source, AL_BYTE_OFFSET, &bytes);
|
||||
@ -777,7 +770,7 @@ unsigned plDSoundBuffer::GetByteOffset()
|
||||
return bytes;
|
||||
}
|
||||
|
||||
float plDSoundBuffer::GetTimeOffsetSec()
|
||||
float plDSoundBuffer::GetTimeOffsetSec( void )
|
||||
{
|
||||
float time;
|
||||
alGetSourcef(source, AL_SEC_OFFSET, &time);
|
||||
@ -796,4 +789,4 @@ void plDSoundBuffer::SetTimeOffsetBytes(unsigned bytes)
|
||||
alSourcef(source, AL_BYTE_OFFSET, bytes);
|
||||
ALenum error = alGetError();
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,9 +62,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class plWAVHeader;
|
||||
class plAudioFileReader;
|
||||
|
||||
typedef struct tWAVEFORMATEX WAVEFORMATEX;
|
||||
typedef struct _DSBUFFERDESC DSBUFFERDESC;
|
||||
|
||||
|
||||
// Ported to OpenAL from DirectSound May 2006. Idealy the openal sources would be seperate from this class.
|
||||
// OpenAl sound buffer, and source.
|
||||
@ -74,11 +71,12 @@ public:
|
||||
plDSoundBuffer( UInt32 size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool looping, hsBool tryStatic = false, bool streaming = false );
|
||||
~plDSoundBuffer();
|
||||
|
||||
void Play( void );
|
||||
void Stop( void );
|
||||
void Play();
|
||||
void Stop();
|
||||
void Pause();
|
||||
void Rewind() ;
|
||||
|
||||
UInt32 GetLengthInBytes( void ) const;
|
||||
UInt32 GetLengthInBytes() const;
|
||||
void SetScalarVolume( hsScalar volume ); // Sets the volume, but on a range from 0 to 1
|
||||
|
||||
unsigned GetSource() { return source; }
|
||||
@ -93,10 +91,10 @@ public:
|
||||
void SetMinDistance( int dist);
|
||||
void SetMaxDistance( int dist );
|
||||
|
||||
hsBool IsValid( void ) const { return fValid; }
|
||||
hsBool IsPlaying( void );
|
||||
hsBool IsLooping( void ) const { return fLooping; }
|
||||
hsBool IsEAXAccelerated( void ) const;
|
||||
hsBool IsValid() const { return fValid; }
|
||||
hsBool IsPlaying();
|
||||
hsBool IsLooping() const { return fLooping; }
|
||||
hsBool IsEAXAccelerated() const;
|
||||
|
||||
bool FillBuffer(void *data, unsigned bytes, plWAVHeader *header);
|
||||
|
||||
@ -143,7 +141,8 @@ protected:
|
||||
|
||||
hsTArray<UInt32> fPosNotifys;
|
||||
bool fStreaming;
|
||||
DSBUFFERDESC* fBufferDesc;
|
||||
plWAVHeader* fBufferDesc;
|
||||
UInt32 fBufferSize;
|
||||
|
||||
unsigned buffer; // used if this is not a streaming buffer
|
||||
unsigned streamingBuffers[STREAMING_BUFFERS]; // used if this is a streaming buffer
|
||||
@ -161,7 +160,7 @@ protected:
|
||||
hsScalar fPrevVolume;
|
||||
|
||||
void IAllocate( UInt32 size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool tryStatic );
|
||||
void IRelease( void );
|
||||
void IRelease();
|
||||
int IGetALFormat(unsigned bitsPerSample, unsigned int numChannels);
|
||||
};
|
||||
|
||||
|
@ -163,19 +163,20 @@ public:
|
||||
fLengthInSecs = len; fVolStart = start; fVolEnd = end; fType = type;
|
||||
fStopWhenDone = false;
|
||||
fFadeSoftVol = false;
|
||||
fCurrTime = -1.f;
|
||||
}
|
||||
|
||||
void Read( hsStream *s );
|
||||
void Write( hsStream *s );
|
||||
|
||||
hsScalar InterpValue( void );
|
||||
hsScalar InterpValue();
|
||||
|
||||
protected:
|
||||
hsScalar fCurrTime; // -1 if we aren't active, else it's how far we're into the animation
|
||||
};
|
||||
|
||||
virtual hsBool LoadSound( hsBool is3D ) = 0;
|
||||
hsScalar GetVirtualStartTime( void ) const { return (hsScalar)fVirtualStartTime; }
|
||||
hsScalar GetVirtualStartTime() const { return (hsScalar)fVirtualStartTime; }
|
||||
|
||||
virtual void Play();
|
||||
void SynchedPlay( unsigned bytes );
|
||||
@ -188,16 +189,16 @@ public:
|
||||
virtual int GetMin() const;
|
||||
virtual int GetMax() const;
|
||||
virtual void SetVolume(const float volume);
|
||||
virtual float GetVolume(void) const { return fCurrVolume; }
|
||||
virtual float GetVolume() const { return fCurrVolume; }
|
||||
hsScalar GetMaxVolume() { return fMaxVolume; }
|
||||
virtual hsBool IsPlaying() { return fPlaying; }
|
||||
void SetTime(double t);
|
||||
virtual double GetTime( void ) { return 0.f; }
|
||||
virtual double GetTime() { return 0.f; }
|
||||
virtual void Activate(hsBool forcePlay = false);
|
||||
virtual void DeActivate();
|
||||
virtual void SetLength(double l) { fLength = l; }
|
||||
virtual void SetMuted( hsBool muted );
|
||||
virtual hsBool IsMuted( void ) { return fMuted; }
|
||||
virtual hsBool IsMuted() { return fMuted; }
|
||||
void Disable() { fDistAttenuation = 0; }
|
||||
virtual plSoundMsg* GetStatus(plSoundMsg* pMsg){return NULL;}
|
||||
virtual void SetConeOrientation(hsScalar x, hsScalar y, hsScalar z);
|
||||
@ -210,16 +211,16 @@ public:
|
||||
|
||||
virtual void Update();
|
||||
|
||||
plSoundBuffer * GetDataBuffer( void ) const { return (plSoundBuffer *)fDataBufferKey->ObjectIsLoaded(); }
|
||||
hsScalar QueryCurrVolume( void ) const; // Returns the current volume, attenuated
|
||||
plSoundBuffer * GetDataBuffer() const { return (plSoundBuffer *)fDataBufferKey->ObjectIsLoaded(); }
|
||||
hsScalar QueryCurrVolume() const; // Returns the current volume, attenuated
|
||||
|
||||
const char * GetFileName( void ) const;
|
||||
const char * GetFileName() const;
|
||||
virtual double GetLength();
|
||||
|
||||
void SetProperty( Property prop, hsBool on ) { if( on ) fProperties |= prop; else fProperties &= ~prop; }
|
||||
hsBool IsPropertySet( Property prop ) const { return ( fProperties & prop ) ? true : false; }
|
||||
|
||||
virtual void RefreshVolume( void );
|
||||
virtual void RefreshVolume();
|
||||
|
||||
virtual void SetStartPos(unsigned bytes) = 0;
|
||||
virtual unsigned GetByteOffset(){return 0;}
|
||||
@ -228,7 +229,7 @@ public:
|
||||
virtual void AddCallbacks(plSoundMsg* pMsg) = 0;
|
||||
virtual void RemoveCallbacks(plSoundMsg* pMsg) = 0;
|
||||
|
||||
virtual UInt8 GetChannelSelect( void ) const { return 0; } // Only defined on Win32Sound right now, should be here tho
|
||||
virtual UInt8 GetChannelSelect() const { return 0; } // Only defined on Win32Sound right now, should be here tho
|
||||
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
@ -246,34 +247,34 @@ public:
|
||||
|
||||
// Type setting and getting, from the Types enum
|
||||
void SetType( UInt8 type ) { fType = type; }
|
||||
UInt8 GetType( void ) const { return fType; }
|
||||
UInt8 GetType() const { return fType; }
|
||||
|
||||
// Priority stuff
|
||||
void SetPriority( UInt8 pri ) { fPriority = pri; }
|
||||
UInt8 GetPriority( void ) const { return fPriority; }
|
||||
UInt8 GetPriority() const { return fPriority; }
|
||||
|
||||
// Visualization
|
||||
virtual plDrawableSpans* CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo);
|
||||
|
||||
// Forced loading/unloading (for when the audio system's LOD just doesn't cut it)
|
||||
virtual void ForceLoad( );
|
||||
virtual void ForceUnload( void );
|
||||
virtual void ForceUnload();
|
||||
|
||||
// Note: ONLY THE AUDIOSYS SHOULD CALL THIS. If you're not the audioSys, get lost.
|
||||
static void SetCurrDebugPlate( const plKey soundKey );
|
||||
|
||||
void RegisterOnAudioSys( void );
|
||||
void UnregisterOnAudioSys( void );
|
||||
void RegisterOnAudioSys();
|
||||
void UnregisterOnAudioSys();
|
||||
|
||||
// Also only for the audio system
|
||||
hsScalar GetVolumeRank( void );
|
||||
void ForceUnregisterFromAudioSys( void );
|
||||
hsScalar GetVolumeRank();
|
||||
void ForceUnregisterFromAudioSys();
|
||||
|
||||
static void SetLoadOnDemand( hsBool activate ) { fLoadOnDemandFlag = activate; }
|
||||
static void SetLoadFromDiskOnDemand( hsBool activate ) { fLoadFromDiskOnDemand = activate; }
|
||||
|
||||
const plEAXSourceSettings &GetEAXSettings( void ) const { return fEAXSettings; }
|
||||
plEAXSourceSettings &GetEAXSettings( void ) { return fEAXSettings; }
|
||||
const plEAXSourceSettings &GetEAXSettings() const { return fEAXSettings; }
|
||||
plEAXSourceSettings &GetEAXSettings() { return fEAXSettings; }
|
||||
virtual StreamType GetStreamType() const { return kNoStream; }
|
||||
virtual void FreeSoundData();
|
||||
|
||||
@ -340,40 +341,40 @@ protected:
|
||||
static hsBool fLoadOnDemandFlag, fLoadFromDiskOnDemand;
|
||||
hsBool fLoading;
|
||||
|
||||
void IUpdateDebugPlate( void );
|
||||
void IUpdateDebugPlate();
|
||||
void IPrintDbgMessage( const char *msg, hsBool isErr = false );
|
||||
|
||||
virtual void ISetActualVolume(const float v) = 0;
|
||||
virtual void IActuallyStop( void );
|
||||
virtual hsBool IActuallyPlaying( void ) = 0;
|
||||
virtual void IActuallyPlay( void ) = 0;
|
||||
virtual void IFreeBuffers( void ) = 0;
|
||||
virtual void ISetActualVolume(float v) = 0;
|
||||
virtual void IActuallyStop();
|
||||
virtual hsBool IActuallyPlaying() = 0;
|
||||
virtual void IActuallyPlay() = 0;
|
||||
virtual void IFreeBuffers() = 0;
|
||||
|
||||
//NOTE: if isIncidental is true the entire sound will be loaded.
|
||||
virtual plSoundBuffer::ELoadReturnVal IPreLoadBuffer( hsBool playWhenLoaded, hsBool isIncidental = false );
|
||||
virtual void ISetActualTime( double t ) = 0;
|
||||
|
||||
virtual hsBool IActuallyLoaded( void ) = 0;
|
||||
virtual hsBool IActuallyLoaded() = 0;
|
||||
virtual void IRefreshEAXSettings( hsBool force = false ) = 0;
|
||||
|
||||
virtual hsScalar IGetChannelVolume( void ) const;
|
||||
virtual hsScalar IGetChannelVolume() const;
|
||||
|
||||
void ISynchToStartTime( void );
|
||||
void ISynchToStartTime();
|
||||
void ISynchedPlay( double virtualStartTime );
|
||||
void IStartFade( plFadeParams *params, hsScalar offsetIntoFade = 0.f );
|
||||
void IStopFade( hsBool shuttingDown = false, hsBool SetVolEnd = true);
|
||||
|
||||
hsBool IWillBeAbleToPlay( void );
|
||||
hsBool IWillBeAbleToPlay();
|
||||
|
||||
void ISetSoftRegion( plSoftVolume *region );
|
||||
hsScalar IAttenuateActualVolume( hsScalar volume ) const;
|
||||
void ISetSoftOcclusionRegion( plSoftVolume *region );
|
||||
|
||||
// Override to make sure the buffer is available before the base class is called
|
||||
virtual void IRefreshParams( void );
|
||||
virtual void IRefreshParams();
|
||||
|
||||
virtual bool ILoadDataBuffer( void );
|
||||
virtual void IUnloadDataBuffer( void );
|
||||
virtual bool ILoadDataBuffer();
|
||||
virtual void IUnloadDataBuffer();
|
||||
|
||||
//virtual void ISetMinDistance( const int m ) = 0;
|
||||
//virtual void ISetMaxDistance( const int m ) = 0;
|
||||
|
@ -0,0 +1,122 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "plWin32VideoSound.h"
|
||||
|
||||
#include "hsResMgr.h"
|
||||
#include "plDSoundBuffer.h"
|
||||
|
||||
static int uniqueID = 0;
|
||||
plWin32VideoSound::plWin32VideoSound(const plWAVHeader& header) : plWin32Sound()
|
||||
{
|
||||
fCurrVolume = 1.0f;
|
||||
fDesiredVol = 1.0f;
|
||||
fSoftVolume = 1.0f;
|
||||
fType = kGUISound;
|
||||
|
||||
fWAVHeader = header;
|
||||
fDSoundBuffer = new plDSoundBuffer(0, fWAVHeader, false, false);
|
||||
|
||||
uniqueID++;
|
||||
|
||||
char keyName[32];
|
||||
StrPrintf(keyName, arrsize(keyName), "VoiceSound_%d", uniqueID);
|
||||
|
||||
hsgResMgr::ResMgr()->NewKey(keyName, this, plLocation::kGlobalFixedLoc);
|
||||
}
|
||||
|
||||
plWin32VideoSound::~plWin32VideoSound()
|
||||
{
|
||||
if (fDSoundBuffer)
|
||||
delete fDSoundBuffer;
|
||||
}
|
||||
|
||||
void plWin32VideoSound::Play()
|
||||
{
|
||||
IActuallyPlay();
|
||||
}
|
||||
|
||||
void plWin32VideoSound::Pause(bool on)
|
||||
{
|
||||
if (on)
|
||||
fDSoundBuffer->Pause();
|
||||
else if (!fReallyPlaying)
|
||||
fDSoundBuffer->Play();
|
||||
fReallyPlaying = !on;
|
||||
}
|
||||
|
||||
void plWin32VideoSound::FillSoundBuffer(void* buffer, size_t size)
|
||||
{
|
||||
fDSoundBuffer->FillBuffer(buffer, size, &fWAVHeader);
|
||||
fDSoundBuffer->SetScalarVolume(1.0f);
|
||||
}
|
||||
|
||||
void plWin32VideoSound::IDerivedActuallyPlay()
|
||||
{
|
||||
if (!fReallyPlaying) {
|
||||
fDSoundBuffer->Play();
|
||||
fReallyPlaying = true;
|
||||
}
|
||||
}
|
||||
|
||||
hsBool plWin32VideoSound::LoadSound(hsBool is3D)
|
||||
{
|
||||
hsAssert(false, "unimplemented cause unnecessary for this class");
|
||||
return false;
|
||||
}
|
||||
|
||||
void plWin32VideoSound::SetStartPos(unsigned bytes)
|
||||
{
|
||||
//do nothing
|
||||
hsAssert(false, "unimplemented cause unnecessary for this class");
|
||||
}
|
||||
|
||||
float plWin32VideoSound::GetActualTimeSec()
|
||||
{
|
||||
hsAssert(false, "unimplemented cause unnecessary for this class");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void plWin32VideoSound::ISetActualTime(double t)
|
||||
{
|
||||
hsAssert(false, "unimplemented cause unnecessary for this class");
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plWin32VideoSound_h
|
||||
#define plWin32VideoSound_h
|
||||
|
||||
#include "plWin32Sound.h"
|
||||
|
||||
class plWin32VideoSound : public plWin32Sound
|
||||
{
|
||||
public:
|
||||
plWin32VideoSound(const plWAVHeader& header);
|
||||
virtual ~plWin32VideoSound();
|
||||
|
||||
virtual void Play();
|
||||
virtual void Pause(bool on);
|
||||
void FillSoundBuffer(void* buffer, size_t size);
|
||||
|
||||
protected:
|
||||
void IDerivedActuallyPlay();
|
||||
hsBool LoadSound(hsBool is3D);
|
||||
void SetStartPos(unsigned bytes);
|
||||
float GetActualTimeSec();
|
||||
void ISetActualTime(double t);
|
||||
|
||||
plWAVHeader fWAVHeader;
|
||||
};
|
||||
#endif
|
Reference in New Issue
Block a user