Added volume scale to env_microphone

This commit is contained in:
Blixibon 2021-03-14 13:49:10 -05:00
parent 4884d02481
commit a1332a442d
2 changed files with 16 additions and 1 deletions

View File

@ -48,6 +48,7 @@ BEGIN_DATADESC( CEnvMicrophone )
DEFINE_KEYFIELD(m_iszLandmarkName, FIELD_STRING, "landmark"),
DEFINE_FIELD(m_hLandmark, FIELD_EHANDLE),
DEFINE_KEYFIELD(m_flPitchScale, FIELD_FLOAT, "PitchScale"),
DEFINE_KEYFIELD(m_flVolumeScale, FIELD_FLOAT, "VolumeScale"),
DEFINE_KEYFIELD(m_nChannel, FIELD_INTEGER, "channel"),
#endif
// DEFINE_FIELD(m_bAvoidFeedback, FIELD_BOOLEAN), // DONT SAVE
@ -61,6 +62,7 @@ BEGIN_DATADESC( CEnvMicrophone )
#ifdef MAPBASE
DEFINE_INPUTFUNC(FIELD_INTEGER, "SetDSPPreset", InputSetDSPPreset),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetPitchScale", InputSetPitchScale ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetVolumeScale", InputSetVolumeScale ),
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetChannel", InputSetChannel ),
#endif
@ -272,6 +274,15 @@ void CEnvMicrophone::InputSetPitchScale( inputdata_t &inputdata )
m_flPitchScale = inputdata.value.Float();
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : &inputdata -
//-----------------------------------------------------------------------------
void CEnvMicrophone::InputSetVolumeScale( inputdata_t &inputdata )
{
m_flVolumeScale = inputdata.value.Float();
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : &inputdata -
@ -545,11 +556,13 @@ MicrophoneResult_t CEnvMicrophone::SoundPlayed( int entindex, const char *soundn
EmitSound_t ep;
#ifdef MAPBASE
ep.m_nChannel = m_nChannel;
if (m_flVolumeScale != 1.0f)
ep.m_flVolume = (flVolume * m_flVolumeScale);
#else
ep.m_nChannel = CHAN_STATIC;
ep.m_flVolume = flVolume;
#endif
ep.m_pSoundName = soundname;
ep.m_flVolume = flVolume;
ep.m_SoundLevel = soundlevel;
ep.m_nFlags = iFlags;
#ifdef MAPBASE

View File

@ -57,6 +57,7 @@ public:
#ifdef MAPBASE
void InputSetDSPPreset( inputdata_t &inputdata );
void InputSetPitchScale( inputdata_t &inputdata );
void InputSetVolumeScale( inputdata_t &inputdata );
void InputSetChannel( inputdata_t &inputdata );
#endif
@ -88,6 +89,7 @@ private:
string_t m_iszLandmarkName;
EHANDLE m_hLandmark;
float m_flPitchScale = 1.0f;
float m_flVolumeScale = 1.0f;
int m_nChannel = CHAN_STATIC;
#endif