// wav file: int8_t gb.sound.play( [const] char* filename [, bool loop = false] ) // pattern: int8_t gb.sound.play( [const] uint16_t* pattern [, bool loop = false] ) // raw buffer: int8_t gb.sound.play( [const] uint8_t* buffer [, uint32_t length] [, bool loop = false] ) // custom handler: int8_t gb.sound.play( Sound_Handler* handler [, bool loop = false] )
gb.sound.play will start playing sound from various sources. They return a track identifier or -1 if failed (no available channel).
int8_t: track identifier on success or -1 on failure
#include <Gamebuino-Meta.h>void setup() { gb.begin(); }
void loop() { while(!gb.update()); if (gb.buttons.pressed(BUTTON_A)) { // let's play TEST.WAV from the sd card! gb.sound.play("TEST.WAV"); } }