Skip to content

Commit 9fc58a1

Browse files
committed
Add setSoundEffectParameter and getSoundEffectParameters functions
1 parent 58058f2 commit 9fc58a1

File tree

10 files changed

+1072
-1
lines changed

10 files changed

+1072
-1
lines changed

Client/mods/deathmatch/logic/CBassAudio.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,16 @@ void CBassAudio::ApplyFxEffects()
828828
}
829829
}
830830

831+
BOOL CBassAudio::SetFxParameters(uint iFxEffect, void* params)
832+
{
833+
return BASS_FXSetParameters(m_FxEffects[iFxEffect], params);
834+
}
835+
836+
BOOL CBassAudio::GetFxParameters(uint iFxEffect, void* params)
837+
{
838+
return BASS_FXGetParameters(m_FxEffects[iFxEffect], params);
839+
}
840+
831841
//
832842
// Must be call every frame
833843
//

Client/mods/deathmatch/logic/CBassAudio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class CBassAudio
7676
bool GetPanEnabled() { return m_bPan; };
7777
void SetPanEnabled(bool bPan) { m_bPan = bPan; };
7878
void SetFxEffects(int* pEnabledEffects, uint iNumElements);
79+
BOOL SetFxParameters(uint iFxEffect, void* params);
80+
BOOL GetFxParameters(uint iFxEffect, void* params);
7981
SString GetMetaTags(const SString& strFormat);
8082
uint GetReachedEndCount();
8183
bool IsFreed();

Client/mods/deathmatch/logic/CClientPlayerVoice.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,30 @@ bool CClientPlayerVoice::IsFxEffectEnabled(uint uiFxEffect)
398398
return m_EnabledEffects[uiFxEffect] ? true : false;
399399
}
400400

401+
bool CClientPlayerVoice::SetFxEffectParameters(uint uiFxEffect, void* params)
402+
{
403+
if (uiFxEffect >= NUMELMS(m_EnabledEffects))
404+
return false;
405+
406+
if (m_pBassPlaybackStream)
407+
if (BASS_FXSetParameters(m_FxEffects[uiFxEffect], params))
408+
return true;
409+
410+
return false;
411+
}
412+
413+
bool CClientPlayerVoice::GetFxEffectParameters(uint uiFxEffect, void* params)
414+
{
415+
if (uiFxEffect >= NUMELMS(m_EnabledEffects))
416+
return false;
417+
418+
if (m_pBassPlaybackStream)
419+
if (BASS_FXGetParameters(m_FxEffects[uiFxEffect], params))
420+
return true;
421+
422+
return false;
423+
}
424+
401425
bool CClientPlayerVoice::GetPan(float& fPan)
402426
{
403427
fPan = 0.0f;

Client/mods/deathmatch/logic/CClientPlayerVoice.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ class CClientPlayerVoice
7272

7373
bool SetFxEffect(uint uiFxEffect, bool bEnable);
7474
bool IsFxEffectEnabled(uint uiFxEffect);
75+
76+
bool SetFxEffectParameters(uint uiFxEffect, void* params);
77+
bool GetFxEffectParameters(uint uiFxEffect, void* params);
78+
7579
bool IsActive() { return m_bVoiceActive; }
7680

7781
private:

Client/mods/deathmatch/logic/CClientSound.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,30 @@ bool CClientSound::IsFxEffectEnabled(uint uiFxEffect)
616616
return m_EnabledEffects[uiFxEffect] ? true : false;
617617
}
618618

619+
bool CClientSound::SetFxEffectParameters(uint uiFxEffect, void* params)
620+
{
621+
if (uiFxEffect >= NUMELMS(m_EnabledEffects))
622+
return false;
623+
624+
if (m_pAudio)
625+
if (m_pAudio->SetFxParameters(uiFxEffect, params))
626+
return true;
627+
628+
return false;
629+
}
630+
631+
bool CClientSound::GetFxEffectParameters(uint uiFxEffect, void* params)
632+
{
633+
if (uiFxEffect >= NUMELMS(m_EnabledEffects))
634+
return false;
635+
636+
if (m_pAudio)
637+
if (m_pAudio->GetFxParameters(uiFxEffect, params))
638+
return true;
639+
640+
return false;
641+
}
642+
619643
////////////////////////////////////////////////////////////
620644
//
621645
// CClientSound::Process3D

Client/mods/deathmatch/logic/CClientSound.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ class CClientSound : public CClientEntity
7979

