1

My game has a couple of different simultaneous QSoundEffects (mainly gun sounds) and I play them simply like this:

effect.setVolume(0.5f);
effect.play();

The sound data has been loaded beforehand when the application initializes.

On my Ubuntu desktop this works perfectly, but on Android some of the sounds don't play. The problematic sounds can be different each time until I restart the app.

What could possibly cause this?

4

1 回答 1

1

对自己的回答:

似乎同时存在 QSoundEffects 的最大计数。这是意料之中的,但它似乎有效,因此只有前 N 个音效按其创建顺序播放。其余的都被忽略了。如果您首先停止正在播放的其他一些声音,这将无济于事。这让我相信 QSoundEffects 被永久映射到免费音频流。

我尝试在需要时即时设置一些源,但它不稳定并且 PulseAudio 随机崩溃。所以......现在看来我会采用 OpenAL Soft 路线,因为它很容易为 Android 编译。

于 2016-03-01T07:09:46.127 回答