Riven SLST resources

From A look inside The Link @ wiki
Jump to: navigation, search
Riven
Mohawk Overview
BLST CARD FLST HSPT
MLST NAME PLST RMAP
SFXE SLST tBMP tMOV
tWAV VARS VERS ZIPS
Scripts Variables
External commands

They contain ambient sound info for the card. Ambient sounds are arbitrary mixes of a number of sounds (for example wind + steam flowing in a pipe). Sounds are read from tWAV resources stored in the associated *_sounds.mhk archive (not in the same archive storing the SLST resource). For example, a SLST resource in a_Data will point to tWAV sounds stored in a_Sounds, not a_Data.

Each SLST resource is a list of records; it starts with an unsigned short record count, followed by that many records. The record structure is:

unsigned short index Record index, starting from 1
unsigned short sound_count How many sounds to mix
unsigned short sound_ids[sound_count] tWAV resource IDs of the sounds to use
unsigned short fade_flags
unsigned short loop If set to 1, the mix loops forever
unsigned short global_volume Volume of the resulting sound mix
unsigned short u0
unsigned short u1
unsigned short volumes[sound_count] Volume for each sound component
unsigned short balances[sound_count] Balance for each sound component (<0 left, 0 center, >0 right)
unsigned short u2[sound_count]

fade_flags is a bit field controlling how to fade the sound channels when the record is activated. Bit 0 controls the fading out of any previous playing sound, bit 1 controls the fading in of the sound specified by the new record. For example, 3 would cause both sounds to fade, while 0 would suddenly stop the previous sound and immediately start the new one.

Volume ranges are not known exactly, values as high as 355 have been observed. Riven apparently keeps "scale factors" for sound volumes in its Riven.ini file (VolumeDivisorWin and VolumeDivisorMac).

u0 is usually 0 or 1, and changing it seems to do nothing. u1 is 0; giving it a non-zero value prevents sounds from playing. u2[] seems always 255 or 256 (for every sound component) and changing it seems to do nothing.

The first record is automatically enabled when entering the card, so it doesn't need to be activated from scripts.

Riven sound logic

This is an explanation of the Riven sound logic as it is currently understood.

Riven seems to maintain a set of playing sounds. Each sound has attributes, such as volume, panning, and fade flags. When an SLST record is activated, the set of playing sounds is updated with the set of sounds specified by the SLST record.

  • Any sound present in the currently playing set and the SLST record set keep on playing, but their volume and pan attributes are updated.
  • Any sound not present in the currently playing set but present in the SLST record gets added to the set of currently playing sounds. Appropriate fade-in is applied if specified by the sound flags.
  • Any sound present in the currently playing set but not present in the SLST record gets removed from the set of currently playing sounds. Appropriate fade-out is applied if specified by the sound flags.

In-data-archive sounds ("instant sounds", or "foreground sounds") are kept in a separate set, since they never loop. They should not block script execution.