We are currently having some issues with iTunes library integration in our current project which uses FMod.
Basic problem: We’ve added the functionality of playing ipod music from the game menu, but when the user selects a song, it begins but our current menu music does not stop playing – here is some sample code from our programmer:
memset(&m_extradriverdata, 0, sizeof(FMOD_IPHONE_EXTRADRIVERDATA));
m_extradriverdata.sessionCategory = FMOD_IPHONE_SESSIONCATEGORY_AMBIENTSOUND;
m_extradriverdata.otherAudioPlaying = new bool;
result = m_pEventSoundSystem->init(numberOfChannels, FMOD_INIT_NORMAL | FMOD_INIT_ENABLE_PROFILE, &m_extradriverdata, FMOD_EVENT_INIT_NORMAL);
if ( m_extradriverdata.otherAudioPlaying && *(m_extradriverdata.otherAudioPlaying) )
Can anyone advise us on how to not be noobs?
- D. Ballard asked 7 years ago
More detailed information:
im using FMOD_IPHONE_SESSIONCATEGORY_AMBIENTSOUND
in my queries to the behind the scenes sound system,
which properly catches music playing for the general ipod on the device but doesnt seem to catch the music playing with this new ipod integration feature. trying to find out if one of the other SESSIONCATEGORIES will catch the new feature stuff
like maybe Media playback?
FMOD_IPHONE_SESSIONCATEGORY_DEFAULT, /* This will query the default for the device OS version */
FMOD_IPHONE_SESSIONCATEGORY_USERINTERFACESOUNDEFFECTS, /* kAudioSessionCategory_UserInterfaceSoundEffects */ FMOD_IPHONE_SESSIONCATEGORY_AMBIENTSOUND, /* kAudioSessionCategory_AmbientSound */ FMOD_IPHONE_SESSIONCATEGORY_SOLOAMBIENTSOUND, /* kAudioSessionCategory_SoloAmbientSound (iPhone OS >= 2.2 required) */ FMOD_IPHONE_SESSIONCATEGORY_MEDIAPLAYBACK, /* kAudioSessionCategory_MediaPlayback */ FMOD_IPHONE_SESSIONCATEGORY_LIVEAUDIO, /* kAudioSessionCategory_LiveAudio */ FMOD_IPHONE_SESSIONCATEGORY_FORCEINT = 65536 /* Makes sure this enum is signed 32bit */
- D. Ballard answered 7 years ago
Below is the updated session category descriptions as seen in newer versions of FMOD (note some categories were deprecated by Apple hence why there is less here):
FMOD_IPHONE_SESSIONCATEGORY_DEFAULT, /* Default for the device OS version (MediaPlayback for iPhone OS 2.0 to 2.1, SoloAmbientSound for iPhone OS 2.2 onwards) */
FMOD_IPHONE_SESSIONCATEGORY_AMBIENTSOUND, /* kAudioSessionCategory_AmbientSound ~ obeys slient switch, silent when locked, mixes with other audio */
FMOD_IPHONE_SESSIONCATEGORY_SOLOAMBIENTSOUND, /* kAudioSessionCategory_SoloAmbientSound (iPhone OS >= 2.2 required) ~ obeys slient switch, silent when locked, doesn’t mix with other audio */
FMOD_IPHONE_SESSIONCATEGORY_MEDIAPLAYBACK, /* kAudioSessionCategory_MediaPlayback ~ ignores slient switch, plays when locked, doesn’t mix with other audio */
FMOD_IPHONE_SESSIONCATEGORY_PLAYANDRECORD, /* kAudioSessionCategory_PlayAndRecord ~ ignores slient switch, plays when locked, doesn’t mix with other audio */
I haven’t played with the iPod playback features as yet, but if you have chosen "ambient sound" I would expect the iPod to play along with your game sounds. Since you are controlling when you play from the iPod, you could simply mute or pause or game music manually at that time. The "otherAudioPlaying" value is only relevant for if the iPod is playing before init time. If you wanted to query whether the iPod was playing at runtime (i.e. started some time after system::init) you would need to use one of the AudioSession API calls. Be aware though the iPod query API function has been buggy in the past, it may be fixed now but it used to get confused between FMOD and iPod, so after FMOD was init, it would say the iPod was playing.
Please login first to submit.