Sound operators: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 59: Line 59:


; <code>sys_stop_entries</code>
; <code>sys_stop_entries</code>
: Stops sounds from playing.
: Ends existing sounds.
:; <code>match_entry</code>
:: The sound entry name to look for.
:; <code>match_substring</code>
:: Whether <code>match_entry</code> can be part of a larger string (e.g. "MyGun" matches MyGun.fire, MyGun.reload).
:; <code>match_channel</code>
:; <code>match_channel</code>
:: Sound must have the same channel (e.g. CHAN_STATIC) to match
:: Sound must have the same channel (e.g. CHAN_STATIC) as this one to match.
:; <code>match_entity</code>
:; <code>match_entity</code>
:: Sound must be coming from the same entity as this one
:: Sound must be coming from the same entity as this one.
:; <code>input_max_entries</code>
:: {{confirm|Stop all but this many instances of the sound?}}
; <code>sys_start_entry</code>
: Plays another sound.
:; <code>input_start</code>
:: {{confirm|In addition to whether the operator is active, only start if/when this value is true?}}
:;<code>entry_name</code>
:: The entry to play.
; <code>sys_block_entries</code>
: Prevents new sounds from playing.
:; <code>input_duration</code>
:: How long to suppress sounds for.
:; <code>input_active</code>
:: {{confirm|In addition to normal duration, suppress only when this value is true?}}
:; <code>match_entry</code>
:; <code>match_entry</code>
:: The sound entry name to look for
:: Sound entry to suppress.
:; <code>match_sound</code>
:: A raw WAV/MP3 filename to match. Possibly deprecated?
:; <code>match_substring</code>
:; <code>match_substring</code>
:: Whether <code>match_entry</code> can be part of a larger string (e.g. "MyGun" matches MyGun.fire, MyGun.reload...).
:: Whether <code>match_entry</code> can be part of a larger string (e.g. "MyGun" matches MyGun.fire, MyGun.reload).
:; <code>input_max_entries</code>
:; <code>match_channel</code>
:: {{confirm|The number of times this sound can be playing at once?}}
:: Sound must have the same channel (e.g. CHAN_STATIC) as this one to match.
* sys_start_entry
:; <code>match_entity</code>
* sys_block_entries
:: Sound must be coming from the same entity as this one.
* sys_output
; <code>sys_output</code>
* sys_platform
: {{todo|A complete mystery!}}
* sys_mixlayer
; <code>sys_platform</code>
: Tests what platform the engine is running on.
:; <code>pc</code>
:; <code>x360</code>
:; <code>ps3</code>
:: Should the operator return true if running on this platform?
; <code>sys_mixlayer</code>
: Configures a [[sound mixer]]. See <code>scripts\soundmixers.txt</code>
:; <code>mixlayer</code>
:: The layer to alter.
:; <code>mixgroup</code>
:: The sound group within the layer to alter.
:; <code>field</code>
:: Property of the group to alter.
:; <code>input</code>
:: [[Floating point]] value to set.


=== Maths ===
=== Maths ===

Revision as of 02:57, 4 May 2011

These are the root sound operators referenced in Portal 2. See scripts/sound_operator_stacks.txt and Soundscripts#Operator stacks for more details.

Usage

VFX.LightFlickerEnd 
{
	channel		CHAN_AUTO
	soundlevel	SNDLVL_105db
	volume		1.0
	rndwave
	{
		wave		"vfx/light_flicker/light_flicker_end_01.wav"
		wave		"vfx/light_flicker/light_flicker_end_02.wav"
		wave		"vfx/light_flicker/light_flicker_end_03.wav"
		wave		"vfx/light_flicker/light_flicker_end_04.wav"
	}

	soundentry_version 2

	operator_stacks
	{
		start_stack // applied when the sound begins
		{
			import_stack 	"P2_exclusion_time_blocker_start" // defined in scripts/sound_operator_stacks.txt

			// We are now extending/configuring P2_exclusion_time_blocker_start

			block_entries // prevents another sound from playing
			{
				input_duration 0.25 // seconds to block for
				match_entry "World.LightFlickerEnd" // the sound entry to block
				match_entity false // only on the same entity that this sound is playing from?
			}
		}
	}
}

Common properties

execute_once
Whether the operator should run every time the stack is evaluated, or only the first time. Output values are presumable stored between executions in the latter case.
input_execute
The operator will only run if this value is true (i.e. non-zero).
output
The result of the operator (if there is one). Accessed with @OperatorName.output.

There is also one special command that is not an operator:

import_stack
Inserts another named stack into this one.

Operator list

System

Affect sound playback.

sys_stop_entries
Ends existing sounds.
match_entry
The sound entry name to look for.
match_substring
Whether match_entry can be part of a larger string (e.g. "MyGun" matches MyGun.fire, MyGun.reload).
match_channel
Sound must have the same channel (e.g. CHAN_STATIC) as this one to match.
match_entity
Sound must be coming from the same entity as this one.
input_max_entries
Confirm:Stop all but this many instances of the sound?
sys_start_entry
Plays another sound.
input_start
Confirm:In addition to whether the operator is active, only start if/when this value is true?
entry_name
The entry to play.
sys_block_entries
Prevents new sounds from playing.
input_duration
How long to suppress sounds for.
input_active
Confirm:In addition to normal duration, suppress only when this value is true?
match_entry
Sound entry to suppress.
match_sound
A raw WAV/MP3 filename to match. Possibly deprecated?
match_substring
Whether match_entry can be part of a larger string (e.g. "MyGun" matches MyGun.fire, MyGun.reload).
match_channel
Sound must have the same channel (e.g. CHAN_STATIC) as this one to match.
match_entity
Sound must be coming from the same entity as this one.
sys_output
Todo: A complete mystery!
sys_platform
Tests what platform the engine is running on.
pc
x360
ps3
Should the operator return true if running on this platform?
sys_mixlayer
Configures a sound mixer. See scripts\soundmixers.txt
mixlayer
The layer to alter.
mixgroup
The sound group within the layer to alter.
field
Property of the group to alter.
input
Floating point value to set.

Maths

Generate or process numbers.

math_random
Produces a random number. Access it with @MyRandom.output.
input_min
input_max
Range of values to output.
  • math_float
  • math_delta
  • math_remap_float
  • math_func1

Getters

Provide values from the engine.

  • get_entry_time
  • get_sys_time
  • get_source_info
  • get_soundmixer
  • get_convar
  • get_dashboard
  • get_map_name

Calculations

Calculate pre-set algorithms.

  • calc_angles_facing
  • calc_distant_dsp
  • calc_occlusion
  • calc_falloff
  • calc_source_distance
  • calc_spatialize_speakers

Other

  • util_pos_vec8
  • util_print_float
  • game_view_info
  • op_accumulate_ss_float