-
Notifications
You must be signed in to change notification settings - Fork 312
Description
FluidSynth version
2.4.6 and some version
(From github release section)Describe the bug
Reload another font -> reload another font -> Reload another font -> Crashes.
I tested some openmp and some fluidsynth version
(From github release section)
reload succcess count matrix here.
fluidsynth-2.4.0-android24 ,omp27.2.12479018->only 1 count succecss, omp28.2.13676358->only 1, omp29.0.13113456->only 1
fluidsynth-2.3.7-android24 not tested
fluidsynth-2.4.3-android24 not tested
fluidsynth-2.4.4-android24 not tested
fluidsynth-2.4.5-android24,0time ok, 1time ok, 1time ok
fluidsynth-2.4.6-android24,1time ok,3time ok,1time ok
Expected behavior
Unload font and reload font with Android app success.
and few silence time (1 sec) ok (For safety calculation)
Steps to reproduce
call it twce or more.
while (true) {
int count = fluid_synth_sfcount(handle->synth);
if (count == 0) {
break;
}
fluid_sfont_t *font = fluid_synth_get_sfont(handle->synth, count - 1);
if (font == nullptr) {
break;
}
fluid_synth_remove_sfont(handle->synth, font);
}
handle->soundfont_id = fluid_synth_sfload(handle->synth, file.mb_str(), 0);
If this step have mistake, It is nice for me. I wish It is not bug.
But Just in Case , Writing this Issue. Thank you.
Additoinal information following.
Additional context
When I call this twice or more, I often crashes.
And, Can I write my App URL?
https://play.google.com/store/apps/details?id=org.star_advance.mixandcc&hl=ja
This app have a problem.
jint JNICALL jfluid_open(JNIEnv *env, jobject obj, jstring fontFile, jboolean lowlatency) {
int id = findEmptyId();
if (obj != nullptr && obj != _javaObj) {
_javaObj = obj;
}
if (id < 0) {
return id;
}
fluid_handle_t *handle = getFluid(id);
if (handle == nullptr) {
return -1;
}
if (handle->audio != nullptr) {
delete_fluid_audio_driver(handle->audio);
handle->audio = nullptr;
std::this_thread::sleep_for(std::chrono::milliseconds(400));
}
if (handle->settings == nullptr) {
handle->settings = new_fluid_settings();
fluid_settings_setstr(handle->settings, "synth.audio-driver", "oboe");
fluid_settings_setstr(handle->settings, "audio.oboe.sample-rate-conversion-quality", "Fastest");
if (lowlatency) {
fluid_settings_setstr(handle->settings, "audio.oboe.sharing-mode", "Exclusive");
fluid_settings_setint(handle->settings, "audio.periods", 4);
fluid_settings_setint(handle->settings, "audio.period-size", 64);
fluid_settings_setstr(handle->settings, "audio.oboe.performance-mode", "LowLatency");
} else {
fluid_settings_setstr(handle->settings, "audio.oboe.sharing-mode", "Shared");
fluid_settings_setint(handle->settings, "audio.periods", 16);
fluid_settings_setint(handle->settings, "audio.period-size", 64);
fluid_settings_setstr(handle->settings, "audio.oboe.performance-mode", "None");
}
fluid_settings_setint(handle->settings, "synth.audio-channels", 2);
fluid_settings_setint(handle->settings, "synth.cpu-cores", 4);
fluid_settings_setint(handle->settings, "synth.sample-rate", 48000);
}
if (handle->synth == nullptr) {
handle->synth = new_fluid_synth(handle->settings);
}
if (handle->synth == nullptr) {
//jfluid_close(env, obj, id);
return -1;
}
while (true) {
int count = fluid_synth_sfcount(handle->synth);
if (count == 0) {
break;
}
fluid_sfont_t *font = fluid_synth_get_sfont(handle->synth, count - 1);
if (font == nullptr) {
break;
}
fluid_synth_remove_sfont(handle->synth, font);
}
if (handle->soundfont_id >= 0) {
fluid_synth_sfunload(handle->synth, handle->soundfont_id, 0);
handle->soundfont_id = -1;
}
MBString file(env, fontFile);
if (fluid_is_soundfont(file.mb_str())) {
handle->soundfont_id = fluid_synth_sfload(handle->synth, file.mb_str(), 0);
} else {
return -1;
}
if (handle->soundfont_id == FLUID_FAILED) {
//jfluid_close(env, obj, id);
return -1;
}
if (handle->audio == nullptr) {
handle->audio = new_fluid_audio_driver(handle->settings, handle->synth);
initializeMod(handle);
}
return id;
}
Error log is it
2025-07-09 14:26:18.970 9871-9879 dvance.mixandcc org.star_advance.mixandcc I NativeAlloc concurrent mark compact GC freed 39MB AllocSpace bytes, 51(2116KB) LOS objects, 75% free, 11MB/46MB, paused 784us,5.609ms total 430.261ms
2025-07-09 14:26:19.271 9871-9952 libc org.star_advance.mixandcc A Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4e8 in tid 9952 (Thread-6), pid 9871 (dvance.mixandcc)
2025-07-09 14:26:19.456 9871-9871 Ads org.star_advance.mixandcc E JS: Uncaught TypeError: Cannot read properties of undefined (reading 'setRushSimulatedLocalEvents') (https://s0.2mdn.net/sadbundle/9194850363899531535/index.html?ev=01_253:401)
2025-07-09 14:26:19.457 9871-9871 chromium org.star_advance.mixandcc I [INFO:CONSOLE:401] "Uncaught TypeError: Cannot read properties of undefined (reading 'setRushSimulatedLocalEvents')", source: https://s0.2mdn.net/sadbundle/9194850363899531535/index.html?ev=01_253 (401)
2025-07-09 14:26:19.514 9871-9871 DynamiteModule org.star_advance.mixandcc I Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:250505301
2025-07-09 14:26:19.516 9871-9871 DynamiteModule org.star_advance.mixandcc I Selected remote version of com.google.android.gms.ads.dynamite, version >= 250505301
2025-07-09 14:26:19.944 10127-10127 DEBUG pid-10127 A Cmdline: org.star_advance.mixandcc
2025-07-09 14:26:19.944 10127-10127 DEBUG pid-10127 A pid: 9871, tid: 9952, name: Thread-6 >>> org.star_advance.mixandcc <<<
2025-07-09 14:26:19.945 10127-10127 DEBUG pid-10127 A #00 pc 000000000004c310 /data/app/~~VxbfId4L9kN_lQiNbZdu8w==/org.star_advance.mixandcc-sOXoNEtTqnGDTz0CInfiFw==/split_config.arm64_v8a.apk!libomp.so (BuildId: 108e35d3224dd18eadfe72c6b2c33f1400058b87)
2025-07-09 14:26:19.945 10127-10127 DEBUG pid-10127 A #01 pc 000000000009346c /data/app/~~VxbfId4L9kN_lQiNbZdu8w==/org.star_advance.mixandcc-sOXoNEtTqnGDTz0CInfiFw==/split_config.arm64_v8a.apk!libomp.so (BuildId: 108e35d3224dd18eadfe72c6b2c33f1400058b87)
2025-07-09 14:26:19.945 10127-10127 DEBUG pid-10127 A #02 pc 0000000000091ed4 /data/app/~~VxbfId4L9kN_lQiNbZdu8w==/org.star_advance.mixandcc-sOXoNEtTqnGDTz0CInfiFw==/split_config.arm64_v8a.apk!libomp.so (BuildId: 108e35d3224dd18eadfe72c6b2c33f1400058b87)
2025-07-09 14:26:19.945 10127-10127 DEBUG pid-10127 A #03 pc 000000000008c2c0 /data/app/~~VxbfId4L9kN_lQiNbZdu8w==/org.star_advance.mixandcc-sOXoNEtTqnGDTz0CInfiFw==/split_config.arm64_v8a.apk!libomp.so (BuildId: 108e35d3224dd18eadfe72c6b2c33f1400058b87)
2025-07-09 14:26:19.945 10127-10127 DEBUG pid-10127 A #04 pc 000000000008f634 /data/app/~~VxbfId4L9kN_lQiNbZdu8w==/org.star_advance.mixandcc-sOXoNEtTqnGDTz0CInfiFw==/split_config.arm64_v8a.apk!libomp.so (BuildId: 108e35d3224dd18eadfe72c6b2c33f1400058b87)
2025-07-09 14:26:19.945 10127-10127 DEBUG pid-10127 A #05 pc 000000000009bddc /data/app/~~VxbfId4L9kN_lQiNbZdu8w==/org.star_advance.mixandcc-sOXoNEtTqnGDTz0CInfiFw==/split_config.arm64_v8a.apk!libomp.so (BuildId: 108e35d3224dd18eadfe72c6b2c33f1400058b87)
2025-07-09 14:26:19.945 10127-10127 DEBUG pid-10127 A #06 pc 0000000000097368 /data/app/~~VxbfId4L9kN_lQiNbZdu8w==/org.star_advance.mixandcc-sOXoNEtTqnGDTz0CInfiFw==/split_config.arm64_v8a.apk!libomp.so (BuildId: 108e35d3224dd18eadfe72c6b2c33f1400058b87)
2025-07-09 14:26:19.945 10127-10127 DEBUG pid-10127 A #07 pc 0000000000095928 /data/app/~~VxbfId4L9kN_lQiNbZdu8w==/org.star_advance.mixandcc-sOXoNEtTqnGDTz0CInfiFw==/split_config.arm64_v8a.apk!libomp.so (BuildId: 108e35d3224dd18eadfe72c6b2c33f1400058b87)
2025-07-09 14:26:19.945 10127-10127 DEBUG pid-10127 A #08 pc 000000000005e188 /data/app/~~VxbfId4L9kN_lQiNbZdu8w==/org.star_advance.mixandcc-sOXoNEtTqnGDTz0CInfiFw==/split_config.arm64_v8a.apk!libomp.so (__kmpc_barrier+320) (BuildId: 108e35d3224dd18eadfe72c6b2c33f1400058b87)
2025-07-09 14:26:19.945 10127-10127 DEBUG pid-10127 A #09 pc 00000000000e644c /data/app/~~VxbfId4L9kN_lQiNbZdu8w==/org.star_advance.mixandcc-sOXoNEtTqnGDTz0CInfiFw==/split_config.arm64_v8a.apk!libomp.so (__kmp_invoke_microtask+156) (BuildId: 108e35d3224dd18eadfe72c6b2c33f1400058b87)
2025-07-09 14:26:19.974 9871-9918 dvance.mixandcc org.star_advance.mixandcc E No package ID 6a found for ID 0x6a0b000f.
2025-07-09 14:26:19.975 9871-9921 FA org.star_advance.mixandcc E Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI
2025-07-09 14:26:19.977 9871-10005 Ads org.star_advance.mixandcc I HTTP timeout: 60000 milliseconds.
2025-07-09 14:26:20.033 9871-9952 debuggerd org.star_advance.mixandcc I uid: 10384, dumpable: 1
---------------------------- PROCESS ENDED (9871) for package org.star_advance.mixandcc ----------------------------
and management handle (not working for now, need write it simple)
typedef struct {
fluid_settings_t *settings;
fluid_synth_t *synth;
fluid_audio_driver_t *audio;
int soundfont_id;
} __attribute__ ((aligned(32))) fluid_handle_t;
#define MAX_SYNTH 10
fluid_handle_t *_allHandle = nullptr;
int findEmptyId() {
if (_allHandle == nullptr) {
auto ptr = (unsigned long)malloc(sizeof(fluid_handle_t ) * MAX_SYNTH * 4); // can I get margin for overun
_allHandle = (fluid_handle_t *) (void *)(ptr + 16);
if (_allHandle == nullptr) {
return -1;
}
memset(_allHandle, 0, sizeof(fluid_handle_t) * MAX_SYNTH);
}
return 0;
/*
for (int i = 0; i < MAX_SYNTH; ++i) {
if (_allHandle[i].settings == nullptr) {
return i;
}
}
return -1;*/
}
fluid_handle_t *getFluid(int handle) {
if (handle < 0 || handle >= MAX_SYNTH) {
return nullptr;
}
fluid_handle_t *ptr = _allHandle + handle;
return ptr;
}