Thanks, I do create the AudioTrack object in a different thread. As a matter of fact I create a new thread for every new pcm I play using the AudioTrack . I will try to use a single thread and see how it goes. Right now I am ising a single AudioTrack to play the sounds. is it possible to create a new object for every new sound to be played?
On Dec 8, 11:22 pm, niko20 <nikolatesl...@yahoo.com> wrote: > Actually if you look through the source code to AudioTrack, it looks > like so: > > void AudioTrack::start() > { > sp<AudioTrackThread> t = mAudioTrackThread; > > LOGV("start"); > if (t != 0) { > if (t->exitPending()) { > if (t->requestExitAndWait() == WOULD_BLOCK) { > LOGE("AudioTrack::start called from thread"); > return; > } > } > t->mLock.lock(); > } > > if (android_atomic_or(1, &mActive) == 0) { > if (t != 0) { > t->run( > ....etc > > So this looks like it may be that start() is being called when the > AudioTrack has already been started once. Maybe make sure you are not > starting the track over and over without stopping or reloading it, > etc. (What you do depends if you are using MODE_STATIC or MODE_STREAM) > > -niko > > On Dec 8, 10:19 pm, niko20 <nikolatesl...@yahoo.com> wrote: > > > > > Hi, > > > There is no limitation on running AudioTrack in a thread, I do it all > > the time, it must be something else going on. > > > One thing you may want to try is to create the AudioTrack object and > > start() it in the same thread. Perhaps it doesn't like being created > > in a different thread than start() is called in ? > > > -niko > > > On Dec 8, 8:30 pm, Business Talk <roman.businesst...@gmail.com> wrote: > > > > I am getting the 'AudioTrack::start called from thread' when starting > > > an AudioTrack. I am using it in a thread. I asume I shouldn't but > > > why? I see it as a major limitation.- Hide quoted text - > > - Show quoted text - -- 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