Addressing more than 2 speakers under IOS


(Mark Snyder) #1

I have an app that can use 4 speakers, where speakers 3 and 4 might sometimes be used for a metronome while stereo output is used for audio tracks. I know under IOS 7 and newer you can use multichannel class-compliant USB audio interfaces like Traktor Audio DJ Mk 2 and address 4 or more output channels. This is what I am trying to get working.

Under Windows and MacOS, I have this working like this (with my Traktor):

...

    Track::SoundSystem->setDriver(0);            //This will be the Traktor
    
    // Init the soundsystem first to get its preferred values
    result = Track::SoundSystem->init(100, FMOD_INIT_NORMAL, 0);
    
    // Ask for 4 hardware channels. Does not seem to do anything on any OS
    result = Track::SoundSystem->setHardwareChannels(4);
    
    // Get the preferred values
    Track::SoundSystem->getSoftwareFormat(&samplerate, &format,
                      &numoutputchannels, &maxinputchannels, &resamplemethod, &bits );
    
    // Close and reopen, asking for 4 output channels and using everything else that was set up by the first init
    Track::SoundSystem->close();
    Track::SoundSystem->setSoftwareFormat(samplerate, format, 4, maxinputchannels,
                      resamplemethod );
    
    Track::SoundSystem->init(100, FMOD_INIT_NORMAL, 0);
    ...
    SetSpeakerLevels, etc

On Windows and Mac, this code works and I get my 4 channel output. I use ASIO on WIndows, but I never need to specify it to FMOD.

On IOS, it all runs and I get good return codes, but I never hear channels 3 and 4 on my device.
Any ideas as to what I need to do to get the upper output channels to be heard on IOS?


(Brett Paterson) #2

Hi Mark,
FMOD in iOS doesnt support enumerating devices and would always return 1 for getNumDrivers.

You’re right that setHardwareChannels does nothing, because that is talking about voices (like a soundcard that has 32 3d hardware voices for example). A 4 channel output stream is not related to this.

We’d possibly have to add device enumeration to the iOS version which is not normally a thing. We’ll discuss it here.


(Brett Paterson) #3

it looks like it takes over the default device, so it might be a matter of the mixer not supporting 4ch mixing on ios


(Mark Snyder) #4

Yes device 0 is the Traktor once it hooks up. I believe that is correct. This device is the Mk 2 version specifically designed for IOS. Perhaps their app they sell runs directly on CoreAudio. My thinking was perhaps something in the FMOD IOS audio setup code was not anticipating that 4 channels would be available under IOS, as it is a fairly recent addition.


(Brett Paterson) #5

Yes FMOD for iOS is hardcoded (#ifdef’ed) to be stereo only to save code space etc, because only stereo is expected. On android it supports 5.1 etc, so we might be able to unlock it for iOS as well


(Mark Snyder) #6

Thanks for considering it. This is a key capability for thingas like multitrack know players, so if it is made available I am sure folks will find it useful.


(Brett Paterson) #7

we just got a Traktor by the way and are testing with it now


(Mark Snyder) #8

Did this ever get unlocked on IOS? I haven’t moved to FMOD 5 mainly because I was using the subsound API to do a metronome. Is FMOD 5 my best bet, or did you allow multichannels on version 4? Thanks


(Mark Snyder) #9

Did this ever get unlocked on IOS? I haven’t moved to FMOD 5 mainly because I was using the subsound API to do a metronome. Is FMOD 5 my best bet, or did you allow multichannels on version 4? Thanks


(リチャード清水) #10

Hi Mark,

You are able to use multichannel output on iOS by using the AudioSession API. Have a read of the “Multichannel Output” section of the iOS Getting Started doc.

https://fmod.com/resources/documentation-api?page=content/generated/platform_ios/basics.html

Thanks,
Richard