I tried the sample project attest.zip for AudioTrack and I can't figure out how to pause/resume playing.
Calling at.pause immediately triggers the Play_Ended event. And if I comment out at.Release and call at.play it will only play for a few milliseconds which I'm guessing is the data left in the buffer, then nothing else.
B4X:
Sub activity_Click
ToastMessageShow("pause", False)
at.Pause
End Sub
Sub activity_LongClick
ToastMessageShow("resume", False)
at.Play
End Sub
I'm not familiar with AudioTrack library, however it is probably quite similar to AudioStreamer from Audio library. You should usually have a timer that feeds the buffer. You can then disable and enable the timer as needed.
This was one of my first libraries and a lot has changed in the Andriod class since this was written, however the Audiotrack,Pause method pauses the Audiotrack object not the data that is fed to it which is done in the code. This needs to be implemented in the code either with a flag, or as Erel suggests using a timer with either option remembering the current data position and resuming when needed.