I am adding sound to my GUI using the xtronical audio library. I intend to issue sounds from the code but I was wondering if there was any native support. Eg. how do I associate click sounds, etc to buttons?
What MCU/Processor/Board and compiler are you using?
Adding a callback function to every button is not the most ideal solution; it’s overly complex for developers to manage. Are there any alternative methods for incorporating sound into every button?
Not as far as I am aware. As for it being “overly complex” - have you considered making a function that allows you to pass a callback to play a certain sound on creation? Or perhaps have a standard “makeSound” function for every button and passing a sound along as data for this button… You will have to manually couple sound per button anyway.
Not sure if this exactly what you are after, but for your indev devices you can register on the feedback_cb, for example to vibrate on press. Maybe this can be used for sound too.
Maybe even possible in that callback to see what you pressed at (not sure) if it’s a button then do something.