Sound.getPosition

From Spheriki

Jump to: navigation, search

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


Contents

Usage

Number sound_object.getPosition();


Examples

var sound = LoadSound("somefile.mp3");
sound.play(true);
GetKey();
Abort("When player pressed a key, " + sound.getPosition() + " had passed.");


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, 2 seconds of passing time may make this function return the value 88200.

See also

Personal tools