This article's documentation is for Source 2. Click here for more information.

env_microphone

From Valve Developer Community
Revision as of 20:12, 24 June 2024 by FrozenH2O (talk | contribs) (Create source 2 env_microphone page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Env microphone.png
C++ Class hierarchy
CEnvMicrophone
CPointEntity
CBaseEntity
C++ envmicrophone.cpp

env_microphone is a point entity available in all Source 2 Source 2 games.

Warning.pngWarning:
  • The {{{engine}}} parameter is inconsistent with the name defined by the {{source2}} template. This can most likely be fixed by setting the value of the {{{engine}}} parameter to Source 2.
    If a parameter is consistent but you're still seeing this warning, it may be an issue with the template itself. Please discuss it on the template's talk page.

It acts as a microphone. In "Speaker mode", it picks up sound and rebroadcasts it at a Speaker target. It ignores the Hears X spawnflags and does not fire the SoundLevel output. In "Measuring mode", it measures the sound level at a Measure target and outputs the sound level as a value between 0 and 1. It only hears sounds that match the Hears X spawnflags.

Flags

Swallows sounds routed through speakers : [16]
Hears explosions : [32]
Ignores non-attenuated sounds : [64]

Keyvalues

Measure Target (target) <targetname>
If the speaker is in Measuring mode, this is the name of the entity where the sound level is to be measured.
Speaker target (SpeakerName) <targetname>
The name of an info_target entity through which to play any sounds heard by this microphone. If specified, the microphone will consider itself in Speaker mode.
Listen Filter (ListenFilter) <filter>
The name of an filter entity which specifies the only entities the microphone can hear. Sounds emitted by other entities will not be heard.
Speaker DSP Preset (speaker_dsp_preset) <choices>
Only useful in Speaker mode. If specified, when the microphone is enabled, it'll set the global dsp_speaker preset to this value. Sounds played back through speakers will then be affected by the selected DSP.
Value Description
0 Use Default
50 1 NO EFFECT
51 2 (DUPLICATE OF 1)
52 3 (DUPLICATE OF 1)
53 4 (DUPLICATE OF 1)
54 5 (DUPLICATE OF 1)
55 6 SPEAKER, LOUDER
56 7 SPEAKER VERY SMALL
57 8 LOUDSPEAKER, ECHO
58 9 SPEAKER SMALL
59 10 SPEAKER TINY
Listen For Sound Type (SoundType) <choices>
Value Description
1 Combat
2 Player
3 Danger
4 Bullet Impacts


Sensitivity (0-10) (Sensitivity) <float>
Microphone sensitivity, 0=deaf, 1=default, 10=extremely sensitive). Only applicable in Measuring mode.
Smoothing (0-1) (SmoothFactor) <float>
Smoothing factor, 0=no smoothing, 1=maximum smoothing). Only applicable in Measuring mode.
Maximum hearing range (0=infinite) (MaxRange) <float>
Sounds beyond this range won't be heard, irrelevant of attenuation.
Warning.pngWarning:setting this to zero (or a value > 1024) when the microphone is in Speaker mode can be very bad for performance!!
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Inputs

SetSpeakerName <targetnameRedirectInput/string>
Set the microphone to output through a different speaker entity.

EnableDisable:

Enable / Disable
Enable/disable this entity from performing its task. It might also disappear from view.

Base:

RunScriptFile
Load and execute a script file.
RunScriptCode
Execute a fragment of script code.
CallScriptFunction
Call a script function.
CallPrivateScriptFunction
Calls a script function from this entity's private script scope.
CallGlobalScriptFunction
Calls a script function in the global script scope.
Kill
Removes this entity from the world.
KillHierarchy
Removes this entity and all its children from the world.
AddOutput
Adds an entity I/O connection to this entity. Parameter format: OutputName→TargetName→InputName→Parameter→Delay→MaxRefires
FireUser1 to FireUser4
Fires the respectiveOnUseroutputs; see User Inputs and Outputs.

Outputs

SoundLevel <floatRedirectInput/float>
Fired in Measuring mode whenever the sound level changes.
OnRoutedSound
Fired whenever a sound is routed out through the specified speaker (if any).
OnHeardSound
Fired whenever this microphone hears any sound it cares about.