gb.sound.fx
Description
void gb.sound.fx( const Sound_FX * const fx )
gb.sound.fx will start playing a specified sound effect. As it does so, if another sound effect is currently playing that one is stopped. Sound effects do not use up a channel for playing normal audio. The data itself can easily be created using this tool.
If you want to know more about what a sound_FX is composed of, check out this tutorial.
Parameters
- const Sound_FX * const fx: pointer to the sound pattern to play
Returns
none
Example
#include <Gamebuino-Meta.h>// define your sound effect const Gamebuino_Meta::Sound_FX my_sfx[] = { {Gamebuino_Meta::Sound_FX_Wave::NOISE,1,70,0,0,240,1}, {Gamebuino_Meta::Sound_FX_Wave::SQUARE,1,0,0,-3,50,5}, {Gamebuino_Meta::Sound_FX_Wave::NOISE,0,70,0,0,224,1}, };
void setup() { gb.begin(); }
void loop() { while(!gb.update());
if (gb.buttons.pressed(BUTTON_A)) { // play the sound effect gb.sound.fx(my_sfx); } }