Quantcast
Channel: bugs, errors - openFrameworks
Viewing all articles
Browse latest Browse all 636

ofSetVolume() not working with float inputs

$
0
0

@Alex_Z wrote:

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:

ofApp:setup():

mySoundtrack.load("path/to/file.wav");
mySoundtrack.setLoop(true);
mySoundtrack.play();
mySoundtrack.setVolume(0.0);

ofApp::update():

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.

Thanks

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 636

Trending Articles