The AudioSample class (and its SoundFile subclass) have a .position() method which is meant to provide the user with information on the current position of playback (or last queued-to/paused-at position) in seconds. However, the calculation of the time based on the underlying frame position of the JSyn data queue is off (by about a factor of 2?) at the moment, which is why there is also no official documentation for this method. The frame-to-second-conversion needs to be looked into first, keeping in mind that whether an audio source is mono or stereo will have an effect on the frame rate that is not governed by the sample rate itself.
|
public float position() { |
|
// TODO progress in sample seconds or current-rate-playback seconds?? |
|
// TODO might have to offset getFrameCount by this.startFrame? |
|
return (this.player.dataQueue.getFrameCount() % this.frames()) / (float) this.sampleRate(); |
|
} |