AudioFlinger could not create track, status: -12 | when looping a sound effect


#1

This happens when I try to loop a sound effect, only on Android though. I’m using the latest stable version, (2.0-2.0.2 or something…just released yesterday).

I’m playing OGG files, I’ve tried variable length encoding and constant encoding, neither work. I can’t seem to find anything about this, and I know it worked before (with the beta version)…

How do I fix it?

EDIT:
Strangely enough, it works exactly half of the time. I go into the scene, the sound plays/loops fine. I go to a new scene and back to the first one and it doesn’t work. If I go to another scene and back again, it works.


#2

Also, the sound plays fine without looping. It’s only looping that doesn’t work.


#3

Could you attach the audio file to help us to reproduce it?


#4

我也遇到这个问题了,我英文比较菜,就直接用中文给你描述一下。

场景是飞机在画面上飞,播放飞行的音效。
因为要循环播放这个音效,所以设置loop为true

void AudioManager::playFly(){
m_flyId = SimpleAudioEngine::sharedEngine()->playEffect(SOUND_FLY, true);
}

飞机停止时,关闭这个音效

void AudioManager::stopFly(){
//SimpleAudioEngine::sharedEngine()->stopAllEffects();
SimpleAudioEngine::sharedEngine()~~>stopEffect;
}
到目前为止都ok
这时飞机再起飞,第二次执行playFly。在其他平台都ok,在android上就没声,程序不会崩,但是后台打印error
09-04 22:26:12.451: E/AudioTrack: AudioFlinger could not create track, status:~~12
09-04 22:26:12.451: E/SoundPool(7215): Error creating AudioTrack

应该跟音乐文件的格式是无关,换了ogg一样现象。

如果最初播放不设置loop,就ok

Minggo Zhang wrote:

Could you attach the audio file to help us to reproduce it?


#5

So the issue is that:

  1. play an effect with loop mode
  2. stop the effect
  3. play the effect again
    Then can not play the effect.

Right?


#6

Yes. I think it’s an issue with the actual sound file, because when I reencoded from the source (wav -> ogg) it worked fine, no trimming or anything needed.

I attached the OGG that was causing problems.


#7

yes,the issue only in android
Minggo Zhang wrote:

So the issue is that:

  1. play an effect with loop mode
  2. stop the effect
  3. play the effect again
    Then can not play the effect.
    >
    Right?

#8

@Sam Borenstein
What’s your meaning?
Did you mean you resolve it only change the file format to ogg?
But you attach an ogg file.


#9

No, the format was ogg before. I’m not sure how I fixed it exactly, but I opened it in audacity, and reexported it and it started working. I don’t know why.

I attached the ogg in reply to:

Could you attach the audio file to help us to reproduce it?


#10

the final solution was to open the mp3 in an audio editor and re-edit it with slightly lesser quality so that the file is now smaller, and doesn’t seem to take up quite as many resources in the system. from http://stackoverflow.com/questions/11964623/audioflinger-could-not-create-track-status-12?answertab=votes#tab-top.
简单地说,就是压缩音效文件