Steven Haggerty
Steven Haggerty

Reputation: 328

Re-using AudioTrack instances

We've encountered the memory leak in the AudioTrack class (http://code.google.com/p/android/issues/detail?id=17995)

Is there anyway to re-use AudioTrack instances with different waveform data? The AudioTracks need to be in static mode for low latency.

We basically want allocate (for example) 16 AudioTrack instances and re-use them whenever we play some sound-fx. The problem seems to be writing to an AudioTrack that has been used causes a crash, even if the AudioTrack has been stopped.

Anyone care to help up out please? Is what I'm trying to do even possible?

Thank you,

Steve.

Upvotes: 1

Views: 1453

Answers (1)

Femi
Femi

Reputation: 64700

If you are trying to use a limited number of tracks have you tried using static mode?

From @Steve Haggerty's comment below: there is reportedly a memory leak in certain versions of Android, and STREAM mode is to be preferred for all development work.

Upvotes: 1

Related Questions