Env microphone: Difference between revisions
Jump to navigation
Jump to search
Bug:If the speaker entity is moving, sounds will start playing at the correct position, but they will not follow the speaker as they continue playing. [todo tested in ?]
Note: If multiple info_target with the same name are referenced only one will output sounds.
Note:This keyvalue can also use the settings seen on the DSP page.
Warning:setting this to 0, or greater 1024 when the microphone is in Speaker mode can be very bad for performance!
mNo edit summary |
(-added class hierarchy, cleanup, internal names, fl template) |
||
Line 1: | Line 1: | ||
{{lang|title=env_microphone}} | {{lang|title=env_microphone}} | ||
[[File:env_microphone.png|left]] {{entity|env_microphone|type=e0}} 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. | [[File:env_microphone.png|left]] | ||
{{CD|CEnvMicrophone|file1=envmicrophone.cpp}} | |||
{{entity|env_microphone|type=e0}} 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. | |||
{{clr}} | {{clr}} | ||
==Flags== | ==Flags== | ||
{{fl|1|Hears combat sounds}} | |||
{{fl|2|Hears world sounds}} | |||
{{fl|4|Hears player sounds}} | |||
{{fl|8|Hears bullet impacts}} | |||
{{fl|16|Swallows sounds routed through speakers}} | |||
:{{note|In speaker mode, sounds heard by the microphone will not play from their source, instead only being heard through this microphone's speaker.}} | :{{note|In speaker mode, sounds heard by the microphone will not play from their source, instead only being heard through this microphone's speaker.}} | ||
{{fl|32|Hears explosions}} | |||
{{fl|64|Ignores non-attenuated sounds}} | |||
==Keyvalues== | ==Keyvalues== | ||
{{KV|Speaker target | {{KV Targetname}} | ||
{{KV|Speaker target|intn=SpeakerName|targetname|The name of an {{ent|info_target}} at which to play any sounds heard by this microphone. If specified, the microphone will consider itself in Speaker mode. This should not be an {{ent|env_speaker}}.}} | |||
{{bug|If the speaker entity is moving, sounds will start playing at the correct position, but they will not follow the speaker as they continue playing.}} | {{bug|If the speaker entity is moving, sounds will start playing at the correct position, but they will not follow the speaker as they continue playing.}} | ||
{{note| If multiple {{ent|info_target}} with the same name are referenced only one will output sounds.}} | {{note| If multiple {{ent|info_target}} with the same name are referenced only one will output sounds.}} | ||
{{KV|Measure target | {{KV|Measure target|intn=target|targetname|If the speaker is in Measuring mode, this is the name of the entity where the sound level is to be measured.}} | ||
{{KV|Listen Filter | {{KV|Listen Filter|intn=ListenFilter|filter|The name of a filter entity which specifies the only entities the microphone can hear. Sounds emitted by other entities will not be heard.}} | ||
{{KV|Speaker DSP Preset | {{KV|Speaker DSP Preset|intn=speaker_dsp_preset|choices|Only useful in Speaker mode. If specified, sounds played back through speakers will be affected by the selected [[DSP]]. | ||
{{bug|Having multiple <code>env_microphone</code>s with different DSP presets active at the same time will cause only one of the DSP presets to work, even if the microphones are nowhere near each other. This is because this entity just sets a [[ConVar]] called <code>dsp_speaker</code>.}} | {{bug|Having multiple <code>env_microphone</code>s with different DSP presets active at the same time will cause only one of the DSP presets to work, even if the microphones are nowhere near each other. This is because this entity just sets a [[ConVar]] called <code>dsp_speaker</code>.}} | ||
Line 35: | Line 38: | ||
:*59: Tiny speaker | :*59: Tiny speaker | ||
{{note|This keyvalue can also use the settings seen on the [[DSP]] page.}}}} | {{note|This keyvalue can also use the settings seen on the [[DSP]] page.}}}} | ||
{{KV|Sensitivity (0-10) | {{KV|Sensitivity (0-10)|intn=Sensitivity|float|Sensitivity in measuring mode. 1 is normal, and anything between there and 10 is increasingly sensitive.}} | ||
{{KV|Smoothing (0-1) | {{KV|Smoothing (0-1)|intn=SmoothFactor|float|How much to smooth the output value of measuring mode.}} | ||
{{KV|Maximum hearing range (0{{=}}infinite) | {{KV|Maximum hearing range (0{{=}}infinite)|intn=MaxRange|float|Sounds beyond this range won't be heard. | ||
{{warning|setting this to 0, or greater 1024 when the microphone is in Speaker mode can be very bad for performance!}}}} | {{warning|setting this to 0, or greater 1024 when the microphone is in Speaker mode can be very bad for performance!}}}} | ||
{{KV|Sound Mask | {{KV|Sound Mask|intn=SoundMask|int|nofgd=1|{{todo|Some kind of alternative to the Hears X spawnflags?}}}} | ||
{{KV EnableDisable}} | {{KV EnableDisable}} | ||
==Inputs== | ==Inputs== | ||
{{IO|SetSpeakerName|param=targetname|Sets the <code>info_target</code> through which the microphone should emit what it hears.}} | {{IO|SetSpeakerName|param=targetname|Sets the <code>info_target</code> through which the microphone should emit what it hears.}} | ||
{{I EnableDisable}} | {{I EnableDisable}} | ||
==Outputs== | ==Outputs== | ||
Line 53: | Line 54: | ||
{{IO|OnRoutedSound|Fired whenever a sound is routed out through the specified speaker (if any).}} | {{IO|OnRoutedSound|Fired whenever a sound is routed out through the specified speaker (if any).}} | ||
{{IO|OnHeardSound|Fired whenever this microphone hears any sound it cares about.}} | {{IO|OnHeardSound|Fired whenever this microphone hears any sound it cares about.}} | ||
[[Category:Sound System]] | [[Category:Sound System]] |
Revision as of 17:46, 4 September 2023
![]() |
---|
CEnvMicrophone |
![]() |
Template:Entity 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
- Hears combat sounds : [1]
- Hears world sounds : [2]
- Hears player sounds : [4]
- Hears bullet impacts : [8]
- Swallows sounds routed through speakers : [16]
Note:In speaker mode, sounds heard by the microphone will not play from their source, instead only being heard through this microphone's speaker.
- Hears explosions : [32]
- Ignores non-attenuated sounds : [64]
Keyvalues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- Speaker target (SpeakerName) <targetname>
- The name of an info_target at which to play any sounds heard by this microphone. If specified, the microphone will consider itself in Speaker mode. This should not be an env_speaker.


- 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.
- Listen Filter (ListenFilter) <filter>
- The name of a 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, sounds played back through speakers will be affected by the selected DSP.
- 0: Use environment default
- 50: (No effect)
- 51: (No effect)
- 52: (No effect)
- 53: (No effect)
- 54: (No effect)
- 55: Loud speaker
- 56: Very small speaker
- 57: Echoing speaker
- 58: Small speaker
- 59: Tiny speaker

- Sensitivity (0-10) (Sensitivity) <float>
- Sensitivity in measuring mode. 1 is normal, and anything between there and 10 is increasingly sensitive.
- Smoothing (0-1) (SmoothFactor) <float>
- How much to smooth the output value of measuring mode.
- Maximum hearing range (0=infinite) (MaxRange) <float>
- Sounds beyond this range won't be heard.

- Start Disabled (StartDisabled) <boolean>
- Stay dormant until activated (with the
Enable
input).
Inputs
- SetSpeakerName <targetname >
- Sets the
info_target
through which the microphone should emit what it hears.
EnableDisable:
- Enable / Disable
- Enable/disable this entity from performing its task. It might also disappear from view.
Outputs
- SoundLevel <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.