Added sound pitch scaling and env_microphone detection for sentences

This commit is contained in:
Blixibon
2021-04-27 10:59:39 -05:00
parent 54c43dd6ce
commit 3cd50a6ed4
5 changed files with 159 additions and 25 deletions

View File

@@ -1417,6 +1417,45 @@ int SENTENCEG_Lookup(const char *sample)
}
#endif
#if defined(MAPBASE) && defined(GAME_DLL)
//-----------------------------------------------------------------------------
// Purpose: Wrapper to emit a sentence and also a close caption token for the sentence as appropriate.
// Input : filter -
// iEntIndex -
// iChannel -
// iSentenceIndex -
// flVolume -
// iSoundlevel -
// iFlags -
// iPitch -
// bUpdatePositions -
// soundtime -
//-----------------------------------------------------------------------------
void CBaseEntity::EmitSentenceByIndex( IRecipientFilter& filter, int iEntIndex, int iChannel, int iSentenceIndex,
float flVolume, soundlevel_t iSoundlevel, int iFlags /*= 0*/, int iPitch /*=PITCH_NORM*/,
const Vector *pOrigin /*=NULL*/, const Vector *pDirection /*=NULL*/,
bool bUpdatePositions /*=true*/, float soundtime /*=0.0f*/, int iSpecialDSP /*= 0*/, int iSpeakerIndex /*= 0*/ )
{
CUtlVector< Vector > soundOrigins;
bool bSwallowed = CEnvMicrophone::OnSentencePlayed(
iEntIndex,
iSentenceIndex,
iSoundlevel,
flVolume,
iFlags,
iPitch,
pOrigin,
soundtime,
soundOrigins );
if ( bSwallowed )
return;
enginesound->EmitSentenceByIndex( filter, iEntIndex, iChannel, iSentenceIndex,
flVolume, iSoundlevel, iFlags, iPitch * GetSoundPitchScale(), iSpecialDSP, pOrigin, pDirection, &soundOrigins, bUpdatePositions, soundtime, iSpeakerIndex );
}
#endif
void UTIL_EmitAmbientSound( int entindex, const Vector &vecOrigin, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float soundtime /*= 0.0f*/, float *duration /*=NULL*/ )
{
#ifdef STAGING_ONLY