Play no sound after Record in Device using SpeakHere, but ok in simulator
Hi guys,
My app is recording mic input as a wav file using AudioQueue code in SpeakHere, and play it after the record finished. The problem is that in simulator the sound file could be played successfully after record, but when running in device, when play the sound file after record, there is no sound, even I play another file not record file, and there is no error message when I debug. I must exit the app, and launch it again, then the last time's record file could be played with sound.
It seems the record process blocked the output of sound, but why in simulator it could work and no work in device?
The record functions is used SpeakHere's AudioSession and AudioQueue code, and the play part cannot play sound using SystemSound and OpenAL and SoundEngine except using AudioSession as SpeakHere did.
The two scenario are following:
1. Enter the app, record a new file, it could play sound. Record again, there is no sound play.
2. Or enter the app, play a sound of former record file, then record a new file, after that there is no sound play.
Did you ever figure out the answer? I'm having the same problem. If I record a sound using Audio Queues, then try to play it back using OpenAL, it works in simulator, but I get no sound on the device, and the playback never appears to complete (AL_PLAYING always returned). I've set breakpoints and the soundfile appears to load properly, looks like there's valid data, no errors on anything.
Also note that the sound plays back using Audio Queues just fine, and if I exit the app and then re-launch, the sound plays in OpenAL as well. But as soon as I record another sound, OpenAL playback stops working again.
If you don't need the UVMeter, and your target OS is 2.2.1, then I suggest you to use AVAudioPlayer.
Thanks for replying. Problem is, I'm using OpenAL to alter the pitch during playback, so I kinda have to stick with OpenAL, unless I implement my own FFT, which I'm trying to avoid. And unfortunately, it looks like iPhone doesn't support OpenAL Capture, so I have to use Audio Queues to record.
If you don't need the UVMeter, and your target OS is 2.2.1, then I suggest you to use AVAudioPlayer.
Not fortunately, my app's target OS is 2.0, so I can't use AVAudioPlayer. Thanks for your reply.
I solved the problem by add a callback based on AudioQueue's Player example, in which I set a count to check loop playing of the sound file.