Openframeworks: ofSoundPlayer crashes

Created on 22 Mar 2021  路  7Comments  路  Source: openframeworks/openFrameworks

This is my first time using openFrameworks. My project crashes ~5/7 times.

OF version: 0.11.1
Xcode version: 12.4

void ofApp::setup(){
sound.load("ping.wav");
sound.setMultiPlay(true);
}

void ofApp::playSound(){
if (a < 0) {
sound.play();
}
if (b > 1) {
sound.play();
}
}

Screen Shot 2021-03-22 at 1 33 01 PM

macOS

Most helpful comment

Hmm, actually nevermind.
I managed to trigger the crash when building in release and launching from the command line.
I think it is related to variables being initialized with no value.

Can you try changing these lines:
https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/sound/ofFmodSoundPlayer.h#L82-L83

To:

        FMOD_CHANNEL * channel = NULL;
        FMOD_SOUND * sound = NULL;

This seems to work for me.
Thanks!

All 7 comments

Hi,
Could you share the full code or at least where/how ofApp::playSound() is being called?

Thanks!!

@hellokitty-glitch
I think this might actually be a bug with the fmod dylib we used for 0.11.1
At the time it was a beta release with arm64 support and since then there is an official dylib that has come out which I don't see any of the issues with anymore .

Can you try replacing the libfmod.dylib in YOUR_OF_FOLDER/libs/fmod/lib/osx/libfmod.dylib with the one in this archive.
http://ci.openframeworks.cc/libs/fmod/fmod_osx.tar.bz2

If you don't get the issues anymore please let us know.

Thanks!
Theo

Hmm, actually nevermind.
I managed to trigger the crash when building in release and launching from the command line.
I think it is related to variables being initialized with no value.

Can you try changing these lines:
https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/sound/ofFmodSoundPlayer.h#L82-L83

To:

        FMOD_CHANNEL * channel = NULL;
        FMOD_SOUND * sound = NULL;

This seems to work for me.
Thanks!

Hi Theo!

Changing those lines worked for me! Thank you for the quick responses and help! :-)

Hey theo, I don't find those lines and I cant download the lib

@EmilianoAlba54
Can you try: https://openframeworks.cc/versions/v0.11.2/of_v0.11.2_osx_release.zip ?

That will have the fixes above in it.
Thanks!!

Thanks a lot Theo!!! all working great

Was this page helpful?
0 / 5 - 0 ratings