I’m trying to get an application running on a Unix (Ubuntu) system. I’m running into an issue when calling System->Init(). My startup code is below. I’ve tried forcing with each driver on my system (I’ve got 3) and get the same result each time. Changing FMOD_SPEAKERMODE_RAW to FMOD_SPEAKERMODE_DEFAULT or STEREO in the setSoftwareFormat() call yields a FMOD_OK result.
Any help would be appreciated.
void StartFmod()
{
FMOD_RESULT result;
result = FMOD::System_Create(&mSystem);
ERRCHECK(result);
result = mSystem->getDriver(&nCurrentDriver);
ERRCHECK(result);
// it's possible to decide to set a different driver between the last
// line of code and this line
// Have posted simplified code for support purposes
result = mSystem->setDriver(nCurrentDriver);
ERRCHECK(result);
FMOD_SPEAKERMODE speakerMode = FMOD_SPEAKERMODE::FMOD_SPEAKERMODE_MONO;
int speakerModeChannels;
int sampleRate;
char* name;
result = mSystem->getDriverInfo(nCurrentDriver, name, 50, 0, &sampleRate, &speakerMode, &speakerModeChannels);
ERRCHECK(result);
mSystem->setSoftwareFormat(sampleRate, FMOD_SPEAKERMODE_RAW, speakerModeChannels);
FMOD_INITFLAGS flags = FMOD_INIT_NORMAL;
result = mSystem->init(32, flags, 0);
ERRCHECK(result);
}
I’ve made a distributed stereo / music playback system for a physical location. EG I have a house with 5 rooms and want to be able to control playback of any audio source to any combination of rooms.
Without further information of your goal, my recommendation would be to remove the code that explicitly sets the speakers mode or choose a particular speaker mode you want to design your application / game for.
FMOD will handle up/down mixing as necessary depending on the hardware on each device.