gb.sound.isPlaying

Description

bool gb.sound.isPlaying( int8_t trackIdentifier )

gb.sound.isPlaying returns true if the track identifier is playing

Parameters

  • int8_t trackIdentifier: track to check

Returns

bool: true if the track is playing, otherwise false

Example

#include <Gamebuino-Meta.h>

void setup() {
  gb.begin();
}

int8_t track = -1;

void loop() {
  if (gb.update()) {
    gb.display.clear();

    // check if the track is playing
    if (gb.sound.isPlaying(track)) {
      gb.display.println("Playing");
    }

    if (gb.buttons.pressed(BUTTON_A)) {
      track = gb.sound.playOK();
    }
  }
}