0
0

Hello,

I’ve been playing around with FMOD’s iPhone HW decoding codec with an iPod Touch 1G with iOS 3.1.1 along with an iPhone 3GS running 4.1GM. If you attempt to load more than one m4a file via createStream, it will barf with the following error.

[code:wu3x4n4b]FMOD: System::createSoundInternal : Seek stream to start
FMOD: CodecAudioQueue::setPositionInternal : Cannot start audio queue. (err: 1752656245)[/code:wu3x4n4b]

This signifies HWIU – Hardware in use. It is not properly detecting this and falling back to the SW codec. If you load one with the standard args and the other with the SW codec policy, it works fine.

In my previous experience with the iPhone AudioQueues, I found that with M4A files specifically, PreferHarware won’t switch to the software codec automatically. So my workaround was to test for the HWIU error and then switch to SW automatically.

[code:wu3x4n4b]
err = AudioQueueStart(_streamInfo.mQueue, NULL);
if (err)
{
if (err==1752656245) // For some reason, on M4A files, PreferHarware won’t switch to the software codec automatically, so we have to do it
{
// Setting the HW Codec Policy
AQHWPolicy=kAudioQueueHardwareCodecPolicy_PreferSoftware;
propertySize=sizeof(AQHWPolicy);
err = AudioQueueSetProperty(_streamInfo.mQueue, kAudioQueueProperty_HardwareCodecPolicy, &AQHWPolicy, propertySize);
if (err)
{
NSLog(@"Error kAudioQueueProperty_HardwareCodecPolicy: %d", err);
return nil;
}
err = AudioQueueStart(_streamInfo.mQueue, NULL);

            if (err)
            {
                NSLog(@"HWCodec: Error %d on AudioQueueStart failed", err);
                return nil;
            }
        }              
        else
        {
            NSLog(@"HWCodec: Error %d on AudioQueueStart failed", err);
            return nil;
        }
    }

[/code:wu3x4n4b]

This is with 4.32.01.

I haven’t tried the latest dev branch. Has it been fixed in that version?

  • George

PS: The docs could use some refreshing on the new codec policy arguments etc. Thanks![/code]

  • You must to post comments
0
0

Some more information. If I try to open an M4A file with SOFTWARE_ONLY, and then seek with:

[code:23x2751j]result=channel->setPosition(0,FMOD_TIMEUNIT_PCM);[/code:23x2751j]

I get the following error:

[code:23x2751j]FMOD: CodecAudioQueue::setPositionInternal : Cannot set codec policy. (err: -66678)
(33) An error occured that wasn’t supposed to. Contact support.
[/code:23x2751j]

Thanks ahead for your help.

  • George
  • You must to post comments
0
0

Thanks for the reports, I’ll look into these and get back to you.

BTW, are these problems happening on both your 3GS and your touch?

  • You must to post comments
0
0

Thanks Mathew,

Yes, these problems are happening both on the iPod Touch 1G and iPhone 3GS

  • You must to post comments
0
0

Okay, fixed and fixed, pending our next release.

And I will look into getting the docs updated too.

  • You must to post comments
0
0

Awesome. Great to hear. Thanks Mathew!

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.