XML:SNDD: Difference between revisions

750 bytes added ,  1 April 2012
m
no edit summary
mNo edit summary
mNo edit summary
Line 165: Line 165:


* <Flags>
* <Flags>
: PreventRepeat - forces to play different sounds if more than one permutation is present
: PreventRepeat - forces to play different sounds if more than one permutations are present
* <NumberOfChannels> - here you tell Oni if your sound file is "1" (22.05 kHz, mono) or "2" (22.05 kHz, stereo; (PC-only:) 44.1 kHz, mono), if you set the wrong value the music will sound distorted
* <NumberOfChannels> - here you tell Oni if your sound file is "1" (22.05 kHz, mono) or "2" (22.05 kHz, stereo; (PC-only:) 44.1 kHz, mono), if you set the wrong value the music will sound distorted
* <Sound> - this is the sound file (for example: <font color=#AAAAAA>SNDD</font>nyan<font color=#AAAAAA>.oni</font>), file prefix and suffix aren't used
* <Sound> - this is the sound file (for example: <font color=#AAAAAA>SNDD</font>nyan<font color=#AAAAAA>.oni</font>), file prefix and suffix aren't used
Line 223: Line 223:
* [[BSL:Functions#sound|on this wiki]]
* [[BSL:Functions#sound|on this wiki]]
* [http://ssg.oni2.net/commands.htm#sound on ssg's website]
* [http://ssg.oni2.net/commands.htm#sound on ssg's website]
sound_music_stop ''soundtrack'' - can only be used if .amb file has the InterruptTracksOnStop flag<br>
sound_music_stop ''soundtrack'' 1 - soundtrack stop after 1 second while it gets quieter
You need a custom function if you want to fade out a soundtrack over more than one seconds. It could look like this:
var float x = 1;
var int y = 0;
# don't test this function with the console, it could happen that the func stop working after 4 cycles
func fade_music
{
  # if statement with float values doesn't seem to work therefore the int y
y = y + 1
x = x - .01
sound_music_volume (soundtrack, x)
sleep 10
  if (y eq 99)
{
# dmsg "stop music"
sound_music_stop soundtrack
}
if (y < 99)
{
fork fade_music
}
}




8,184

edits