0
0

Hello –

I have a game that requires background music (MP3) be hardware decoded to maintain framerate.

I am using the following code when playing streams –

[code:2rti73u8]FMOD_AUDIOQUEUE_EXTRACODECDATA extradcodecdata;
memset(&extradcodecdata, 0, sizeof(FMOD_AUDIOQUEUE_EXTRACODECDATA));
extradcodecdata.codecPolicy = FMOD_AUDIOQUEUE_CODECPOLICY_HARDWAREONLY;

FMOD_CREATESOUNDEXINFO exinfo = {0};
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.extracodecdata = &extradcodecdata;

result = m_System->createStream(newStream->GetFileName().c_str(), FMOD_LOWMEM | FMOD_LOOP_NORMAL, &exinfo, &sound);
[/code:2rti73u8]
But I get the following error when I try to create the stream –
"Tried to use a feature that requires hardware support. (ie trying to play a VAG compressed sound in software on PS2). "

Anyone know what I’m doing wrong?

  • You must to post comments
0
0

If you want to auto select the hardware decoder just use suggestedsoundtype with FMOD_SOUND_TYPE_AUDIOQUEUE.

  • You must to post comments
0
0

When the iPod starts playing, the OS issues an interruption notification, which means we have to suspend all audio playback. The iPod will not relinquish that control of the audio back to FMOD, even if you stop playing the iPod. One thing you can do is force the iPod out and allow FMOD to play again using FMOD_IPhone_MixWithOtherAudio(false). It basically says we don’t want to mix with any other audio (i.e. iPod) and re-asserts the audio is controlled by FMOD (much like when you init FMOD while iPod music is playing).

  • You must to post comments
0
0

[quote="mathew":112ljb3g]If you want to auto select the hardware decoder just use suggestedsoundtype with FMOD_SOUND_TYPE_AUDIOQUEUE.[/quote:112ljb3g]

This works, and does improve load time somewhat, but it still takes quite a bit of time (1-5 seconds) in the createSound() call.

Is there anything else we can do to improve this further?

Thanks,

Ted

  • You must to post comments
0
0

basically as soon as ipod starts playing fmod does this…

FMOD: OutputCoreAudio::handleInterruption : Audio has been interrupted by an external event… stopping output.
FMOD: Thread::callback : * FMOD mixer thread finished
FMOD: Thread::close : FMOD mixer thread thread destroyed

it actually isn’t an issue in my case if in-game audio is muted when ipod is on. Whats more of an issue is re-enabling audio once ipod is disabled.

  • You must to post comments
0
0

If you are using createSound (opposed to createStream or the FMOD_CREATESTREAM flag) it will decode the whole file to PCM at that point which may take a while.

Otherwise, if you are using the FMOD_ACCURATETIME flag it will take a bit longer to create.

There is not much else you can do to make it load faster, if the blocking is a problem I would recommend you using FMOD_NONBLOCKING to have it load in a background thread.

  • You must to post comments
0
0

I’m also having this issue in a couple of different ways.

One is that as soon as the ipod music is playing no fmod sound effects occur, no errors are returned by fmod. This is a feature I’m sure used to work in previous fmod releases/ios releases.
The second way this error occurs is after I stop/release the ipod music any attempt to play a stream results in an internal fmod error.
FMOD: CodecAudioQueue::setPositionInternal : Cannot stop audio queue. (err: -50)
FMOD error! (33) An error occured that wasn’t supposed to. Contact support.

This is on iOS 4.1 with a 3rd gen ipod touch.

Michellevey did you ever get over this problem?

  • You must to post comments
0
0

Thanks for all your help.

It turns out I had taken the FMOD_CREATESTREAM flag off my createSound in all of my testing to get hardware working. :) Loading and playing is now working great.

Unfortunately, we still have one final issue to figure out.

We have a settings dialog in our game that allows the user to toggle between iPod and Game music. As soon as we play a song via MPMusicPlayerController I can no longer toggle back to Game Music, even after I have stopped and released the MPMusicPlayerController.

Have you heard of anything like this before?

Thanks again,
Michelle

  • You must to post comments
0
0

I also tried it with with the createSound API, just in case.
result = m_System->createSound(stream->GetFileName().c_str(), FMOD_LOWMEM | FMOD_LOOP_NORMAL, &exinfo, &sound);

Also, I forget to mention that this is an iOS application.

Thanks,
Michelle

  • You must to post comments
0
0

And what I mean by "no longer toggle back to Game Music" is that I createStream requesting hardware as described above and play it, nothing fails, but I do not hear the music playing.

It’s like once I create a MPMusicPlayerController object, I can not longer get access the the hardware decoder?

Michelle

  • You must to post comments
0
0

Sound like you are getting FMOD_ERR_NEEDS_HARDWARE. If you use the logging version of FMOD you should get some helpful text printed to the TTY.

The text you will most likely receive will be: "Hardware codec unavailable, (either audio session is prohibiting its use or iPod is playing)"

  • You must to post comments
0
0

I had been using libfmodex_reduced_iphoneos.a, so I linked with libfmodexL_reduced_iphoneos.a and it started working. I then linked with libfmodex_iphoneos.a and it continued to work. Is this not supported in the reduced lib?

There still something strange, even though my hardware decoded streams occasionally don’t play as is to be expected. They still appear to succeed when I check all the FMOD errors. Do you know what could be happening there?

Thanks,
Michelle

  • You must to post comments
0
0

There should be no problems with using hardware decoded streams in reduced mode, I have just tested it here and it appears to be working. Could you provide a way to reproduce the incorrect behavior you are seeing?

  • You must to post comments
0
0

This is part of a large library, so it would be hard to send a sample, but I’ve testing it a few times and it fails to play MP3’s HARDWAREONLY with the reduced lib. I’m using 4.33.

Now I have linked with the libfmodex_iphoneos.a and am using the above code. When I profile the application I still see FMOD::CodecMPEG::synth taking a bunch of the CPU. Sometimes as much as 10% as the sound begins to play.

Can you explain why I am seeing this perfomance drain from this method using MPEG’s decoding with hardware? Is that not an accurate read on what is going on?

Thanks,
Michelle

  • You must to post comments
0
0

To reproduce the problem I would recommend you start with one of the examples and add bits from your code incrementally. I have done the basic test of an example + mp3 playback + hardware only and it works, so perhaps it’s something else going on.

If you are seeing CPU usage coming from FMOD::CodecMPEG::synth then you aren’t using the hardware decoder, you are using the FMOD cross-platform software decoder. The iPhone native MPEG decoder is implemented via FMOD::CodecAudioQueue. Are you perhaps using suggested sound type? this will bypass the native AudioQueue codec.

  • You must to post comments
0
0

Actually yes, I was suggesting the MP3 sound type. I added that when I saw all the time it took to find out type during the load. I thought it would speed up loading. I have removed it and am no longer seeing the FMOD calls when I profile.

Is it slower to load files using hardware decoding? Is there anyway to improve this?

Thanks for all your help.

Michelle

  • You must to post comments
Showing 15 results
Your Answer

Please first to submit.