Sound operators: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(→‎System: Added all the info I could find on sys_output)
Line 93: Line 93:
:: Sound must be coming from the same entity as this one.
:: Sound must be coming from the same entity as this one.
; <code>sys_output</code>
; <code>sys_output</code>
: {{todo|A complete mystery!}}
: Sends a value back to the sound system relating to the current entry.
:; <code>input_float</code>
:: Takes a float value to send to the system.
:; <code>input_speakers</code>
:: Takes an array of floats to send to the system, each to do with a certain speaker. Use only with the speakers output.
:; <code>output</code>
:: Says what value should be altered, for example:
::; <code>speakers</code>
::: Use in <code>update_stack</code>s only. Adjusts the volume of each speaker according to values given by <code>input_speakers</code>.
::; <code>pitch</code>
::: Use in <code>update_stack</code>s only. Adjusts the playback pitch of the sound to the value given with <code>input_float</code>.
::; <code>dsp</code>
::: Use in <code>update_stack</code>s only. Adjusts the DSP of the sound to the value given with <code>input_float</code>.
::; <code>delay</code>
::: Use in <code>start_stack</code>s only. Waits for the number of seconds specified in <code>input_float</code> before starting the sound. A negative value results in it starting the sound that many seconds into the WAV file instead of at the beginning.
::; <code>block_start</code>
::: Use in <code>start_stack</code>s only. Prevents the sound from starting if the value given with <code>input_float</code> is non-zero.
::; <code>mixlayer_trigger</code>
::: "Tell the mixlayer we're active" if the value given with <code>input_float</code> is non-zero.
::: {{todo|What does this mean?}}
::; <code>save_restore</code>
::: {{confirm|Use in <code>update_stack</code>s only. Tells the system to save and restore the state of the sound if the value given with <code>input_float</code> is non-zero.}}
::; <code>stop_hold</code>
::: Use in <code>update_stack</code>s only. {{confirm|Prevents the sound from stopping if the value given with <code>input_float</code> is non-zero.}}
::; <code>facing</code>
::: {{confirm|Make the sound play in a certain direction?}}
; <code>sys_platform</code>
; <code>sys_platform</code>
: Tests what platform the engine is running on.
: Tests what platform the engine is running on.

Revision as of 16:04, 6 November 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
Sends a value back to the sound system relating to the current entry.
input_float
Takes a float value to send to the system.
input_speakers
Takes an array of floats to send to the system, each to do with a certain speaker. Use only with the speakers output.
output
Says what value should be altered, for example:
speakers
Use in update_stacks only. Adjusts the volume of each speaker according to values given by input_speakers.
pitch
Use in update_stacks only. Adjusts the playback pitch of the sound to the value given with input_float.
dsp
Use in update_stacks only. Adjusts the DSP of the sound to the value given with input_float.
delay
Use in start_stacks only. Waits for the number of seconds specified in input_float before starting the sound. A negative value results in it starting the sound that many seconds into the WAV file instead of at the beginning.
block_start
Use in start_stacks only. Prevents the sound from starting if the value given with input_float is non-zero.
mixlayer_trigger
"Tell the mixlayer we're active" if the value given with input_float is non-zero.
Todo: What does this mean?
save_restore
Confirm:Use in update_stacks only. Tells the system to save and restore the state of the sound if the value given with input_float is non-zero.
stop_hold
Use in update_stacks only.
Confirm:Prevents the sound from stopping if the value given with input_float is non-zero.
facing
Confirm:Make the sound play in a certain direction?
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