Hello, i’ve tested 6.0.0 and verified it is using it with some logging. I am also using the public 2.03.14 logging lib fmodPL_wasm.a
I updated simple_c to load a file instead (using the --preload-file command), copied the .a and .mp3 from the media folder into the same folder as the example.
em++ simple_c.cpp -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_RUNTIME_METHODS=ccall,cwrap,setValue,getValue -pthread -s ASYNCIFY=1 -s PTHREAD_POOL_SIZE=5 -I../inc fmodPL_wasm.a -o simple_c_pthreads.html --preload-file wave.mp3@/wave.mp3
The file load lets me use FMOD_NONBLOCKING and createStream to make it use 2 threads.
#if defined (__EMSCRIPTEN_MAJOR__)
printf("EMSDK = %d.%d.%d\n", __EMSCRIPTEN_MAJOR__, __EMSCRIPTEN_MINOR__, __EMSCRIPTEN_TINY__);
#else
printf("EMSDK = %d.%d.%d\n", __EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__);
#endif
// Optional. Set the window handle for FMOD internally.
EM_ASM({
console.log("Setting FMOD module window handle");
Module.window = window;
});
/*
Create a System object and initialize
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
// Optional. Setting DSP Buffer size can affect latency and stability. Older browsers may require larger buffer sizes than default.
result = system->setDSPBufferSize(2048, 2);
ERRCHECK(result);
result = system->init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
FILE *fp = fopen("wave.mp3", "rb");
fseek(fp, -1, SEEK_END);
int len = ftell(fp);
fseek(fp, 0, SEEK_SET);
char *buff = (char *)calloc(len, 1);
fread(buff, len, 1, fp);
fclose(fp);
FMOD_CREATESOUNDEXINFO exinfo = { 0 };
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.length = len;
FMOD::Sound *sound;
result = system->createStream(buff, FMOD_OPENMEMORY | FMOD_NONBLOCKING, &exinfo, &sound);
ERRCHECK(result);
Output shows 6.0.0 for the example with the original lib built with 3.1.67
(by the way because of non blocking the playSound call was moved into the main loop)
/*
Main loop
*/
do
{
FMOD_OPENSTATE openstate;
result = sound->getOpenState(&openstate, nullptr, nullptr, nullptr);
if (!channel && openstate == FMOD_OPENSTATE_READY)
{
result = system->playSound(sound, 0, false, &channel);
ERRCHECK(result);
}
Output:
EMSDK = 6.0.0
simple_c_pthreads.js:6152 Setting FMOD module window handle
simple_c_pthreads.js:4767 [LOG] FMOD_System_Create : Header version = 2.03.15. Current version = 2.03.14.
simple_c_pthreads.js:4767 [LOG] FMOD_OS_Init : Module.window = YES
simple_c_pthreads.js:4767 [LOG] SystemI::init : Initialize version=20314 (164239), maxchannels=32, flags=0x00000000
simple_c_pthreads.js:4767 [LOG] FMOD_OS_Output_GetDefault : FMOD_OS_Output_GetDefault
simple_c_pthreads.js:4767 [LOG] SystemI::setOutputInternal : Setting output to 'FMOD AudioWorklet Output'
simple_c_pthreads.js:4767 [LOG] OutputAudioWorklet::init::init : initializing with channels = 6, buffer length = 2048, output rate 48000.
simple_c_pthreads.js:4767 [LOG] OutputAudioWorklet::init::init : SharedArrayBuffer: Yes. Fast code path.
simple_c_pthreads.js:4767 [LOG] Thread::initThread : Init FMOD stream thread. Affinity: 0x4000000000000003, Priority: 0xFFFF7FFB, Stack Size: 98304, Semaphore: No, Sleep Time: 10, Looping: Yes.
simple_c_pthreads.js:4767 [LOG] SystemI::DSPCodecPoolRegister : register codec pool for pool type 0
simple_c_pthreads.js:4767 [LOG] SystemI::createSound : memory = 0x1c1800 : mode 00010880
simple_c_pthreads.js:4767 [LOG] SystemI::createSound : FMOD_NONBLOCKING specified. Putting into queue to be opened asynchronously!
simple_c_pthreads.js:4767 [LOG] AsyncThread::getAsyncThread : index = 0 / 1
simple_c_pthreads.js:4767 [LOG] Thread::initThread : Init FMOD nonblocking thread (0). Affinity: 0x4000000000000003, Priority: 0xFFFF7FFC, Stack Size: 114688, Semaphore: Yes, Sleep Time: 0, Looping: Yes.
simple_c_pthreads.js:4767 [LOG] AsyncThread::add : add sound to async queue : soundi = 0x1c1368, queue head = 0x1c167c, queue count = 0
simple_c_pthreads.js:4767 [LOG] AsyncThread::threadFunc : Starting Asynchronous operation on sound 0x1c1368
It appears you might be using source so if you want , write to support@fmod.com if you are using different build flags to the one on the public release?