ofSetVolume() not working with float inputs

Hey there,

I seem to be having trouble with ofSetVolume() on an ofSoundPlayer instance. It is only working for zero, or else seems to be playing any other fractional value between 0 and 1 at full volume.

Following are the snippets I am including in my setup and update functions:




if (mySoundtrack.getVolume() < 1.0f) {
    cout << mySoundtrack.getVolume() << endl;
    float fadeInTime = 20.0 * 1000.0;
    mySoundtrack.setVolume(MIN(1.0f, float(ofGetElapsedTimeMillis()) / fadeInTime));

The logs are showing that getVolume() has the correct values (gradually increasing values between 0 and 1), but the volume isn’t changing.


On which OS (and OF version) is this?
On OSX of_v0.11.0 this works:

beats.setVolume((ofGetFrameNum() % 60) / 60.);
cout << (ofGetFrameNum() % 60) / 60. << endl;

I’m using OF version 0.10.1-stable, on macOS Catalina


I’m on Catalina (10.15.7) as well.
I have OF 0.10.1 on my laptop, but I’m having some XCode signing issues at the moment :frowning:
I tried your code as well of 0.11.0 which works
I’ll try to fix this XCode stuff and see if it works on 0.10.1 as well

To be able to compile of_v0.10.1 with XCode 12.1 I had to replace of_v0.10.1_osx_release/libs/fmodex/lib/osx/libfmodex.dylib with the one found in of_v0.11.0 (see the link in my previous post).
After this XCode doesn’t complain and the soundPlayer-example compiles, and the setVolume() works.

But I just replace libfmodex.dylib which has to do with audio I think…
fmodex.dll is a file that is provided with the game. (It’s part of Firelight’s FMOD audio library, which the game uses” from this forum
So basicly I think this invalidates my testing, since I replaced a lib that has to do with audio.
My best bet would be: try to compile your project on of_v0.11.0 if that’s an option.

Thanks for the help, I’ll give that a try and see if it works