Sound.setPosition

From Spheriki

Jump to: navigation, search

If the sound is seekable, this sets the position the playing sound is at (in samples, not milliseconds).


Contents

Usage

Number sound_object.setPosition(time);
  • time The amount of time (in samples) to start the music at.


Examples

var sound = LoadSound("somefile.mp3");
sound.play(true);
sound.setPosition(10000);
//The sound should have started playing from a later point than usual.


Notes

  • The sound needs to be seekable before you can use this function. You can check whether a sound file is seekable by using Sound.isSeekable().
    • OGG and MP3 files usually are seekable, modules (.IT, .MOD, .XM etc) and MIDI files are never seekable.
  • Sound position is given in samples; that is, if the sound's frequency is 44100 Hz, you need to pass 88200 to start at 2 seconds.


See also

Personal tools