Help with gb.sound?

By Party_Pete, 1 year ago

Hello Gamebuinians! I'm having a problem with sound on the gamebuino, where if I use the below code segment, gb.sound.playTick() will execute multiple times for up to a second after a button is released, when it's only tied to a gb.buttons.pressed() conditional. I've also had problems with menu sounds repeating themselves indefinitely after being pressed, or until the button is pressed again. Thanks to whoever can shed some light on this issue!

#include <Gamebuino-Meta.h>

class Manager { public: void doSomething(); };

void Manager::doSomething(){ gb.sound.playTick(); }

const char* mainMenuEntries[] = { "Story Mode", };

void setup() { gb.begin(); gb.display.setTextWrap(true); gb.gui.menu("Super Buino Ware",mainMenuEntries); }

void loop() {

Manager helper; //intro screen while(!gb.update()); gb.display.clear();

gb.display.setColor(DARKBLUE); gb.display.fillRoundRect(0, 0, gb.display.width(), gb.display.height(), 6); gb.display.setColor(WHITE); gb.display.println("Welcome to Super Buino Ware! You are in a game show set in a 10 floor tower! Each floor has a challenge to win! You lose if you fail two! Get to the top of the tower to win $1000000!");

if (gb.buttons.pressed(BUTTON_A)) { helper.doSomething(); } }