I wrote the following code to experiment with the AudioTrack class but whenever I click the pause button it seems to "REWIND" the track rather than pause it, am I doing something wrong? private class PlayAudio extends AsyncTask<Void, Void, Void> implements OnPlaybackPositionUpdateListener { AudioTrack audioTrack; boolean keepGoing = true;
boolean speed = false; @Override protected Void doInBackground(Void... params) { int bufferSize = AudioTrack.getMinBufferSize(frequency, channelConfiguration, audioEncoding); audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, frequency, channelConfiguration, audioEncoding, bufferSize, AudioTrack.MODE_STREAM); audiodata = fillBuff(myAudio); audioTrack.setPlaybackPositionUpdateListener(this); audioTrack.play(); // This while block ensures that a buffer is continuously replenished. while (keepGoing) { audioTrack.write(audiodata, 0, audiodata.length); } return null; } @Override public void onMarkerReached(AudioTrack track) { } @Override public void onPeriodicNotification(AudioTrack track) { } protected void onPostExecute(Void result) { } } public void onClick(View v) { int id = v.getId(); if (id == R.id.PausePlaybackButton) { // playTask.maKorin = false; playTask.audioTrack.pause(); } //... } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en