OpenHarmony: system->playSound(...) return FMOD_OK but no sound


I’m using the Beta2 version for OpenHarmony, and there are no runtime exceptions. The result of system->playSound(…) is FMOD_OK, but no sound can be heard.
Does anyone have some clues ? Thanks very much!

Can you share the logging output from FMOD? There may be some clues as to what is going wrong.

Thanks for your quick reply and the important tip.

When I add the Debug_Initialize(), it returns FMOD_ERR_UNSUPPORTED. After I checked the document, I changed to, the sound started playing! —— but with noticeable lags.

Attached the logging output:

16:24:55.911   A0ff0d/fmod       I     FMOD_NAPI_RegisterCallback               : Registering FMOD module properties
16:24:56.961   A0ff0d/fmod       I     SystemI::setOutputInternal               : Setting output to 'FMOD OpenHarmony Audio Output'
16:24:56.961   A0ff0d/fmod       I     SystemI::init                            : Initialize version=20219 (121212), maxchannels=512, flags=0x00000000
16:24:57.134   A0ff0d/fmod       I     OHAudio_Init                             : Output buffer size: 60 samples, DSP buffer: 1024 * 4
16:24:57.137   A0ff0d/fmod       I     Thread::initThread                       : Init FMOD stream thread. Affinity: 0x4000000000000003, Priority: 0xFFFF7FFB, Stack Size: 98304, Semaphore: No, Sleep Time: 10, Looping: Yes.
16:24:57.138   A0ff0d/fmod       I     FMOD_OS_Thread_Callback                  : Cannot set real-time thread priorities due to insufficient privileges
16:24:57.144   A0ff0d/fmod       I     Thread::initThread                       : Init FMOD mixer thread. Affinity: 0x4000000000000001, Priority: 0xFFFF7FFA, Stack Size: 81920, Semaphore: Yes, Sleep Time: 0, Looping: Yes.
16:24:57.144   A0ff0d/fmod       I     FMOD_OS_Thread_Callback                  : Cannot set real-time thread priorities due to insufficient privileges
16:24:59.911   A0ff0d/fmod       I     ../../src/fmod_systemi_sound.cpp(615)    : [LOG] SystemI::createSoundInternal             : Create data=0x7af8100000, mode=0x0000088A
16:24:59.911   A0ff0d/fmod       I     ../../src/fmod_systemi_sound.cpp(625)    : [LOG] SystemI::createSoundInternal             : exinfo->cbsize             = 224
16:24:59.911   A0ff0d/fmod       I     ../../src/fmod_systemi_sound.cpp(629)    : [LOG] SystemI::createSoundInternal             : exinfo->length             = 819977
16:24:59.912   A0ff0d/fmod       I     ../../src/fmod_codec_fsb5.cpp(615)       : [LOG] FMOD_RESULT = 19 -- Unsupported file or audio format.
16:24:59.915   A0ff0d/fmod       I     ../../src/fmod_systemi_sound.cpp(1319)   : [LOG] SystemI::createSoundInternal             : Stream: name='(null)', format=2, channels=2, frequency=44100, lengthbytes=819977, lengthpcm=2241318, pcmblocksize=0, loopstart=0, loopend=0, mode=0x00000000, channelmask=0x00000000, channelorder=0, peakvolume=0.000000.

You should be able to reduce the latency by calling System::setDriver(1) before System::init. The default is “normal” latency, setting driver “1” activates “FAST” mode, however it is incompatible with some devices and can crash. OpenHarmony are aware of the issues but have not addressed them yet.

When you use the non-logging version of FMOD and you are getting no sound, there won’t be any FMOD logging, but are there any system errors printing to the log?

When I use the non-logging version, I don’t find any system errorr printed …

For the latency of the L version, thanks for your guide, I will have a try.

Can you send me a simple test project that demonstrates the release version of FMOD not working? Please ensure every FMOD function is checked for errors.

After I added the System::setDriver(1), it returned FMOD_ERR_INVALID_PARAM (31).

    result = m_FMODSystem->setDriver(1);
    LOGD("fmodSystem->setDriver(1) ret: %d", result);
    result = m_FMODSystem->init(...);

For the release version of FMOD, sorry for that I don’t have a simple project … There should be no problem with the usage of FMOD functions, it works fine on Android.

My apologies, that feature isn’t available in beta2.
Please email so we can arrange access to our latest release.

Thanks, I have sent the email .