mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-15 10:54:18 +00:00
Eliminate hsScalar and hsFixed
Modern CPUs support floats just fine... hsFixed was crazy.
This commit is contained in:
@ -88,7 +88,7 @@ class plSoftSoundNode
|
||||
{
|
||||
public:
|
||||
const plKey fSoundKey;
|
||||
hsScalar fRank;
|
||||
float fRank;
|
||||
|
||||
plSoftSoundNode *fNext;
|
||||
plSoftSoundNode **fPrev;
|
||||
@ -120,7 +120,7 @@ class plSoftSoundNode
|
||||
}
|
||||
}
|
||||
|
||||
void SortedLink( plSoftSoundNode **prev, hsScalar rank )
|
||||
void SortedLink( plSoftSoundNode **prev, float rank )
|
||||
{
|
||||
fRank = rank;
|
||||
|
||||
@ -132,7 +132,7 @@ class plSoftSoundNode
|
||||
}
|
||||
|
||||
// Larger values are first in the list
|
||||
void AddToSortedLink( plSoftSoundNode *toAdd, hsScalar rank )
|
||||
void AddToSortedLink( plSoftSoundNode *toAdd, float rank )
|
||||
{
|
||||
if( fRank > rank )
|
||||
{
|
||||
@ -632,7 +632,7 @@ void plAudioSystem::UnregisterSoftSound( const plKey soundKey )
|
||||
void plAudioSystem::IUpdateSoftSounds( const hsPoint3 &newPosition )
|
||||
{
|
||||
plSoftSoundNode *node, *myNode;
|
||||
hsScalar distSquared, rank;
|
||||
float distSquared, rank;
|
||||
plSoftSoundNode *sortedList = nil;
|
||||
int32_t i;
|
||||
|
||||
@ -896,7 +896,7 @@ hsBool plAudioSystem::MsgReceive(plMessage* msg)
|
||||
}
|
||||
else
|
||||
{
|
||||
plgAudioSys::SetGlobalFadeVolume( (hsScalar)((currTime-fStartFade) / fFadeLength) );
|
||||
plgAudioSys::SetGlobalFadeVolume( (float)((currTime-fStartFade) / fFadeLength) );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -996,14 +996,14 @@ hsBool plgAudioSys::fMuted = true;
|
||||
hsBool plgAudioSys::fDelayedActivate = false;
|
||||
hsBool plgAudioSys::fEnableEAX = false;
|
||||
hsWindowHndl plgAudioSys::fWnd = nil;
|
||||
hsScalar plgAudioSys::fChannelVolumes[ kNumChannels ] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f };
|
||||
hsScalar plgAudioSys::f2D3DBias = 0.75f;
|
||||
float plgAudioSys::fChannelVolumes[ kNumChannels ] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f };
|
||||
float plgAudioSys::f2D3DBias = 0.75f;
|
||||
uint32_t plgAudioSys::fDebugFlags = 0;
|
||||
hsScalar plgAudioSys::fStreamingBufferSize = 2.f;
|
||||
hsScalar plgAudioSys::fStreamFromRAMCutoff = 10.f;
|
||||
float plgAudioSys::fStreamingBufferSize = 2.f;
|
||||
float plgAudioSys::fStreamFromRAMCutoff = 10.f;
|
||||
uint8_t plgAudioSys::fPriorityCutoff = 9; // We cut off sounds above this priority
|
||||
hsBool plgAudioSys::fEnableExtendedLogs = false;
|
||||
hsScalar plgAudioSys::fGlobalFadeVolume = 1.f;
|
||||
float plgAudioSys::fGlobalFadeVolume = 1.f;
|
||||
hsBool plgAudioSys::fLogStreamingUpdates = false;
|
||||
std::string plgAudioSys::fDeviceName;
|
||||
hsBool plgAudioSys::fRestarting = false;
|
||||
@ -1183,12 +1183,12 @@ void plgAudioSys::Activate(hsBool b)
|
||||
fInit = false;
|
||||
}
|
||||
|
||||
void plgAudioSys::SetChannelVolume( ASChannel chan, hsScalar vol )
|
||||
void plgAudioSys::SetChannelVolume( ASChannel chan, float vol )
|
||||
{
|
||||
fChannelVolumes[ chan ] = vol;
|
||||
}
|
||||
|
||||
void plgAudioSys::SetGlobalFadeVolume( hsScalar vol )
|
||||
void plgAudioSys::SetGlobalFadeVolume( float vol )
|
||||
{
|
||||
if(!fMuted)
|
||||
fGlobalFadeVolume = vol;
|
||||
@ -1196,7 +1196,7 @@ void plgAudioSys::SetGlobalFadeVolume( hsScalar vol )
|
||||
fGlobalFadeVolume = 0;
|
||||
}
|
||||
|
||||
hsScalar plgAudioSys::GetChannelVolume( ASChannel chan )
|
||||
float plgAudioSys::GetChannelVolume( ASChannel chan )
|
||||
{
|
||||
return fChannelVolumes[ chan ];
|
||||
}
|
||||
@ -1206,12 +1206,12 @@ void plgAudioSys::NextDebugSound( void )
|
||||
fSys->NextDebugSound();
|
||||
}
|
||||
|
||||
void plgAudioSys::Set2D3DBias( hsScalar bias )
|
||||
void plgAudioSys::Set2D3DBias( float bias )
|
||||
{
|
||||
f2D3DBias = bias;
|
||||
}
|
||||
|
||||
hsScalar plgAudioSys::Get2D3Dbias()
|
||||
float plgAudioSys::Get2D3Dbias()
|
||||
{
|
||||
return f2D3DBias;
|
||||
}
|
||||
|
@ -205,21 +205,21 @@ public:
|
||||
|
||||
static void NextDebugSound( void );
|
||||
|
||||
static void SetChannelVolume( ASChannel chan, hsScalar vol );
|
||||
static hsScalar GetChannelVolume( ASChannel chan );
|
||||
static void SetChannelVolume( ASChannel chan, float vol );
|
||||
static float GetChannelVolume( ASChannel chan );
|
||||
|
||||
static void Set2D3DBias( hsScalar bias );
|
||||
static hsScalar Get2D3Dbias();
|
||||
static void Set2D3DBias( float bias );
|
||||
static float Get2D3Dbias();
|
||||
|
||||
static void SetGlobalFadeVolume( hsScalar vol );
|
||||
static hsScalar GetGlobalFadeVolume( void ) { return fGlobalFadeVolume; }
|
||||
static void SetGlobalFadeVolume( float vol );
|
||||
static float GetGlobalFadeVolume( void ) { return fGlobalFadeVolume; }
|
||||
|
||||
static void SetDebugFlag( uint32_t flag, hsBool set = true ) { if( set ) fDebugFlags |= flag; else fDebugFlags &= ~flag; }
|
||||
static hsBool IsDebugFlagSet( uint32_t flag ) { return fDebugFlags & flag; }
|
||||
static void ClearDebugFlags( void ) { fDebugFlags = 0; }
|
||||
|
||||
static hsScalar GetStreamingBufferSize( void ) { return fStreamingBufferSize; }
|
||||
static void SetStreamingBufferSize( hsScalar size ) { fStreamingBufferSize = size; }
|
||||
static float GetStreamingBufferSize( void ) { return fStreamingBufferSize; }
|
||||
static void SetStreamingBufferSize( float size ) { fStreamingBufferSize = size; }
|
||||
|
||||
static uint8_t GetPriorityCutoff( void ) { return fPriorityCutoff; }
|
||||
static void SetPriorityCutoff( uint8_t cut ) { fPriorityCutoff = cut; if(fSys) fSys->SetMaxNumberOfActiveSounds(); }
|
||||
@ -227,8 +227,8 @@ public:
|
||||
static hsBool AreExtendedLogsEnabled( void ) { return fEnableExtendedLogs; }
|
||||
static void EnableExtendedLogs( hsBool e ) { fEnableExtendedLogs = e; }
|
||||
|
||||
static hsScalar GetStreamFromRAMCutoff( void ) { return fStreamFromRAMCutoff; }
|
||||
static void SetStreamFromRAMCutoff( hsScalar c ) { fStreamFromRAMCutoff = c; }
|
||||
static float GetStreamFromRAMCutoff( void ) { return fStreamFromRAMCutoff; }
|
||||
static void SetStreamFromRAMCutoff( float c ) { fStreamFromRAMCutoff = c; }
|
||||
|
||||
static void SetListenerPos(const hsPoint3 pos);
|
||||
static void SetListenerVelocity(const hsVector3 vel);
|
||||
@ -261,15 +261,15 @@ private:
|
||||
static hsWindowHndl fWnd;
|
||||
static hsBool fUseHardware;
|
||||
static hsBool fDelayedActivate;
|
||||
static hsScalar fChannelVolumes[ kNumChannels ];
|
||||
static hsScalar fGlobalFadeVolume;
|
||||
static float fChannelVolumes[ kNumChannels ];
|
||||
static float fGlobalFadeVolume;
|
||||
static uint32_t fDebugFlags;
|
||||
static hsBool fEnableEAX;
|
||||
static hsScalar fStreamingBufferSize;
|
||||
static float fStreamingBufferSize;
|
||||
static uint8_t fPriorityCutoff;
|
||||
static hsBool fEnableExtendedLogs;
|
||||
static hsScalar fStreamFromRAMCutoff;
|
||||
static hsScalar f2D3DBias;
|
||||
static float fStreamFromRAMCutoff;
|
||||
static float f2D3DBias;
|
||||
static hsBool fLogStreamingUpdates;
|
||||
static std::string fDeviceName;
|
||||
static hsBool fRestarting;
|
||||
|
@ -703,16 +703,16 @@ hsBool plDSoundBuffer::IsEAXAccelerated( void ) const
|
||||
|
||||
uint32_t plDSoundBuffer::bytePosToMSecs( uint32_t bytePos ) const
|
||||
{
|
||||
return (uint32_t)(bytePos * 1000 / (hsScalar)fBufferDesc->fAvgBytesPerSec);
|
||||
return (uint32_t)(bytePos * 1000 / (float)fBufferDesc->fAvgBytesPerSec);
|
||||
}
|
||||
|
||||
//// GetBufferBytePos ////////////////////////////////////////////////////////
|
||||
|
||||
uint32_t plDSoundBuffer::GetBufferBytePos( hsScalar timeInSecs ) const
|
||||
uint32_t plDSoundBuffer::GetBufferBytePos( float timeInSecs ) const
|
||||
{
|
||||
hsAssert( fBufferDesc != nil, "Nil buffer description when calling GetBufferBytePos()" );
|
||||
|
||||
uint32_t uint8_t = (uint32_t)( timeInSecs * (hsScalar)fBufferDesc->fNumSamplesPerSec );
|
||||
uint32_t uint8_t = (uint32_t)( timeInSecs * (float)fBufferDesc->fNumSamplesPerSec );
|
||||
uint8_t *= fBufferDesc->fBlockAlign;
|
||||
|
||||
return uint8_t;
|
||||
@ -742,7 +742,7 @@ uint8_t plDSoundBuffer::GetBlockAlign( void ) const
|
||||
//// SetScalarVolume /////////////////////////////////////////////////////////
|
||||
// Sets the volume, but on a range from 0 to 1
|
||||
|
||||
void plDSoundBuffer::SetScalarVolume( hsScalar volume )
|
||||
void plDSoundBuffer::SetScalarVolume( float volume )
|
||||
{
|
||||
if(source)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
void Rewind() ;
|
||||
|
||||
uint32_t GetLengthInBytes( void ) const;
|
||||
void SetScalarVolume( hsScalar volume ); // Sets the volume, but on a range from 0 to 1
|
||||
void SetScalarVolume( float volume ); // Sets the volume, but on a range from 0 to 1
|
||||
|
||||
unsigned GetSource() { return source; }
|
||||
void SetPosition(float x, float y, float z);
|
||||
@ -109,7 +109,7 @@ public:
|
||||
|
||||
|
||||
unsigned GetByteOffset();
|
||||
uint32_t GetBufferBytePos( hsScalar timeInSecs ) const;
|
||||
uint32_t GetBufferBytePos( float timeInSecs ) const;
|
||||
uint32_t bytePosToMSecs( uint32_t bytePos ) const;
|
||||
|
||||
void SetEAXSettings( plEAXSourceSettings *settings, hsBool force = false );
|
||||
@ -156,7 +156,7 @@ protected:
|
||||
static float fDefaultMinDistance;
|
||||
|
||||
unsigned fNumQueuedBuffers;
|
||||
hsScalar fPrevVolume;
|
||||
float fPrevVolume;
|
||||
|
||||
void IAllocate( uint32_t size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool tryStatic );
|
||||
void IRelease( void );
|
||||
|
@ -251,13 +251,13 @@ void plEAXListener::IFail( const char *msg, hsBool major )
|
||||
// Mutes the given properties, so if you have some props that you want
|
||||
// half strength, this function will do it for ya.
|
||||
|
||||
void plEAXListener::IMuteProperties( EAXREVERBPROPERTIES *props, hsScalar percent )
|
||||
void plEAXListener::IMuteProperties( EAXREVERBPROPERTIES *props, float percent )
|
||||
{
|
||||
// We only mute the room, roomHF and roomLF, since those control the overall effect
|
||||
// application. All three are a direct linear blend as defined by eax-util.cpp, so
|
||||
// this should be rather easy
|
||||
|
||||
hsScalar invPercent = 1.f - percent;
|
||||
float invPercent = 1.f - percent;
|
||||
|
||||
// The old way, as dictated by EAX sample code...
|
||||
#ifdef EAX_SDK_AVAILABLE
|
||||
@ -359,7 +359,7 @@ void plEAXListener::ProcessMods( hsTArray<plEAXListenerMod *> &modArray )
|
||||
}
|
||||
else
|
||||
{
|
||||
hsScalar scale = strength / ( totalStrength + strength );
|
||||
float scale = strength / ( totalStrength + strength );
|
||||
EAX3ListenerInterpolate( &finalProps, modArray[ i ]->GetListenerProps(), scale, &finalProps, false );
|
||||
totalStrength += strength;
|
||||
bMorphing = true;
|
||||
@ -557,7 +557,7 @@ void plEAXSourceSettings::SetOutsideVolHF( int16_t vol )
|
||||
fDirtyParams |= kOutsideVolHF;
|
||||
}
|
||||
|
||||
void plEAXSourceSettings::SetFactors( hsScalar airAbsorption, hsScalar roomRolloff, hsScalar doppler, hsScalar rolloff )
|
||||
void plEAXSourceSettings::SetFactors( float airAbsorption, float roomRolloff, float doppler, float rolloff )
|
||||
{
|
||||
fAirAbsorptionFactor = airAbsorption;
|
||||
fRoomRolloffFactor = roomRolloff;
|
||||
@ -566,7 +566,7 @@ void plEAXSourceSettings::SetFactors( hsScalar airAbsorption, hsScalar roomRo
|
||||
fDirtyParams |= kFactors;
|
||||
}
|
||||
|
||||
void plEAXSourceSettings::SetOcclusionSoftValue( hsScalar value )
|
||||
void plEAXSourceSettings::SetOcclusionSoftValue( float value )
|
||||
{
|
||||
if( fOcclusionSoftValue != value )
|
||||
{
|
||||
@ -578,7 +578,7 @@ void plEAXSourceSettings::SetOcclusionSoftValue( hsScalar value )
|
||||
|
||||
void plEAXSourceSettings::IRecalcSofts( uint8_t whichOnes )
|
||||
{
|
||||
hsScalar percent, invPercent;
|
||||
float percent, invPercent;
|
||||
|
||||
if( whichOnes & kOcclusion )
|
||||
{
|
||||
@ -586,9 +586,9 @@ void plEAXSourceSettings::IRecalcSofts( uint8_t whichOnes )
|
||||
invPercent = 1.f - percent;
|
||||
|
||||
int16_t occ = (int16_t)( ( (float)fSoftStarts.GetOcclusion() * invPercent ) + ( (float)fSoftEnds.GetOcclusion() * percent ) );
|
||||
hsScalar lfRatio = (hsScalar)( ( fSoftStarts.GetOcclusionLFRatio() * invPercent ) + ( fSoftEnds.GetOcclusionLFRatio() * percent ) );
|
||||
hsScalar roomRatio = (hsScalar)( ( fSoftStarts.GetOcclusionRoomRatio() * invPercent ) + ( fSoftEnds.GetOcclusionRoomRatio() * percent ) );
|
||||
hsScalar directRatio = (hsScalar)( ( fSoftStarts.GetOcclusionDirectRatio() * invPercent ) + ( fSoftEnds.GetOcclusionDirectRatio() * percent ) );
|
||||
float lfRatio = (float)( ( fSoftStarts.GetOcclusionLFRatio() * invPercent ) + ( fSoftEnds.GetOcclusionLFRatio() * percent ) );
|
||||
float roomRatio = (float)( ( fSoftStarts.GetOcclusionRoomRatio() * invPercent ) + ( fSoftEnds.GetOcclusionRoomRatio() * percent ) );
|
||||
float directRatio = (float)( ( fSoftStarts.GetOcclusionDirectRatio() * invPercent ) + ( fSoftEnds.GetOcclusionDirectRatio() * percent ) );
|
||||
|
||||
fCurrSoftValues.SetOcclusion( occ, lfRatio, roomRatio, directRatio );
|
||||
}
|
||||
@ -623,7 +623,7 @@ void plEAXSourceSoftSettings::Write( hsStream *s )
|
||||
s->WriteLE( fOcclusionDirectRatio );
|
||||
}
|
||||
|
||||
void plEAXSourceSoftSettings::SetOcclusion( int16_t occ, hsScalar lfRatio, hsScalar roomRatio, hsScalar directRatio )
|
||||
void plEAXSourceSoftSettings::SetOcclusion( int16_t occ, float lfRatio, float roomRatio, float directRatio )
|
||||
{
|
||||
fOcclusion = occ;
|
||||
fOcclusionLFRatio = lfRatio;
|
||||
|
@ -90,14 +90,14 @@ protected:
|
||||
void IFail( const char *msg, hsBool major );
|
||||
void IRelease( void );
|
||||
|
||||
void IMuteProperties( EAXREVERBPROPERTIES *props, hsScalar percent );
|
||||
void IMuteProperties( EAXREVERBPROPERTIES *props, float percent );
|
||||
|
||||
hsBool fInited;
|
||||
|
||||
// Cache info
|
||||
int32_t fLastModCount;
|
||||
hsBool fLastWasEmpty;
|
||||
hsScalar fLastSingleStrength;
|
||||
float fLastSingleStrength;
|
||||
plEAXListenerMod *fLastBigRegion;
|
||||
|
||||
};
|
||||
@ -111,16 +111,16 @@ class plEAXSourceSoftSettings
|
||||
{
|
||||
public:
|
||||
int16_t fOcclusion;
|
||||
hsScalar fOcclusionLFRatio, fOcclusionRoomRatio, fOcclusionDirectRatio;
|
||||
float fOcclusionLFRatio, fOcclusionRoomRatio, fOcclusionDirectRatio;
|
||||
|
||||
void Read( hsStream *s );
|
||||
void Write( hsStream *s );
|
||||
|
||||
void SetOcclusion( int16_t occ, hsScalar lfRatio, hsScalar roomRatio, hsScalar directRatio );
|
||||
void SetOcclusion( int16_t occ, float lfRatio, float roomRatio, float directRatio );
|
||||
int16_t GetOcclusion( void ) const { return fOcclusion; }
|
||||
hsScalar GetOcclusionLFRatio( void ) const { return fOcclusionLFRatio; }
|
||||
hsScalar GetOcclusionRoomRatio( void ) const { return fOcclusionRoomRatio; }
|
||||
hsScalar GetOcclusionDirectRatio( void ) const { return fOcclusionDirectRatio; }
|
||||
float GetOcclusionLFRatio( void ) const { return fOcclusionLFRatio; }
|
||||
float GetOcclusionRoomRatio( void ) const { return fOcclusionRoomRatio; }
|
||||
float GetOcclusionDirectRatio( void ) const { return fOcclusionDirectRatio; }
|
||||
|
||||
void Reset( void );
|
||||
};
|
||||
@ -150,19 +150,19 @@ class plEAXSourceSettings
|
||||
void SetOutsideVolHF( int16_t vol );
|
||||
int16_t GetOutsideVolHF( void ) const { return fOutsideVolHF; }
|
||||
|
||||
void SetFactors( hsScalar airAbsorption, hsScalar roomRolloff, hsScalar doppler, hsScalar rolloff );
|
||||
hsScalar GetAirAbsorptionFactor( void ) const { return fAirAbsorptionFactor; }
|
||||
hsScalar GetRoomRolloffFactor( void ) const { return fRoomRolloffFactor; }
|
||||
hsScalar GetDopplerFactor( void ) const { return fDopplerFactor; }
|
||||
hsScalar GetRolloffFactor( void ) const { return fRolloffFactor; }
|
||||
void SetFactors( float airAbsorption, float roomRolloff, float doppler, float rolloff );
|
||||
float GetAirAbsorptionFactor( void ) const { return fAirAbsorptionFactor; }
|
||||
float GetRoomRolloffFactor( void ) const { return fRoomRolloffFactor; }
|
||||
float GetDopplerFactor( void ) const { return fDopplerFactor; }
|
||||
float GetRolloffFactor( void ) const { return fRolloffFactor; }
|
||||
|
||||
plEAXSourceSoftSettings &GetSoftStarts( void ) { return fSoftStarts; }
|
||||
plEAXSourceSoftSettings &GetSoftEnds( void ) { return fSoftEnds; }
|
||||
|
||||
plEAXSourceSoftSettings &GetCurrSofts( void ) { return fCurrSoftValues; }
|
||||
|
||||
void SetOcclusionSoftValue( hsScalar value );
|
||||
hsScalar GetOcclusionSoftValue( void ) const { return fOcclusionSoftValue; }
|
||||
void SetOcclusionSoftValue( float value );
|
||||
float GetOcclusionSoftValue( void ) const { return fOcclusionSoftValue; }
|
||||
|
||||
void ClearDirtyParams( void ) const { fDirtyParams = 0; }
|
||||
|
||||
@ -174,9 +174,9 @@ class plEAXSourceSettings
|
||||
int16_t fRoom, fRoomHF;
|
||||
hsBool fRoomAuto, fRoomHFAuto;
|
||||
int16_t fOutsideVolHF;
|
||||
hsScalar fAirAbsorptionFactor, fRoomRolloffFactor, fDopplerFactor, fRolloffFactor;
|
||||
float fAirAbsorptionFactor, fRoomRolloffFactor, fDopplerFactor, fRolloffFactor;
|
||||
plEAXSourceSoftSettings fSoftStarts, fSoftEnds, fCurrSoftValues;
|
||||
hsScalar fOcclusionSoftValue;
|
||||
float fOcclusionSoftValue;
|
||||
mutable uint32_t fDirtyParams;
|
||||
|
||||
enum ParamSets
|
||||
|
@ -120,7 +120,7 @@ void plEAXListenerMod::IUnRegister( void )
|
||||
fRegistered = false;
|
||||
}
|
||||
|
||||
hsBool plEAXListenerMod::IEval( double secs, hsScalar del, uint32_t dirty )
|
||||
hsBool plEAXListenerMod::IEval( double secs, float del, uint32_t dirty )
|
||||
{
|
||||
IRegister();
|
||||
return false;
|
||||
|
@ -87,7 +87,7 @@ protected:
|
||||
|
||||
void IRegister( void );
|
||||
void IUnRegister( void );
|
||||
virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval()
|
||||
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
|
||||
};
|
||||
|
||||
#endif // _plEAXListenerMod_h
|
||||
|
@ -311,7 +311,7 @@ void plSound::SynchedPlay(unsigned bytes )
|
||||
// we're given, NOT the current time, 'cause, well, duh, that should be our
|
||||
// start time!
|
||||
// So think of it as "Play() but act as if you started at *this* time"...
|
||||
void plSound::SynchedPlay( hsScalar virtualStartTime )
|
||||
void plSound::SynchedPlay( float virtualStartTime )
|
||||
{
|
||||
if( fFading )
|
||||
IStopFade();
|
||||
@ -432,7 +432,7 @@ void plSound::SetOuterVolume(const int v)
|
||||
fOuterVol = v;
|
||||
}
|
||||
|
||||
void plSound::SetConeOrientation( hsScalar x, hsScalar y, hsScalar z )
|
||||
void plSound::SetConeOrientation( float x, float y, float z )
|
||||
{
|
||||
fConeOrientation.Set( x, y, z );
|
||||
}
|
||||
@ -561,9 +561,9 @@ void plSound::Update()
|
||||
}
|
||||
}
|
||||
|
||||
hsScalar plSound::IGetChannelVolume( void ) const
|
||||
float plSound::IGetChannelVolume( void ) const
|
||||
{
|
||||
hsScalar channelVol = plgAudioSys::GetChannelVolume( (plgAudioSys::ASChannel)fType );
|
||||
float channelVol = plgAudioSys::GetChannelVolume( (plgAudioSys::ASChannel)fType );
|
||||
|
||||
// if not using hardware acceleration then apply 2D/3D bias to non 3D sounds
|
||||
if( !plgAudioSys::Hardware() && !IsPropertySet( kPropIs3DSound ) )
|
||||
@ -575,7 +575,7 @@ hsScalar plSound::IGetChannelVolume( void ) const
|
||||
return channelVol * plgAudioSys::GetGlobalFadeVolume();
|
||||
}
|
||||
|
||||
void plSound::IStartFade( plFadeParams *params, hsScalar offsetIntoFade )
|
||||
void plSound::IStartFade( plFadeParams *params, float offsetIntoFade )
|
||||
{
|
||||
fFading = true;
|
||||
|
||||
@ -924,27 +924,27 @@ void plSound::ISetSoftOcclusionRegion( plSoftVolume *region )
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// This function calculates our new softVolume value. Used both to update the
|
||||
// said value and so the audio system can rank us in importance.
|
||||
hsScalar plSound::CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared )
|
||||
float plSound::CalcSoftVolume( hsBool enable, float distToListenerSquared )
|
||||
{
|
||||
// Do distance-based attenuation ourselves
|
||||
#if MCN_HACK_OUR_ATTEN
|
||||
if( IsPropertySet( kPropIs3DSound ) )
|
||||
{
|
||||
hsScalar minDist = (hsScalar)GetMin();
|
||||
float minDist = (float)GetMin();
|
||||
if( distToListenerSquared <= minDist * minDist )
|
||||
{
|
||||
fDistAttenuation = 1.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
hsScalar maxDist = (hsScalar)GetMax();
|
||||
float maxDist = (float)GetMax();
|
||||
if( distToListenerSquared >= maxDist * maxDist )
|
||||
{
|
||||
fDistAttenuation = 0.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
hsScalar d = (hsScalar)sqrt( distToListenerSquared );
|
||||
float d = (float)sqrt( distToListenerSquared );
|
||||
fDistAttenuation = minDist / d;
|
||||
|
||||
// The following line ramps it to 0 at the maxDistance. Kinda klunky, but good for now I guess...
|
||||
@ -959,8 +959,8 @@ hsScalar plSound::CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared
|
||||
// ramp down to 0 so we don't get annoying popping when we stop stuff
|
||||
if( IsPropertySet( kPropIs3DSound ) )
|
||||
{
|
||||
hsScalar maxDistSquared = (hsScalar)( GetMax() * GetMax() );
|
||||
hsScalar distToStartSquared = (hsScalar)(maxDistSquared * 0.50);
|
||||
float maxDistSquared = (float)( GetMax() * GetMax() );
|
||||
float distToStartSquared = (float)(maxDistSquared * 0.50);
|
||||
|
||||
if( maxDistSquared < 0.f ) // Happens when the max distance is REALLY big
|
||||
{
|
||||
@ -999,21 +999,21 @@ hsScalar plSound::CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared
|
||||
// Wee function for the audio system. This basically returns the effective
|
||||
// current volume of this sound. Useful for doing things like ranking all
|
||||
// sounds based on volume.
|
||||
hsScalar plSound::GetVolumeRank( void )
|
||||
float plSound::GetVolumeRank( void )
|
||||
{
|
||||
if( !IsPlaying() && !this->IActuallyPlaying() )
|
||||
return 0.f;
|
||||
|
||||
hsScalar rank = fSoftVolume * fDesiredVol;
|
||||
float rank = fSoftVolume * fDesiredVol;
|
||||
|
||||
if( IsPropertySet( kPropIs3DSound ) )
|
||||
{
|
||||
hsScalar minDistSquared = (hsScalar)( GetMin() * GetMin() );
|
||||
hsScalar maxDistSquared = (hsScalar) (GetMax() * GetMax());
|
||||
float minDistSquared = (float)( GetMin() * GetMin() );
|
||||
float maxDistSquared = (float) (GetMax() * GetMax());
|
||||
hsPoint3 listenerPos = plgAudioSys::Sys()->GetCurrListenerPos();
|
||||
if( fDistToListenerSquared > minDistSquared )
|
||||
{
|
||||
hsScalar diff = maxDistSquared - minDistSquared;
|
||||
float diff = maxDistSquared - minDistSquared;
|
||||
rank *= fabs((fDistToListenerSquared - maxDistSquared)) / diff;
|
||||
}
|
||||
}
|
||||
@ -1036,7 +1036,7 @@ hsBool plSound::IWillBeAbleToPlay( void )
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Tests to see whether this sound is within range of the position given,
|
||||
// ignoring soft volumes.
|
||||
hsBool plSound::IsWithinRange( const hsPoint3 &listenerPos, hsScalar *distSquared )
|
||||
hsBool plSound::IsWithinRange( const hsPoint3 &listenerPos, float *distSquared )
|
||||
{
|
||||
if( !IsPropertySet( plSound::kPropIs3DSound ) )
|
||||
{
|
||||
@ -1056,7 +1056,7 @@ hsBool plSound::IsWithinRange( const hsPoint3 &listenerPos, hsScalar *distSquare
|
||||
if( GetMax() == 1000000000 )
|
||||
return true;
|
||||
|
||||
hsScalar soundRadius = (hsScalar)( GetMax() * GetMax() );
|
||||
float soundRadius = (float)( GetMax() * GetMax() );
|
||||
|
||||
return ( distance.MagnitudeSquared() <= soundRadius ) ? true : false;
|
||||
}
|
||||
@ -1107,7 +1107,7 @@ void plSound::UpdateSoftVolume( hsBool enable, hsBool firstTime )
|
||||
|
||||
// Note: we just do it as a fade because it makes it easier on us that way!
|
||||
fCoolSoftVolumeTrickParams.fCurrTime = 0.f;
|
||||
fCoolSoftVolumeTrickParams.fLengthInSecs = firstTime ? 0.f : (hsScalar)fLength + ( (hsScalar)fLength - (hsScalar)GetTime() );
|
||||
fCoolSoftVolumeTrickParams.fLengthInSecs = firstTime ? 0.f : (float)fLength + ( (float)fLength - (float)GetTime() );
|
||||
fCoolSoftVolumeTrickParams.fStopWhenDone = true;
|
||||
fCoolSoftVolumeTrickParams.fFadeSoftVol = true;
|
||||
fCoolSoftVolumeTrickParams.fType = plFadeParams::kLinear;
|
||||
@ -1125,7 +1125,7 @@ void plSound::UpdateSoftVolume( hsBool enable, hsBool firstTime )
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Returns the current volume, attenuated
|
||||
hsScalar plSound::QueryCurrVolume( void ) const
|
||||
float plSound::QueryCurrVolume( void ) const
|
||||
{
|
||||
return IAttenuateActualVolume( fCurrVolume ) * IGetChannelVolume();
|
||||
}
|
||||
@ -1133,7 +1133,7 @@ hsScalar plSound::QueryCurrVolume( void ) const
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Used by ISetActualVolume(). Does the final attenuation on a volume before
|
||||
// sending it to the sound processing. Only does soft regions for now.
|
||||
hsScalar plSound::IAttenuateActualVolume( hsScalar volume ) const
|
||||
float plSound::IAttenuateActualVolume( float volume ) const
|
||||
{
|
||||
if( fNotHighEnoughPriority )
|
||||
return 0.f;
|
||||
@ -1367,9 +1367,9 @@ void plSound::plFadeParams::Write( hsStream *s )
|
||||
s->WriteLE( fFadeSoftVol );
|
||||
}
|
||||
|
||||
hsScalar plSound::plFadeParams::InterpValue( void )
|
||||
float plSound::plFadeParams::InterpValue( void )
|
||||
{
|
||||
hsScalar val;
|
||||
float val;
|
||||
|
||||
switch( fType )
|
||||
{
|
||||
@ -1382,7 +1382,7 @@ hsScalar plSound::plFadeParams::InterpValue( void )
|
||||
break;
|
||||
case kExponential:
|
||||
val = fCurrTime / fLengthInSecs;
|
||||
val = ( (hsScalar)sqrt( val ) * ( fVolEnd - fVolStart ) ) + fVolStart;
|
||||
val = ( (float)sqrt( val ) * ( fVolEnd - fVolStart ) ) + fVolStart;
|
||||
break;
|
||||
default:
|
||||
val = 0.f;
|
||||
@ -1390,7 +1390,7 @@ hsScalar plSound::plFadeParams::InterpValue( void )
|
||||
return val;
|
||||
}
|
||||
|
||||
void plSound::SetFadeInEffect( plSound::plFadeParams::Type type, hsScalar length )
|
||||
void plSound::SetFadeInEffect( plSound::plFadeParams::Type type, float length )
|
||||
{
|
||||
fFadeInParams.fLengthInSecs = length;
|
||||
fFadeInParams.fType = type;
|
||||
@ -1406,7 +1406,7 @@ void plSound::SetFadeInEffect( plSound::plFadeParams::Type type, hsScalar length
|
||||
fFading = false;
|
||||
}
|
||||
|
||||
void plSound::SetFadeOutEffect( plSound::plFadeParams::Type type, hsScalar length )
|
||||
void plSound::SetFadeOutEffect( plSound::plFadeParams::Type type, float length )
|
||||
{
|
||||
fFadeOutParams.fLengthInSecs = length;
|
||||
fFadeOutParams.fType = type;
|
||||
@ -1422,9 +1422,9 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h
|
||||
|
||||
if( fOuterCone < 360 )
|
||||
{
|
||||
hsScalar len = (hsScalar)GetMax();
|
||||
hsScalar halfAng = hsScalarDegToRad(hsScalar(fInnerCone) * 0.5f);
|
||||
hsScalar radius = len * tanf(halfAng);
|
||||
float len = (float)GetMax();
|
||||
float halfAng = hsDegreesToRadians(float(fInnerCone) * 0.5f);
|
||||
float radius = len * tanf(halfAng);
|
||||
if( fInnerCone < 180 )
|
||||
len = -len;
|
||||
myDraw = plDrawableGenerator::GenerateConicalDrawable(
|
||||
@ -1437,8 +1437,8 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h
|
||||
&idx,
|
||||
myDraw);
|
||||
|
||||
len = (hsScalar)GetMin();
|
||||
halfAng = hsScalarDegToRad(hsScalar(fOuterCone) * 0.5f);
|
||||
len = (float)GetMin();
|
||||
halfAng = hsDegreesToRadians(float(fOuterCone) * 0.5f);
|
||||
radius = len * tanf(halfAng);
|
||||
if( fOuterCone < 180 )
|
||||
len = -len;
|
||||
@ -1457,7 +1457,7 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h
|
||||
{
|
||||
myDraw = plDrawableGenerator::GenerateSphericalDrawable(
|
||||
hsPoint3(0,0,0),
|
||||
(hsScalar)GetMin(),
|
||||
(float)GetMin(),
|
||||
mat,
|
||||
l2w,
|
||||
true,
|
||||
@ -1467,7 +1467,7 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h
|
||||
|
||||
myDraw = plDrawableGenerator::GenerateSphericalDrawable(
|
||||
hsPoint3(0,0,0),
|
||||
(hsScalar)GetMax(),
|
||||
(float)GetMax(),
|
||||
mat,
|
||||
l2w,
|
||||
true,
|
||||
@ -1502,9 +1502,9 @@ void plSoundVolumeApplicator::IApply( const plAGModifier *mod, double time )
|
||||
plScalarChannel *chan = plScalarChannel::ConvertNoRef( fChannel );
|
||||
if(chan)
|
||||
{
|
||||
hsScalar volume = chan->Value( time );
|
||||
float volume = chan->Value( time );
|
||||
|
||||
hsScalar digitalVolume = (float)pow( 10.f, volume / 20.f );
|
||||
float digitalVolume = (float)pow( 10.f, volume / 20.f );
|
||||
|
||||
// Find the audio interface and thus the plSound from it
|
||||
plSceneObject *so = mod->GetTarget( 0 );
|
||||
|
@ -149,16 +149,16 @@ public:
|
||||
kExponential
|
||||
};
|
||||
|
||||
hsScalar fLengthInSecs; // Time to take to fade
|
||||
hsScalar fVolStart; // Set one of these two for fade in/out,
|
||||
hsScalar fVolEnd; // the other becomes the current volume
|
||||
float fLengthInSecs; // Time to take to fade
|
||||
float fVolStart; // Set one of these two for fade in/out,
|
||||
float fVolEnd; // the other becomes the current volume
|
||||
uint8_t fType;
|
||||
hsBool fStopWhenDone; // Actually stop the sound once the fade is complete
|
||||
hsBool fFadeSoftVol; // Fade the soft volume instead of fCurrVolume
|
||||
|
||||
plFadeParams() { fLengthInSecs = 0.f; fCurrTime = -1.f; fStopWhenDone = false; fFadeSoftVol = false; fVolStart = fVolEnd = 0.f; fType = kLinear; }
|
||||
|
||||
plFadeParams( Type type, hsScalar len, hsScalar start, hsScalar end )
|
||||
plFadeParams( Type type, float len, float start, float end )
|
||||
{
|
||||
fLengthInSecs = len; fVolStart = start; fVolEnd = end; fType = type;
|
||||
fStopWhenDone = false;
|
||||
@ -168,18 +168,18 @@ public:
|
||||
void Read( hsStream *s );
|
||||
void Write( hsStream *s );
|
||||
|
||||
hsScalar InterpValue( void );
|
||||
float InterpValue( void );
|
||||
|
||||
protected:
|
||||
hsScalar fCurrTime; // -1 if we aren't active, else it's how far we're into the animation
|
||||
float 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; }
|
||||
float GetVirtualStartTime( void ) const { return (float)fVirtualStartTime; }
|
||||
|
||||
virtual void Play();
|
||||
void SynchedPlay( unsigned bytes );
|
||||
void SynchedPlay( hsScalar virtualStartTime );
|
||||
void SynchedPlay( float virtualStartTime );
|
||||
virtual void Stop();
|
||||
virtual void FastForwardPlay();
|
||||
virtual void FastForwardToggle();
|
||||
@ -189,7 +189,7 @@ public:
|
||||
virtual int GetMax() const;
|
||||
virtual void SetVolume(const float volume);
|
||||
virtual float GetVolume(void) const { return fCurrVolume; }
|
||||
hsScalar GetMaxVolume() { return fMaxVolume; }
|
||||
float GetMaxVolume() { return fMaxVolume; }
|
||||
virtual hsBool IsPlaying() { return fPlaying; }
|
||||
void SetTime(double t);
|
||||
virtual double GetTime( void ) { return 0.f; }
|
||||
@ -200,7 +200,7 @@ public:
|
||||
virtual hsBool IsMuted( void ) { return fMuted; }
|
||||
void Disable() { fDistAttenuation = 0; }
|
||||
virtual plSoundMsg* GetStatus(plSoundMsg* pMsg){return NULL;}
|
||||
virtual void SetConeOrientation(hsScalar x, hsScalar y, hsScalar z);
|
||||
virtual void SetConeOrientation(float x, float y, float z);
|
||||
virtual void SetOuterVolume( const int v ); // volume for the outer cone (if applicable)
|
||||
virtual void SetConeAngles( int inner, int outer );
|
||||
virtual void SetPosition(const hsPoint3 pos);
|
||||
@ -211,7 +211,7 @@ public:
|
||||
virtual void Update();
|
||||
|
||||
plSoundBuffer * GetDataBuffer( void ) const { return (plSoundBuffer *)fDataBufferKey->ObjectIsLoaded(); }
|
||||
hsScalar QueryCurrVolume( void ) const; // Returns the current volume, attenuated
|
||||
float QueryCurrVolume( void ) const; // Returns the current volume, attenuated
|
||||
|
||||
const char * GetFileName( void ) const;
|
||||
virtual double GetLength();
|
||||
@ -233,16 +233,16 @@ public:
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
virtual void SetFadeInEffect( plFadeParams::Type type, hsScalar length );
|
||||
virtual void SetFadeOutEffect( plFadeParams::Type type, hsScalar length );
|
||||
virtual hsScalar CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared );
|
||||
virtual void SetFadeInEffect( plFadeParams::Type type, float length );
|
||||
virtual void SetFadeOutEffect( plFadeParams::Type type, float length );
|
||||
virtual float CalcSoftVolume( hsBool enable, float distToListenerSquared );
|
||||
virtual void UpdateSoftVolume( hsBool enable, hsBool firstTime = false );
|
||||
|
||||
virtual hsBool MsgReceive( plMessage* pMsg );
|
||||
virtual hsBool DirtySynchState( const char *sdlName = nil, uint32_t sendFlags = 0 ); // call when state has changed
|
||||
|
||||
// Tests whether this sound is within range of the given position, not counting soft regions
|
||||
hsBool IsWithinRange( const hsPoint3 &listenerPos, hsScalar *distSquared );
|
||||
hsBool IsWithinRange( const hsPoint3 &listenerPos, float *distSquared );
|
||||
|
||||
// Type setting and getting, from the Types enum
|
||||
void SetType( uint8_t type ) { fType = type; }
|
||||
@ -266,7 +266,7 @@ public:
|
||||
void UnregisterOnAudioSys( void );
|
||||
|
||||
// Also only for the audio system
|
||||
hsScalar GetVolumeRank( void );
|
||||
float GetVolumeRank( void );
|
||||
void ForceUnregisterFromAudioSys( void );
|
||||
|
||||
static void SetLoadOnDemand( hsBool activate ) { fLoadOnDemandFlag = activate; }
|
||||
@ -284,10 +284,10 @@ protected:
|
||||
double fTime;
|
||||
int fMaxFalloff;
|
||||
int fMinFalloff;
|
||||
hsScalar fCurrVolume;
|
||||
hsScalar fDesiredVol; // Equal to fCurrVolume except when we're fading or muted
|
||||
hsScalar fFadedVolume;
|
||||
hsScalar fMaxVolume;
|
||||
float fCurrVolume;
|
||||
float fDesiredVol; // Equal to fCurrVolume except when we're fading or muted
|
||||
float fFadedVolume;
|
||||
float fMaxVolume;
|
||||
|
||||
int fOuterVol;
|
||||
int fInnerCone;
|
||||
@ -322,8 +322,8 @@ protected:
|
||||
plFadeParams *fCurrFadeParams;
|
||||
|
||||
plSoftVolume *fSoftRegion;
|
||||
hsScalar fSoftVolume;
|
||||
hsScalar fDistAttenuation, fDistToListenerSquared;
|
||||
float fSoftVolume;
|
||||
float fDistAttenuation, fDistToListenerSquared;
|
||||
double fVirtualStartTime;
|
||||
hsBool fRegistered;
|
||||
static unsigned fIncidentalsPlaying;
|
||||
@ -356,17 +356,17 @@ protected:
|
||||
virtual hsBool IActuallyLoaded( void ) = 0;
|
||||
virtual void IRefreshEAXSettings( hsBool force = false ) = 0;
|
||||
|
||||
virtual hsScalar IGetChannelVolume( void ) const;
|
||||
virtual float IGetChannelVolume( void ) const;
|
||||
|
||||
void ISynchToStartTime( void );
|
||||
void ISynchedPlay( double virtualStartTime );
|
||||
void IStartFade( plFadeParams *params, hsScalar offsetIntoFade = 0.f );
|
||||
void IStartFade( plFadeParams *params, float offsetIntoFade = 0.f );
|
||||
void IStopFade( hsBool shuttingDown = false, hsBool SetVolEnd = true);
|
||||
|
||||
hsBool IWillBeAbleToPlay( void );
|
||||
|
||||
void ISetSoftRegion( plSoftVolume *region );
|
||||
hsScalar IAttenuateActualVolume( hsScalar volume ) const;
|
||||
float IAttenuateActualVolume( float volume ) const;
|
||||
void ISetSoftOcclusionRegion( plSoftVolume *region );
|
||||
|
||||
// Override to make sure the buffer is available before the base class is called
|
||||
|
@ -76,7 +76,7 @@ hsBool plVoiceRecorder::fCompress = true;
|
||||
hsBool plVoiceRecorder::fRecording = true;
|
||||
hsBool plVoiceRecorder::fNetVoice = false;
|
||||
short plVoiceRecorder::fSampleRate = FREQUENCY;
|
||||
hsScalar plVoiceRecorder::fRecordThreshhold = 200.0f;
|
||||
float plVoiceRecorder::fRecordThreshhold = 200.0f;
|
||||
hsBool plVoiceRecorder::fShowIcons = true;
|
||||
hsBool plVoiceRecorder::fMicAlwaysOpen = false;
|
||||
hsBool plVoicePlayer::fEnabled = true;
|
||||
|
@ -130,7 +130,7 @@ public:
|
||||
static void EnableNetVoice(hsBool b) { fNetVoice = b; }
|
||||
static void EnableCompression(hsBool b) { fCompress = b; }
|
||||
static void SetSampleRate(short s) { fSampleRate = s; }
|
||||
static void SetSquelch(hsScalar f) { fRecordThreshhold = f; }
|
||||
static void SetSquelch(float f) { fRecordThreshhold = f; }
|
||||
|
||||
static void IncreaseRecordingThreshhold();
|
||||
static void DecreaseRecordingThreshhold();
|
||||
@ -154,7 +154,7 @@ private:
|
||||
static short fSampleRate;
|
||||
plPlate* fDisabledIcon;
|
||||
plPlate* fTalkIcon;
|
||||
static hsScalar fRecordThreshhold;
|
||||
static float fRecordThreshhold;
|
||||
};
|
||||
|
||||
|
||||
|
@ -79,7 +79,7 @@ plWin32GroupedSound::~plWin32GroupedSound()
|
||||
DeActivate();
|
||||
}
|
||||
|
||||
void plWin32GroupedSound::SetPositionArray( uint16_t numSounds, uint32_t *posArray, hsScalar *volumeArray )
|
||||
void plWin32GroupedSound::SetPositionArray( uint16_t numSounds, uint32_t *posArray, float *volumeArray )
|
||||
{
|
||||
uint16_t i;
|
||||
|
||||
@ -260,12 +260,12 @@ hsBool plWin32GroupedSound::LoadSound( hsBool is3D )
|
||||
//// GetSoundLength //////////////////////////////////////////////////////////
|
||||
// Gets the length (in seconds) of the given sound index from the group.
|
||||
|
||||
hsScalar plWin32GroupedSound::GetSoundLength( int16_t soundIndex )
|
||||
float plWin32GroupedSound::GetSoundLength( int16_t soundIndex )
|
||||
{
|
||||
plSoundBuffer *buffer = (plSoundBuffer *)fDataBufferKey->ObjectIsLoaded();
|
||||
if(buffer)
|
||||
{
|
||||
return (hsScalar)IGetSoundbyteLength( soundIndex ) / buffer->GetHeader().fAvgBytesPerSec;
|
||||
return (float)IGetSoundbyteLength( soundIndex ) / buffer->GetHeader().fAvgBytesPerSec;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -70,15 +70,15 @@ public:
|
||||
|
||||
virtual hsBool LoadSound( hsBool is3D );
|
||||
virtual hsBool MsgReceive( plMessage *pMsg );
|
||||
void SetPositionArray( uint16_t numSounds, uint32_t *posArray, hsScalar *volumeArray );
|
||||
hsScalar GetSoundLength( int16_t soundIndex );
|
||||
void SetPositionArray( uint16_t numSounds, uint32_t *posArray, float *volumeArray );
|
||||
float GetSoundLength( int16_t soundIndex );
|
||||
virtual double GetLength() { return GetSoundLength( fCurrentSound ); }
|
||||
|
||||
protected:
|
||||
uint16_t fCurrentSound;
|
||||
uint32_t fCurrentSoundLength;
|
||||
hsTArray<uint32_t> fStartPositions; // In bytes
|
||||
hsTArray<hsScalar> fVolumes;
|
||||
hsTArray<float> fVolumes;
|
||||
|
||||
// Some extra handy info for us
|
||||
uint8_t fNumDestChannels, fNumDestBytesPerSample;
|
||||
|
@ -229,7 +229,7 @@ void plWin32Sound::SetConeAngles( int inner, int outer )
|
||||
}
|
||||
}
|
||||
|
||||
void plWin32Sound::SetConeOrientation( hsScalar x, hsScalar y, hsScalar z )
|
||||
void plWin32Sound::SetConeOrientation( float x, float y, float z )
|
||||
{
|
||||
plSound::SetConeOrientation(x, y, z);
|
||||
if(fDSoundBuffer)
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
|
||||
virtual void SetMin(const int m); // sets minimum falloff distance
|
||||
virtual void SetMax(const int m); // sets maximum falloff distance
|
||||
virtual void SetConeOrientation(hsScalar x, hsScalar y, hsScalar z);
|
||||
virtual void SetConeOrientation(float x, float y, float z);
|
||||
virtual void SetOuterVolume( const int v ); // volume for the outer cone (if applicable)
|
||||
virtual void SetConeAngles( int inner, int outer );
|
||||
virtual void SetPosition(const hsPoint3 pos);
|
||||
|
@ -182,7 +182,7 @@ hsBool plWin32StaticSound::LoadSound( hsBool is3D )
|
||||
plProfile_NewMem(MemSounds, fTotalBytes);
|
||||
|
||||
// get pertinent info
|
||||
hsScalar length = (hsScalar)bufferSize / (hsScalar)header.fAvgBytesPerSec;
|
||||
float length = (float)bufferSize / (float)header.fAvgBytesPerSec;
|
||||
SetLength(length);
|
||||
|
||||
if( fLoadFromDiskOnDemand && !IsPropertySet( kPropLoadOnlyOnCall ) )
|
||||
|
@ -364,7 +364,7 @@ hsBool plWin32StreamingSound::LoadSound( hsBool is3D )
|
||||
plStatusLog::AddLineS( "audioTimes.log", 0xffffffff, "Streaming %4.2f secs of %s", fDataStream->GetLengthInSecs(), GetKey()->GetUoid().GetObjectName() );
|
||||
|
||||
// Get pertinent info
|
||||
SetLength( (hsScalar)fDataStream->GetLengthInSecs() );
|
||||
SetLength( (float)fDataStream->GetLengthInSecs() );
|
||||
|
||||
// Set up our deswizzler, if necessary
|
||||
delete fDeswizzler;
|
||||
|
@ -70,9 +70,9 @@ public:
|
||||
virtual hsBool MsgReceive( plMessage *pMsg );
|
||||
|
||||
protected:
|
||||
hsScalar fTimeAtBufferStart;
|
||||
float fTimeAtBufferStart;
|
||||
plAudioFileReader *fDataStream;
|
||||
hsScalar fBufferLengthInSecs;
|
||||
float fBufferLengthInSecs;
|
||||
uint8_t fBlankBufferFillCounter;
|
||||
plSoundDeswizzler *fDeswizzler;
|
||||
char fSrcFilename[ 256 ];
|
||||
@ -86,7 +86,7 @@ protected:
|
||||
bool fPlayWhenStopped;
|
||||
unsigned fStartPos;
|
||||
|
||||
hsScalar IGetTimeAtBufferStart( void ) { return fTimeAtBufferStart; }
|
||||
float IGetTimeAtBufferStart( void ) { return fTimeAtBufferStart; }
|
||||
virtual void SetStartPos(unsigned bytes);
|
||||
|
||||
virtual void IDerivedActuallyPlay( void );
|
||||
|
@ -86,7 +86,7 @@ MIXERLINE *IGetMixerSubLineByType( MIXERCONTROL *mux, DWORD type );
|
||||
|
||||
//// The Publics /////////////////////////////////////////////////////////////
|
||||
|
||||
hsScalar plWinMicLevel::GetLevel( void )
|
||||
float plWinMicLevel::GetLevel( void )
|
||||
{
|
||||
if( !CanSetLevel() )
|
||||
return -1;
|
||||
@ -96,13 +96,13 @@ hsScalar plWinMicLevel::GetLevel( void )
|
||||
if( !IGetControlValue( rawValue ) )
|
||||
return -1;
|
||||
|
||||
return (hsScalar)( rawValue - sMinValue ) / (hsScalar)( sMaxValue - sMinValue );
|
||||
return (float)( rawValue - sMinValue ) / (float)( sMaxValue - sMinValue );
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void plWinMicLevel::SetLevel( hsScalar level )
|
||||
void plWinMicLevel::SetLevel( float level )
|
||||
{
|
||||
if( !CanSetLevel() )
|
||||
return;
|
||||
|
@ -63,10 +63,10 @@ public:
|
||||
|
||||
~plWinMicLevel();
|
||||
// Gets the microphone volume, range 0-1, -1 if error
|
||||
static hsScalar GetLevel( void );
|
||||
static float GetLevel( void );
|
||||
|
||||
// Sets the microphone volume, range 0-1
|
||||
static void SetLevel( hsScalar level );
|
||||
static void SetLevel( float level );
|
||||
|
||||
// Returns whether we can set the level
|
||||
static hsBool CanSetLevel( void );
|
||||
|
Reference in New Issue
Block a user