Query system master volume?

Is there a method of getting the system/master volume?

In my particular use case, I have a game where there are mini cutscenes that play, which are just elaborate coroutines. In them, there might be a sound that plays, which - when finished - triggers the next thing to happen.

However, if the player has volume off, this feels weird because it appears as though the game just pauses for a couple seconds before continuing.

I'd like to be able to skip playing the audio all-together if the system/master volume is off.

Otherwise I'm implementing a "closed captioning" system for audio sounds just to show something like "[door unlocks]" while the sound it playing in the background.

2 Likes

Great idea, your explanation makes perfect sense. I'll file it--and add it soon, most likely, since it's a pretty simple addition

3 Likes

..Though I can think of ways to make it more complicated. :laughing: Like, should sound player finished notifications call back immediately if the volume is set to zero? Probably not, I can imagine that breaking existing code..

2 Likes

should sound player finished notifications call back immediately if the volume is set to zero?

That should be a game-level decision. For myself, I would just wrap the play code:

if playdate.getSystemVolume() > 0 then
    sound:playAndWait()
end

In the meantime, my CC system is working just fine. :smirk:

5 Likes

+1 for this. I would love to display the system volume on my music player.