18,700
edits
m (-finish) |
(replaced old music scripting section with new one, correcting various information in the process) |
||
Line 223: | Line 223: | ||
|valign="top"| flag | |valign="top"| flag | ||
| | | | ||
: InterruptTracksOnStop — this flag | : InterruptTracksOnStop — don't wait for current .grp element to finish before stopping sound; used for dialogue, a few sound effects, some music pieces; music with this flag will immediately cut to its outro when <tt>sound_music_stop</tt> is called on it | ||
: PlayOnce | : PlayOnce – prevents looping; used for dialogue, a few sound effects | ||
: CanPan | : CanPan | ||
|- | |- | ||
Line 515: | Line 515: | ||
</SNDG> | </SNDG> | ||
== | ==Scripting music== | ||
Here are the BSL commands you can use for music:<br> | |||
'''sound_music_start name:string [volume:float]''', e.g. <tt><code>sound_music_start mus_asian 0.75</code></tt> | |||
sound_music_stop '' | '''sound_music_stop name:string''', e.g. <tt><code>sound_music_stop mus_asian</code></tt><br> | ||
If .amb file has InterruptTracksOnStop flag, music will proceed immediately to <OutSound>, otherwise current segment will finish playing and then <OutSound> will play. | |||
'''sound_music_volume name:string volume:float [time:float]''', e.g. <tt><code>sound_music_volume mus_asian 0.35 1.0</code></tt><br> | |||
Volume change takes effect instantly unless you specify a time as the third parameter. | |||
---- | |||
When Oni's BSL scripting wants to stop some music, it will either: | |||
# Call <tt>sound_music_stop</tt>. | |||
# Fade out the music with <tt>sound_music_volume</tt> and then call <tt>sound_music_stop</tt> when the music has reached zero volume. | |||
When setting up your .amb file, you have to think about the timing of how the music will be used. If a music track has an <OutSound> in its .amb, then the sequence of events will be:<br> | |||
:<tt>sound_music_stop</tt> called → current segment (SNDD) finishes playing → outro SNDD plays | |||
Thus it can be quite a while before the music really stops. If timing is a concern, such as in a cutscene, you could leave out the <OutSound> (but that would make your music end abruptly when the current segment finished playing), fade the music out over any amount of time that you desire, or use the InterruptTracksOnStop flag to skip to <OutSound> immediately so that the music ends sooner. | |||
Oni contains many variants of music OSBDs with and without the InterruptTracksOnStop flag, such as OSBDmus_amasian.amb and OSBDmus_amasian_hd.amb; they play the same actual SNDDs, but the "_hd" variant has the InterruptTracksOnStop flag; when <tt>sound_music_stop</tt> is called on a "_hd" OSBD, you will hear it immediately jump to the outro, which is slightly jarring but can be useful in some cases. An easily-observed example is OSBDmus_fiteb_hd, which plays in {{C2}} when combat starts after the opening cutscene. When the last blow is delivered to the attacking Strikers, the music will immediately jump to its outro, punctuating the end of the action. | |||
==OCF thread about making new music== | ==OCF thread about making new music== |