I'm using a AudioInputStream to feed bytes to a SourceDataLine to play a PCM file. I want to give the user the ability to move a slider to jump to some point in the file.
Issues I'm having:
markSupported()returnsfalseon myAudioInputStream. So I cannot use my initial approach to callreset()thenskip()(which I already thought was kind of ugly...)- I would really prefer not to tear down the
InputStream and create a new one just to jump to a position prior to my current mark. SourceLineData.getLongFramePosition()does not seem to be very reliable... I know it has a buffer, but even if account for thebytes left in the buffer, i do not understand the behavior
I have considered using a Memory-Mapped File to feed bytes to the line that way I can jump wherever I want, but I don't want to add complexity to the function if I don't have to. Is there a good way to do this that I'm missing? also can anyone explain what the frame number returned by getLongFramePosition() actually means? is it number of frames passed through speakers (does not appear to be)?