Template:Op sounds and music tracks

Sounds and music tracks
There are two types of sound in the game: sounds and tracks. Sounds are just short sound effects. They can be positional (i.e. emitted by some object on the scene or by player's opponent during the dialog). They can be generic sound effects, like playing some drums when player meets mountain bandits.

Tracks are the background music. The game works as a kind of a musuc box, cycling the available melodies according to the situation. It is up to the Module System developer, however, to tell the game what the situation is. There are two factors which you can tell the game: situation and culture. So you can tell the game that the situation is "ambush" and the culture is "khergits", and the game will select the musuc tracks which fit this combination of situation and culture and will rotate them randomly. And of course, you can also tell the game to play one specific track if you want.

play_sound_at_position = 599
 * (play_sound_at_position, ,, [options]),
 * Plays a sound in specified scene position. See sf_* flags in header_sounds.py for reference on possible options.

play_sound = 600
 * (play_sound, , [options]),
 * Plays a sound. If the operation is called from agent, scene_prop or item trigger, then the sound will be positional and 3D. See sf_* flags in header_sounds.py for reference on possible options.

play_track = 601
 * (play_track, , [options]),
 * Plays specified music track. Possible options: 0 = finish current then play this, 1 = fade out current and start this, 2 = stop current abruptly and start this

play_cue_track = 602
 * (play_cue_track, ),
 * Plays specified music track OVER any currently played music track (so you can get two music tracks playing simultaneously). Hardly useful.

music_set_situation = 603
 * (music_set_situation, ),
 * Sets current situation(s) in the game (see mtf_* flags in header_music.py for reference) so the game engine can pick matching tracks from module_music.py. Use 0 to stop any currently playing music (it will resume when situation is later set to something).

music_set_culture = 604
 * (music_set_culture, ),
 * Sets current culture(s) in the game (see mtf_* flags in header_music.py for reference) so the game engine can pick matching tracks from module_music.py. Use 0 to stop any currently playing music (it will resume when cultures are later set to something).

stop_all_sounds = 609
 * (stop_all_sounds, [options]),
 * Stops all playing sounds. Version 1.153 options: 0 = stop only looping sounds, 1 = stop all sounds. Version 1.143 options: 0 = let current track finish, 1 = fade it out, 2 = stop it abruptly.

store_last_sound_channel = 615
 * (store_last_sound_channel, ),
 * Version 1.153+. UNTESTED. Stores the sound channel used for the last sound operation.
 * Can fail. Return -1 as value. For agent_play_sound; play_sound - if called from item, scene_prop trigger. (For research)

stop_sound_channel = 616
 * (stop_sound_channel, ),
 * Version 1.153+. Stops sound playing on specified sound channel. Used to fix bug with looping sounds in Viking Conquest.
 * There are 256 sound channels. The closest agent has 0 channel. The farthest agents will rewrite last 10 channels.