// 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).
The Gamebuino's 4 channel mixer allow to play up to 4 sound at the same time.<h2>Returns</h2>
<p>int8_t: track identifier on success or -1 on failure</p>
<h2>Example</h2>
<pre>
#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"); } }