Playing game sound effects and background music simultaneously

Playing game sound effects and background music simultaneously

I'm trying to finish off a game for Meego (mobile), but i've been having loads of problems trying to get multiple sounds to play together. I tried using QMediaPlayer with an ogg bgm and wav sfx but this often broke the sound playing (on Netbook and n900) depending on the number of sfx triggered at the same time. I also tried using the sample QuickHit's QAudioOuput mixing code, but that also seems to break. What are other people using to play multiple sounds and background music?
9 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Hi DEllel:

When you said it is broken, do you mean the sound/music is choppy when you tried to play them?

--vincent

With QMediaPlayer playing some sfx would silence the music track.

Can you tell me the version of Qt and QtMobility that you are using?
thanks

--vincent

MeeGo 1.1.2 SDK Update

QtCreator 2.0.1
Qt 4.7.0
Qt Mobility 1.0

Targets installed:
meego-core-armv7l-1.1.2
meego-netbook-ia32-1.1.2

Let me look into it and get back to you.

I decided to use QAudioOutput and rework the QuickHit example code. However i'm getting a half second delay between a sample being triggered and it starting to play. This is related to the size of QAudioOutput's audio buffer, and the smallest value that QAudioOutput::bytesFree() will return. Whether i'm using 22khz mono or 44khz stereo, the size of the audio buffer that QAudioOutput actually uses (it ignores the requested size) conspires to introduce that half second delay. I can't see how to reduce it. Has anyone encountered the same problem?
Thanks

Can you point me to the QuickHit example code if it is available for general download?
thanks

https://projects.forum.nokia.com/quickhit

It appears that in the N900 implementation of QAudioOutput the system doesn't start playing the contents of the audio buffer until it is completely filled, thus introducing a delay in playing the size of the audio buffer, which you can't reduce because the system ignores the buffer size request and always allocates itself enough for about 0.5 seconds.

The QuickHit sample's ga_src sound engine didn't work when i put it into my game so i wrote my own mixing roughly based on it. But the principle is the same, feeding raw data to the audio buffer. And if the audio buffer doesn't start playing until it's filled (0.5 seconds of it) you have my problem.

Thanks

登陆并发表评论。