Env microphone: Difference between revisions
Jump to navigation
Jump to search
Warning:setting this to 0, or greater 1024 when the microphone is in Speaker mode can be very bad for performance!
m (→Keyvalues: removed a confirm that seemed obvious to me) |
(updates) |
||
Line 1: | Line 1: | ||
{{ | {{lang|Env microphone}} | ||
| | [[File:env_microphone.png|left]] {{base point|env_microphone}} 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. | ||
}} | |||
{{ | {{code class|CEnvMicrophone|envmicrophone.cpp}} | ||
== | ==Flags== | ||
*1: Hears combat sounds | |||
*2: Hears world sounds | |||
*4: Hears player sounds | |||
*8: Hears bullet impacts | |||
*16: Swallows sounds routed through speakers - This means it will not listen to sounds coming though from any other <code>env_microphone</code> including itself. | |||
*32: Hears explosions | |||
*64: Ignores non-attenuated sounds | |||
==Keyvalues== | |||
{{KV|Speaker target (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}}.}} | |||
{{KV|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.}} | |||
{{KV|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.}} | |||
{{KV|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]]. | |||
{{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>.}} | |||
:*0: Use environment default | |||
:*50: ''(No effect)'' | |||
:*51: ''(No effect)'' | |||
:*52: ''(No effect)'' | |||
:* Use environment default | :*53: ''(No effect)'' | ||
:* ''(No effect)'' | :*54: ''(No effect)'' | ||
:* ''(No effect)'' | :*55: Loud speaker | ||
:* ''(No effect)'' | :*56: Very small speaker | ||
:* ''(No effect)'' | :*57: Echoing speaker | ||
:* ''(No effect)'' | :*58: Small speaker | ||
:* Loud speaker | :*59: Tiny speaker}} | ||
:* Very small speaker | {{KV|Sensitivity (0-10) (Sensitivity)|float|Sensitivity in measuring mode. 1 is normal, and anything between there and 10 is increasingly sensitive.}} | ||
:* Echoing speaker | {{KV|Smoothing (0-1) (SmoothFactor)|float|How much to smooth the output value of measuring mode.}} | ||
:* Small speaker | {{KV|Maximum hearing range (0{{=}}infinite) (MaxRange)|float|Sounds beyond this range won't be heard. | ||
:* Tiny speaker | |||
}} | {{warning|setting this to 0, or greater 1024 when the microphone is in Speaker mode can be very bad for performance!}}}} | ||
{{KV|Sensitivity (0-10)|float|Sensitivity in measuring mode. 1 is normal, and anything between there and 10 is increasingly sensitive.}} | {{KV|Sound Mask (SoundMask)|int|nofgd=1|{{todo|Some kind of alternative to the Hears X spawnflags?}}}} | ||
{{KV|Smoothing (0-1)|float|How much to smooth the output value of measuring mode.}} | |||
{{KV|Maximum hearing range (0 | |||
{{KV EnableDisable}} | {{KV EnableDisable}} | ||
{{KV | {{KV BaseEntity|css=1}} | ||
== Inputs == | ==Inputs== | ||
{{IO|SetSpeakerName|param=targetname|Sets the | {{IO|SetSpeakerName|param=targetname|Sets the <code>info_target</code> through which the microphone should emit what it hears.}} | ||
{{I EnableDisable}} | {{I EnableDisable}} | ||
{{I | {{I BaseEntity}} | ||
}} | |||
== Outputs == | ==Outputs== | ||
{{IO|SoundLevel|param=float|Fired in Measuring mode whenever the sound level changes.}} | {{IO|SoundLevel|param=float|Fired in Measuring mode whenever the sound level changes.}} | ||
{{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.}} | ||
{{O | {{O BaseEntity|l4d=1}} | ||
[[Category:Sound System]] | [[Category:Sound System]] |
Revision as of 07:26, 29 September 2018
Template:Base point 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
- 1: Hears combat sounds
- 2: Hears world sounds
- 4: Hears player sounds
- 8: Hears bullet impacts
- 16: Swallows sounds routed through speakers - This means it will not listen to sounds coming though from any other
env_microphone
including itself. - 32: Hears explosions
- 64: Ignores non-attenuated sounds
Keyvalues
- Speaker target (SpeakerName) ([todo internal name (i)]) <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) ([todo internal name (i)]) <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) ([todo internal name (i)]) <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) ([todo internal name (i)]) <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) ([todo internal name (i)]) <float>
- Sensitivity in measuring mode. 1 is normal, and anything between there and 10 is increasingly sensitive.
- Smoothing (0-1) (SmoothFactor) ([todo internal name (i)]) <float>
- How much to smooth the output value of measuring mode.
- Maximum hearing range (0=infinite) (MaxRange) ([todo internal name (i)]) <float>
- Sounds beyond this range won't be heard.

- Sound Mask (SoundMask) ([todo internal name (i)]) <integer> !FGD
- Todo: Some kind of alternative to the Hears X spawnflags?
- 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.