8080
bool SetFxEffect(uint uiFxEffect, bool bEnable);
8181
bool IsFxEffectEnabled(uint uiFxEffect);
82+
83+
bool SetFxEffectParameters(uint uiFxEffect, void* params);
84+
bool GetFxEffectParameters(uint uiFxEffect, void* params);
8285

8386
void Unlink(){};
8487

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8033,6 +8033,58 @@ bool CStaticFunctionDefinitions::SetSoundEffectEnabled(CClientPlayer& Player, co
80338033
return false;
80348034
}
80358035

8036+
bool CStaticFunctionDefinitions::SetSoundEffectParameters(CClientSound& Sound, const SString& strEffectName, void* params)
8037+
{
8038+
int iFxEffect = m_pSoundManager->GetFxEffectFromName(strEffectName);
8039+
8040+
if (iFxEffect >= 0)
8041+
if (Sound.IsFxEffectEnabled(iFxEffect))
8042+
if (Sound.SetFxEffectParameters(iFxEffect, params))
8043+
return true;
8044+
8045+
return false;
8046+
}
8047+
8048+
bool CStaticFunctionDefinitions::SetSoundEffectParameters(CClientPlayer& Player, const SString& strEffectName, void* params)
8049+
{
8050+
CClientPlayerVoice* pVoice = Player.GetVoice();
8051+
if (pVoice)
8052+
{
8053+
int iFxEffect = m_pSoundManager->GetFxEffectFromName(strEffectName);
8054+
8055+
if (iFxEffect >= 0 && pVoice->IsFxEffectEnabled(iFxEffect))
8056+
if (pVoice->SetFxEffectParameters(iFxEffect, params))
8057+
return true;
8058+
}
8059+
return false;
8060+
}
8061+
8062+
bool CStaticFunctionDefinitions::GetSoundEffectParameters(CClientSound& Sound, const SString& strEffectName, void* params)
8063+
{
8064+
int iFxEffect = m_pSoundManager->GetFxEffectFromName(strEffectName);
8065+
8066+
if (iFxEffect >= 0)
8067+
if (Sound.IsFxEffectEnabled(iFxEffect))
8068+
if (Sound.GetFxEffectParameters(iFxEffect, params))
8069+
return true;
8070+
8071+
return false;
8072+
}
8073+
8074+
bool CStaticFunctionDefinitions::GetSoundEffectParameters(CClientPlayer& Player, const SString& strEffectName, void* params)
8075+
{
8076+
CClientPlayerVoice* pVoice = Player.GetVoice();
8077+
if (pVoice)
8078+
{
8079+
int iFxEffect = m_pSoundManager->GetFxEffectFromName(strEffectName);
8080+
8081+
if (iFxEffect >= 0 && pVoice->IsFxEffectEnabled(iFxEffect))
8082+
if (pVoice->GetFxEffectParameters(iFxEffect, params))
8083+
return true;
8084+
}
8085+
return false;
8086+
}
8087+
80368088
bool CStaticFunctionDefinitions::SetSoundPan(CClientPlayer& Player, float fPan)
80378089
{
80388090
CClientPlayerVoice* pVoice = Player.GetVoice();

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,8 @@ class CStaticFunctionDefinitions
744744
static bool GetSoundMaxDistance(CClientSound& Sound, float& fDistance);
745745
static bool GetSoundMetaTags(CClientSound& Sound, const SString& strFormat, SString& strMetaTags);
746746
static bool SetSoundEffectEnabled(CClientSound& Sound, const SString& strEffectName, bool bEnable);
747+
static bool SetSoundEffectParameters(CClientSound& Sound, const SString& strEffectName, void* params);
748+
static bool GetSoundEffectParameters(CClientSound& Sound, const SString& strEffectName, void* params);
747749
static bool SetSoundPan(CClientSound& Sound, float fPan);
748750
static bool GetSoundPan(CClientSound& Sound, float& fPan);
749751

@@ -762,6 +764,8 @@ class CStaticFunctionDefinitions
762764
static bool GetSoundLevelData(CClientPlayer& Player, DWORD& dwLeft, DWORD& dwRight);
763765
static bool GetSoundSpeed(CClientPlayer& Player, float& fSpeed);
764766
static bool SetSoundEffectEnabled(CClientPlayer& Player, const SString& strEffectName, bool bEnable);
767+
static bool SetSoundEffectParameters(CClientPlayer& Sound, const SString& strEffectName, void* params);
768+
static bool GetSoundEffectParameters(CClientPlayer& Sound, const SString& strEffectName, void* params);
765769
static bool SetSoundPan(CClientPlayer& Player, float fPan);
766770
static bool GetSoundPan(CClientPlayer& Player, float& fPan);
767771

0 commit comments

Comments
 (0)