Skip to content

Unexpected default play volume on buses #381

@Cameramorphic

Description

@Cameramorphic

Expected behavior:

When setting a default volume on a SoLoud::AudioSource I'd expect it to be used (as documented) when creating an instance by calling myBus.play(mySound).

Actual behavior:

It always plays with volume 1.0f in the bus. When playing in root with soloud.play(mySound) it works as expected.

Steps to reproduce the problem:

SoLoud::Wav sfx;
sfx.load("my_sfx.wav");
sfx.setVolume(0.2f);

soloud.play(sfx); // plays at volume 0.2 (as expected)
sfxBus.play(sfx); // plays at volume 1.0
// to force expected behaviour e.g.:
sfxBus.play(sfx, -1);
sfxBus.play(sfx, sfx.mVolume);

Steps to fix the problem:

The issue is probably just the parameter defaults in the soloud_bus.h header, where play, playClocked, play3d and play3dClocked default to aVolume = 1.0f.
In the soloud.h header, play, playClocked and playBackground default to aVolume = -1.0f, but interestingly play3d and play3dClocked also default to aVolume = 1.0f.
Is this intended behaviour or a bug?

SoLoud version: 20200207

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions