2013-12-02 19:31:46 -08:00
|
|
|
//========= Copyright Valve Corporation, All rights reserved. ============//
|
|
|
|
//
|
|
|
|
// Purpose:
|
|
|
|
//
|
|
|
|
//=============================================================================//
|
|
|
|
|
|
|
|
#ifndef ENVMICROPHONE_H
|
|
|
|
#define ENVMICROPHONE_H
|
|
|
|
#ifdef _WIN32
|
|
|
|
#pragma once
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class CBaseFilter;
|
|
|
|
|
|
|
|
|
|
|
|
const int SF_MICROPHONE_SOUND_COMBAT = 0x01;
|
|
|
|
const int SF_MICROPHONE_SOUND_WORLD = 0x02;
|
|
|
|
const int SF_MICROPHONE_SOUND_PLAYER = 0x04;
|
|
|
|
const int SF_MICROPHONE_SOUND_BULLET_IMPACT = 0x08;
|
|
|
|
const int SF_MICROPHONE_SWALLOW_ROUTED_SOUNDS = 0x10;
|
|
|
|
const int SF_MICROPHONE_SOUND_EXPLOSION = 0x20;
|
|
|
|
const int SF_MICROPHONE_IGNORE_NONATTENUATED = 0x40;
|
|
|
|
|
|
|
|
|
|
|
|
// Return codes from SoundPlayed
|
|
|
|
enum MicrophoneResult_t
|
|
|
|
{
|
|
|
|
MicrophoneResult_Ok = 0,
|
|
|
|
MicrophoneResult_Swallow, // The microphone swallowed the sound. Don't play it.
|
|
|
|
MicrophoneResult_Remove, // The microphone should be removed from the list of microphones.
|
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class CEnvMicrophone : public CPointEntity
|
|
|
|
{
|
|
|
|
DECLARE_CLASS( CEnvMicrophone, CPointEntity );
|
|
|
|
|
|
|
|
public:
|
|
|
|
~CEnvMicrophone();
|
|
|
|
|
|
|
|
void Spawn(void);
|
|
|
|
void Activate(void);
|
|
|
|
void OnRestore( void );
|
|
|
|
void ActivateSpeaker( void );
|
|
|
|
void Think(void);
|
|
|
|
bool CanHearSound(CSound *pSound, float &flVolume);
|
|
|
|
bool CanHearSound( int entindex, soundlevel_t soundlevel, float &flVolume, const Vector *pOrigin );
|
|
|
|
|
|
|
|
void SetSensitivity( float flSensitivity );
|
|
|
|
void SetSpeakerName( string_t iszSpeakerName );
|
|
|
|
|
|
|
|
void InputEnable( inputdata_t &inputdata );
|
|
|
|
void InputDisable( inputdata_t &inputdata );
|
|
|
|
void InputSetSpeakerName( inputdata_t &inputdata );
|
2019-08-31 19:28:20 +00:00
|
|
|
#ifdef MAPBASE
|
|
|
|
void InputSetDSPPreset( inputdata_t &inputdata );
|
Mapbase v3.1
- Fixed filter_damage_mod blocking all damage which doesn't match the secondary filter regardless of secondary filter mode
- Fixed impulse 101 and other give-related commands leaving behind weapons with occupied slots
- Fixed a crash with scripted_sound's PlaySoundOnEntity when the entity doesn't exist
- Added OnSoundFinished output to ambient_generic
- Added the ability to use custom models/nuggets with item_grubnugget
- Fixed a crash with citizen medics healing nonexistent targets
- Added "SetDistLook" and "SetDistTooFar" inputs for NPCs, allowing manual adjustment of NPC sight distance
- Added keyvalue and input to env_microphone for utilizing a different audio channel
- Added "SetPitchScale" input to env_microphone
- Fixed info_player_view_proxy not using angles
- Fixed dirt variant elite model not being recognized as elite
- Made headcrab hints properly register the start of use (for hint outputs)
- Made RPG use a more realistic firing rate for NPCs which aren't constrained by slow RPG animations, like soldiers
- Added spawnflag for func_breakable_surf to correctly play the break sound
- Added keyvalue for using cheaper warn sound code for combine_mines
- Added "OnSpawnNPC" output for npc_combinedropship when it spawns a soldier, rollermine, or strider
- Added signal gesture activities
- Fixed stunstick not using metrocop knockout/stun code correctly
- Fixed a possible crash involving a NPC's weapon being removed during alt-fire
- Fixed(?) flashlight shadow filters
- Added support for multiple look entities in trigger_look
- Added npc_metropolice alt-firing
- Fixed npc_metropolice using pistol burst firing on weapon_357
- Fixed npc_metropolice not deploying manhacks/throwing grenades in standoffs
- Fixed npc_metropolice not recognizing some crouch activities correctly
- Changed weapon_357 so it runs a tracer each shot from NPCs
- Added SDK_ShatteredGlass, a Mapbase version of ShatteredGlass
- Added "SetSpeedModifier" to NPCs, based on 1upD's shadow walker code
- Made game_convar_mod much more reliable
- Fixed non-mirrored npc_turret_lab refusing to die
- Made npc_turret_lab use SMG1 ammo instead of AR2 ammo
- Fixed block LOS brushes sometimes not working with players (and possibly similar issues)
- Raised maximum renderable entities from 4096 to 16384, based on ficool2's limit research
- Added SDK_ShatteredGlass, a Mapbase version of ShatteredGlass. Can display parallax corrected cubemaps from its unbroken form
- Fixed VBSP breaking func_breakable_surf, etc. when using parallax corrected cubemaps
- Raised maximum VBSP entities from 8192 to 65536, based on ficool2's limit research
- Raised maximum VBSP worldlights from 8192 to 65536, based on ficool2's limit research
- Raised maximum VBSP overlays from 512 to 8192, based on ficool2's limit research
- Other misc. fixes
2020-05-02 02:06:02 +00:00
|
|
|
void InputSetPitchScale( inputdata_t &inputdata );
|
|
|
|
void InputSetChannel( inputdata_t &inputdata );
|
2019-08-31 19:28:20 +00:00
|
|
|
#endif
|
2013-12-02 19:31:46 -08:00
|
|
|
|
|
|
|
DECLARE_DATADESC();
|
|
|
|
|
|
|
|
// Hook for the sound system to tell us when a sound's been played. Returns true if it's to swallow the passed in sound.
|
|
|
|
static bool OnSoundPlayed( int entindex, const char *soundname, soundlevel_t soundlevel,
|
|
|
|
float flVolume, int iFlags, int iPitch, const Vector *pOrigin, float soundtime, CUtlVector< Vector >& soundorigins );
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
// Per-microphone notification that a sound has played.
|
|
|
|
MicrophoneResult_t SoundPlayed( int entindex, const char *soundname, soundlevel_t soundlevel,
|
|
|
|
float flVolume, int iFlags, int iPitch, const Vector *pOrigin, float soundtime, CUtlVector< Vector >& soundorigins );
|
|
|
|
|
|
|
|
bool m_bDisabled; // If true, the microphone will not measure sound.
|
|
|
|
EHANDLE m_hMeasureTarget; // Point at which to measure sound level.
|
|
|
|
int m_nSoundMask; // Which sound types we are interested in.
|
|
|
|
float m_flSensitivity; // 0 = deaf, 1 = default, 10 = maximum sensitivity
|
|
|
|
float m_flSmoothFactor; // 0 = no smoothing of samples, 0.9 = maximum smoothing
|
|
|
|
float m_flMaxRange; // Maximum sound hearing range, irrelevant of attenuation
|
|
|
|
string_t m_iszSpeakerName; // Name of a speaker to output any heard sounds through
|
|
|
|
EHANDLE m_hSpeaker; // Speaker to output any heard sounds through
|
|
|
|
bool m_bAvoidFeedback;
|
|
|
|
int m_iSpeakerDSPPreset; // Speaker DSP preset to use when this microphone is enabled
|
|
|
|
string_t m_iszListenFilter;
|
|
|
|
CHandle<CBaseFilter> m_hListenFilter;
|
2019-08-31 19:28:20 +00:00
|
|
|
#ifdef MAPBASE
|
|
|
|
string_t m_iszLandmarkName;
|
|
|
|
EHANDLE m_hLandmark;
|
Mapbase v3.0
- Overhauled matcher system and added expanded wildcard support, meaning "text", "te?t", "blah_test", etc. are now supported instead of only trailing *
- Added support for regular expression matching
- Added the missing matrixinvert.h file, which prevented programmers from compiling vbsp
- Fixed env_global_light brightness
- Added info_player_view_proxy, an entity which mimics a player's view (created for script_intro)
- New UnZoomWithRate and SetZoomRate inputs on env_zoom
- New "Don't change target's angles" flag on logic_measure_movement
- Fixed logic_measure_movement not using ignore origin flags correctly
- Fixed filter_damage_mod secondary filter not recognizing mode correctly
- Fixed DisableGeigerCounter causing NPCs to ignore player, and possibly fixed other adverse effects in similar code
- Added SetEntityName input for setting an entity's targetname
- Added "SetTarget" support to point_posecontroller
- Added "sk_alyx_health" convar for adjustable npc_alyx health, restored/fixed "sk_barney_health" for adjustable npc_barney health
- Added ignore flags and several direction-related inputs to math_vector
- Added pose parameter stuff to logic_modelinfo
- Fixed ChangeWeapon not changing during combat
- Fixed holster/unholster on NPCs without holster/unholster animations
- Fixed func_tank and other "player in the way" code ignoring notarget
- Added SetPoseParameter input to animating entities
- Introduced an experimental chapter system which allows for custom chapter title/restriction management
- Added SetChapterTitle input to worldspawn for dynamic title changing
- Fixed func_tankairboatgun damage credit, added ability to use its damage keyvalues
- Fixed mapbase_rpc_enabled not actually affecting RPC
- Moved some newly found Combine soldier grenade code to ai_grenade for other grenade users
- Fixed some problems with the new shared activities
- Restored an old Mapbase entity as "prop_interactable", an entity which contains all of the functionality of a func_button/func_door in a prop entity
- Added env_microphone pitch scale for scaling the pitch of transmitted sounds
- Added experimental, long-overdue code for scenes to be able to access !target#'s and other scene-related names through AI_INPUT
- Added "mat_specular_disable_on_missing", which "disables" specular reflections when the cubemap texture is missing
- Fixed $envmapmasktransform and $bumptransform on VertexLitGeneric and related shaders
- Areaportal leaks now stop compilation in leaktest
- Replaced "-nodefaultcubemap" with "-defaultcubemap" as the shader changes allow maps to compile without default cubemaps by default with little effect
2020-02-05 19:08:49 +00:00
|
|
|
float m_flPitchScale = 1.0f;
|
Mapbase v3.1
- Fixed filter_damage_mod blocking all damage which doesn't match the secondary filter regardless of secondary filter mode
- Fixed impulse 101 and other give-related commands leaving behind weapons with occupied slots
- Fixed a crash with scripted_sound's PlaySoundOnEntity when the entity doesn't exist
- Added OnSoundFinished output to ambient_generic
- Added the ability to use custom models/nuggets with item_grubnugget
- Fixed a crash with citizen medics healing nonexistent targets
- Added "SetDistLook" and "SetDistTooFar" inputs for NPCs, allowing manual adjustment of NPC sight distance
- Added keyvalue and input to env_microphone for utilizing a different audio channel
- Added "SetPitchScale" input to env_microphone
- Fixed info_player_view_proxy not using angles
- Fixed dirt variant elite model not being recognized as elite
- Made headcrab hints properly register the start of use (for hint outputs)
- Made RPG use a more realistic firing rate for NPCs which aren't constrained by slow RPG animations, like soldiers
- Added spawnflag for func_breakable_surf to correctly play the break sound
- Added keyvalue for using cheaper warn sound code for combine_mines
- Added "OnSpawnNPC" output for npc_combinedropship when it spawns a soldier, rollermine, or strider
- Added signal gesture activities
- Fixed stunstick not using metrocop knockout/stun code correctly
- Fixed a possible crash involving a NPC's weapon being removed during alt-fire
- Fixed(?) flashlight shadow filters
- Added support for multiple look entities in trigger_look
- Added npc_metropolice alt-firing
- Fixed npc_metropolice using pistol burst firing on weapon_357
- Fixed npc_metropolice not deploying manhacks/throwing grenades in standoffs
- Fixed npc_metropolice not recognizing some crouch activities correctly
- Changed weapon_357 so it runs a tracer each shot from NPCs
- Added SDK_ShatteredGlass, a Mapbase version of ShatteredGlass
- Added "SetSpeedModifier" to NPCs, based on 1upD's shadow walker code
- Made game_convar_mod much more reliable
- Fixed non-mirrored npc_turret_lab refusing to die
- Made npc_turret_lab use SMG1 ammo instead of AR2 ammo
- Fixed block LOS brushes sometimes not working with players (and possibly similar issues)
- Raised maximum renderable entities from 4096 to 16384, based on ficool2's limit research
- Added SDK_ShatteredGlass, a Mapbase version of ShatteredGlass. Can display parallax corrected cubemaps from its unbroken form
- Fixed VBSP breaking func_breakable_surf, etc. when using parallax corrected cubemaps
- Raised maximum VBSP entities from 8192 to 65536, based on ficool2's limit research
- Raised maximum VBSP worldlights from 8192 to 65536, based on ficool2's limit research
- Raised maximum VBSP overlays from 512 to 8192, based on ficool2's limit research
- Other misc. fixes
2020-05-02 02:06:02 +00:00
|
|
|
int m_nChannel = CHAN_STATIC;
|
2019-08-31 19:28:20 +00:00
|
|
|
#endif
|
2013-12-02 19:31:46 -08:00
|
|
|
|
|
|
|
COutputFloat m_SoundLevel; // Fired when the sampled volume level changes.
|
|
|
|
COutputEvent m_OnRoutedSound; // Fired when a sound has been played through our speaker
|
|
|
|
COutputEvent m_OnHeardSound; // Heard sound.
|
|
|
|
|
|
|
|
char m_szLastSound[256];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ENVMICROPHONE_H
|