Failed to create the audio driver

Issue #7 duplicate
juuk100 created an issue

Thank you for sharing a good source.

I use the cocos2d-x platform. I compiled it without problems.

I wrote the code as shown below with the sample source.

fluid_settings_t* settings;
fluid_synth_t* synth = NULL;
fluid_audio_driver_t* adriver = NULL;
int err = 0;
/* Create the settings object. This example uses the default
 * values for the settings. */
settings = new_fluid_settings();
if (settings == NULL) {
    log("Failed to create the settings\n");
    err = 2;
}

/* Create the synthesizer */
synth = new_fluid_synth(settings);
if (synth == NULL) {
    log("Failed to create the synthesizer\n");
    err = 3;
}
/* Load the soundfont */
std::string path = FileUtils::getInstance()->getWritablePath();
path.append("Grand_Piano.sf2");
if (fluid_synth_sfload(synth, path.c_str(), 1) == -1) {
    log("Failed to load the SoundFont\n");
    err = 4;
}
/* Create the audio driver. As soon as the audio driver is
 * created, the synthesizer can be played. */
adriver = new_fluid_audio_driver(settings, synth);
if (adriver == NULL) {
    log("Failed to create the audio driver\n");
    err = 5;
}
/* Play a note */
fluid_synth_noteon(synth, 0, 60, 100);

At run time, the following error occurs and no sound is heard.

-> Failed to create the audio driver

Tested on Android 4.4 devices and Android 7.0 tablet.

Please help me.

Comments (4)

  1. Log in to comment