开发者

Using Android setPositionNotificationPeriod with AudioTrack in loop mode

I was using audiotrack to play some sounds in a loop. Now I need to know in which period of time I'm right now, so i decided to use setPositionNotificationPeriod which works quite good. The problem is that it just work for the first "loop" but stop being called after that :\

The code looks like the following:

...
audioTrack.setPositionNotificationPeriod(bufferSize/numCalls);
audioTrack.setPlaybackPositionUpdateListener(this); 
audioTrack.setLoopPoints(0,bufferSize,-1);
...

public void onPeriodicNotification(AudioTrack track) 
{
    Log.d("Hey I'm on call: "+numCall++);
}

With that I got just #numCalls# calls but I want them to be forever.

Any idea how to fix it?

Thank you very much

EDIT: I开发者_如何学C forgot to say I'm using an static audiotrack instead of stream

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