[Switch] I can't get FMOD to output 5.1

Hi,

I am having trouble getting the FMOD 2.07 (or earlier) Core API to output 5.1 audio on the Nintendo Switch. I’ve tried to contact FMOD via the support email but have received no response after a couple of days, so I’m trying here (but I can’t post any Nintendo SDK code due to confidentiality reasons, so this post is less detailed than my email).

I have verified that the SDEV is configured for 5.1 output mode, and have some sample code which I think should be allowing FMOD Core to initialise to 5.1 according to the docs, but it appears to be only outputting Stereo.

In SDEV DevMenu, Output Device is correctly showing AudioTVOutput (6) (the 6 is supposed to indicate 6 channel mode, and if I undock the SDEV or plug in headphones, the number changes to 2, so I think this is correct).

Here is our current initialisation code. This code block is prefixed with some Nintendo API code that logs out what the Nintendo SDK thinks the output mode should be:

FMOD_RESULT result = FMOD::System_Create( &s_fmodSystem );
DBGASSERT( result == FMOD_OK, "Could not create FMOD system!" );

int freq;
FMOD_SPEAKERMODE  speakerMode;
int numRawSpeakers;

// Get system default software mixer format
result = s_fmodSystem->getSoftwareFormat( &freq, &speakerMode, &numRawSpeakers );
DBGASSERT( result == FMOD_OK, "Could not get mixer sample rate!" );

// Adjust settings if needed, here.
speakerMode = FMOD_SPEAKERMODE_5POINT1;
result = s_fmodSystem->setSoftwareFormat( freq, speakerMode, numRawSpeakers );
DBGASSERT( result == FMOD_OK, "Could not set mixer sample rate!" );

// 128 virtual channels - if sounds unintentionally stop playing regularly, increase this value.
result = s_fmodSystem->init( MAX_SFX_VO_CHANNELS + MAX_MUSIC_CHANNELS, FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED, nullptr );
DBGASSERT( result == FMOD_OK, "Could not init FMOD system!" );

// get actual software mixing format
result = s_fmodSystem->getSoftwareFormat( &freq, &speakerMode, &numRawSpeakers );
DBGASSERT( result == FMOD_OK, "Could not get mixer sample rate!" );

const char* speakerModeNames[ FMOD_SPEAKERMODE_MAX ] =
{
  "FMOD_SPEAKERMODE_DEFAULT",
  "FMOD_SPEAKERMODE_RAW",
  "FMOD_SPEAKERMODE_MONO",
  "FMOD_SPEAKERMODE_STEREO",
  "FMOD_SPEAKERMODE_QUAD",
  "FMOD_SPEAKERMODE_SURROUND",
  "FMOD_SPEAKERMODE_5POINT1",
  "FMOD_SPEAKERMODE_7POINT1",
  "FMOD_SPEAKERMODE_7POINT1POINT4",
};

LOGD( "FMOD Software Mixer settings:" );
LOGD( STR( "  Freq: %dHz", freq ) );
LOGD( STR( "  Speaker mode: %s", speakerModeNames[ speakerMode ] ) );
LOGD( STR( "  Num Raw Speakers: %d", numRawSpeakers ) );

FMOD_OUTPUTTYPE outputType;
s_fmodSystem->getOutput( &outputType );

const char* outputTypeNames[ FMOD_OUTPUTTYPE_MAX ] =
{
  "FMOD_OUTPUTTYPE_AUTODETECT",
  "FMOD_OUTPUTTYPE_UNKNOWN",
  "FMOD_OUTPUTTYPE_NOSOUND",
  "FMOD_OUTPUTTYPE_WAVWRITER",
  "FMOD_OUTPUTTYPE_NOSOUND_NRT",
  "FMOD_OUTPUTTYPE_WAVWRITER_NRT",
  "FMOD_OUTPUTTYPE_WASAPI",
  "FMOD_OUTPUTTYPE_ASIO",
  "FMOD_OUTPUTTYPE_PULSEAUDIO",
  "FMOD_OUTPUTTYPE_ALSA",
  "FMOD_OUTPUTTYPE_COREAUDIO",
  "FMOD_OUTPUTTYPE_AUDIOTRACK",
  "FMOD_OUTPUTTYPE_OPENSL",
  "FMOD_OUTPUTTYPE_AUDIOOUT",
  "FMOD_OUTPUTTYPE_AUDIO3D",
  "FMOD_OUTPUTTYPE_WEBAUDIO",
  "FMOD_OUTPUTTYPE_NNAUDIO",
  "FMOD_OUTPUTTYPE_WINSONIC",
  "FMOD_OUTPUTTYPE_AAUDIO"
};
LOGD( STR( "  OutputType: %s\n", outputTypeNames[ outputType ] ) );

int activeDriver = 0;
s_fmodSystem->getDriver( &activeDriver );
LOGD( "FMOD Output Drivers:" );
int numDrivers = 0;
s_fmodSystem->getNumDrivers( &numDrivers );
for( int i = 0; i < numDrivers; ++i )
{
  char driverName[ 512 ];
  s_fmodSystem->getDriverInfo( i, driverName, 512, nullptr, &freq, &speakerMode, &numRawSpeakers );
  LOGD( STR( " %s%s", i == activeDriver ? ">" : " ", driverName ) );
  LOGD( STR( "    Freq: %dHz", freq ) );
  LOGD( STR( "    Speaker mode: %s", speakerModeNames[ speakerMode ] ) );
  LOGD( STR( "    Num Raw Speakers: %d\n", numRawSpeakers ) );
}

And here’s the output log from this code:

NX AudioDeviceList:
[ 0] AudioStereoJackOutput
[ 1] AudioBuiltInSpeakerOutput
A>[ 2] AudioTvOutput (Output Channels: 6)
[ 3] AudioUsbDeviceOutput

FMOD Software Mixer settings:
Freq: 48000Hz
Speaker mode: FMOD_SPEAKERMODE_5POINT1
Num Raw Speakers: 6
OutputType: FMOD_OUTPUTTYPE_NNAUDIO

FMOD Output Drivers:

Default
Freq: 48000Hz
Speaker mode: FMOD_SPEAKERMODE_STEREO
Num Raw Speakers: 2

Could anyone please point out something we’ve missed about getting FMOD to automatically detect and use the appropriate output mode on the Switch?

Thanks.

FMOD Support let me know that there’s a bug with getDriverInfo that makes it always report Stereo.

I just tested with some 5.1 speakers hooked up to the SDEV and sound correctly output using 5.1 with this example code.