samplePlayer:playAt(when, volume) permanently sets volume

In the following example:

landing_sound:setVolume(0.5)
landing_sound:playAt(0, 0.6)
print("landing_sound volume", landing_sound:getVolume())

I expect to see the value 0.5 printed. Instead, I get 0.6. Even after the sample finishes playing, the volume is not reset to 0.5.

I expected the playAt call to only affect the volume of that single playback. At no point in time to I expect to get 0.6 as a result from the getVolume() call

1 Like

I agree, looking at that usage I wouldn't expect playAt() there would change the volume setting. But I can't decide whether the sound would play at 60% volume and then return to 50%, or if it setVolume() would scale the playAt() volume--i.e., it'd be 0.5*0.6 = 30% volume. What's your take?

You might search for a similar case in the sdk for consistency, but my expectation at least would be an override rather that scaling factor. To playback at 30%, I'd expect to use landing_sound:playAt(0, landing_sound:getVolume()*0.6)