Class TimbnPluginAudio
Plays the game's own music and sound effects for the plugin, with music put back the way it was when the plugin is done. Reach it through the plugin's Audio property.
public sealed class TimbnPluginAudio
- Inheritance
-
TimbnPluginAudio
- Inherited Members
Methods
PlayMusic(string)
Plays one of the game's music tracks on a loop, such as violin or char_theme_linda, fading out whatever music was playing. When the handle is disposed the track fades out and the music before it comes back. A newer track from any plugin takes over, and the music before both comes back when that one ends.
public IDisposable PlayMusic(string trackId)
Parameters
trackIdstringThe id of a track in one of the game's playlists.
Returns
- IDisposable
A handle that stops the track when disposed. It is also stopped when the plugin unloads and on the way to the main menu.
Examples
_song = Audio.PlayMusic(TimbnGameIds.Music.Violin);
// once the performer stops
_song.Dispose();
PlaySound(string)
Plays one of the game's sound effects once, such as item_use_drink when someone takes a drink or coins_sound when money changes hands. It plays at full volume wherever the player stands, ends on its own and needs no undo. Nothing plays at the main menu or for an empty id.
public void PlaySound(string soundId)
Parameters
soundIdstringThe id of one of the game's sounds, the way an item's onUseSound names them.
Examples
Audio.PlaySound(TimbnGameIds.Sounds.ItemUseDrink);