Arduboy2 Audio Disable with Custom Library?

I had an idea of developing a custom Arduboy2 library that enhanced features. I wan’t to detect if the user holds B on boot, and then it will disable the audio.

I already tried audio.off() but it doesn’t work. Can we disable the pin itself?

EDIT: I discovered we can already do this with the Arduboy2 library. Though if a sound is played via another method, the audio will still play.

We need to disable the actual hardware of the audio device. Can we do this?

I’ll answer your question with another question:

Even if you disable the audio device itself, what stop another library re-enabling it?


(The existing library does disable the pins.)

1 Like

Ah, interesting…
It would be inefficient to continuously check for the bit and disable it, right?
I feel there has to be some sort of killswitch. A universal audio control could be very beneficial to users.

The way the current Arduboy2 library and the various sound libraries are set up already caters for this if the developer of the game respects the sound setting stored in the EEPROM. If you are finding games that do not honour this setting then you are better off complaining to the developer (or simply not playing their game!)

Doesn’t your approach assume the developer is using your library?

3 Likes

With the Arduboy2 library, holding B on boot is already the way to enable or disable audio, through the audio subclass.

See the Audio mute control subsection of the Start up features section in the Arduboy2 library documentation.

2 Likes