Sound operators

From Valve Developer Community
Revision as of 12:12, 2 May 2011 by TomEdwards (talk | contribs)
Jump to navigation Jump to search

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
Stops sounds from playing.
match_channel
Sound must have the same channel (e.g. CHAN_STATIC) to match
match_entity
Sound must be coming from the same entity as this one
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...).
input_max_entries
Confirm:The number of times this sound can be playing at once?
  • sys_start_entry
  • sys_block_entries
  • sys_output
  • sys_platform
  • sys_mixlayer

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