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.

4 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.

1 Like

Another wish for this one… hoping soon :slight_smile:

one more +1 on this feature request! I agree that just a simple queryable value would be sufficient, similar to how we can ask for the battery level

+1 for this too, it’d allow some performance optimizations for CrankBoy if it can detect the system is muted

1 Like

In 3.1 we've added playdate.getSystemVolume() and pd->system->getVolume(), both of which return a value in the range 0-1. We're push the (hopefully) last beta tomorrow, then if all goes well we'll release it when James gets back into the office in a couple weeks. :crossed_fingers:

3 Likes