YMZ294 Player. modified from "Yamaguchi's YMZ294 Library" for LPC1114.

Dependencies:   mbed

main.cpp

Committer:
kohacraft
Date:
2015-12-09
Revision:
0:7a56bf0441ea

File content as of revision 0:7a56bf0441ea:

#include "Player.h"

// pin asign D0,D1,D2,D3,D4,D5,D6,D7,CS,WR,A0
YMZ294 soundGen(dp13, dp14, dp15, dp16, dp17, dp18, dp24, dp25, dp26, dp27, dp28);


char *choucho = 
 "G4q E4q E4h     | F4q D4q D4h     | C4q D4q E4q F4q | G4q G4q G4h |\
  G4q E4q E4q E4q | F4q D4q D4q D4q | C4q E4q G4q G4q | E4q E4q E4h |\
  D4q D4q D4q D4q | D4q E4q F4h     | E4q E4q E4q E4q | E4q F4q G4h |\
  G4q E4q E4q E4q | F4q D4q D4q D4q | C4q E4q G4q G4q | E4q E4q E4h";

enum {PIANO = 0, UWA = 14, SANBA = 14, ORGAN = 13};
enum {PIANO_FREQ = 16384, UWA_FREQ = 5120, SANBA_FREQ = 1000, ORGAN_FREQ = 128};

Player player(choucho);

int main() {
    player.rewind();
    player.play(soundGen, UWA_FREQ, UWA, 120);
    wait(1);
    player.rewind();
    player.play(soundGen, PIANO_FREQ, PIANO, 120);
    wait(1);
    player.rewind();
    player.play(soundGen, SANBA_FREQ, SANBA, 120);
    wait(1);
}