Implement demo app
This commit is contained in:
46
src/main.cpp
Normal file
46
src/main.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "midiPlayer.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <pitches/all.h>
|
||||
#include <span>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std;
|
||||
//--------------------------------------------------------------
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
cout << "Playing melodies..." << endl;
|
||||
|
||||
// Prepare melodies look-up table
|
||||
unordered_map<string, std::span<const pitches::Note>> melodies = {
|
||||
{ "Amazing Grace", pitches::amazing_grace },
|
||||
{ "An die Freude (Ode a la joie)", pitches::an_die_freude },
|
||||
{ "Auld Lang Syne", pitches::auld_lang_syne },
|
||||
{ "Canon de Pachelbel", pitches::canon_pachelbel },
|
||||
{ "Au clair de la Lune", pitches::au_clair_lune },
|
||||
{ "Douce Nuit", pitches::douce_nuit },
|
||||
{ "Frere Jacques", pitches::frere_jacques },
|
||||
{ "Fur Elise", pitches::fur_elise },
|
||||
{ "God Save the Queen", pitches::god_save_the_queen },
|
||||
{ "Greensleeves", pitches::greensleeves },
|
||||
{ "Happy Birthday", pitches::happy_birthday },
|
||||
{ "Indiana Jones", pitches::indiana_jones },
|
||||
{ "Jingle Bells", pitches::jingle_bells },
|
||||
{ "Super Mario Theme", pitches::mario },
|
||||
{ "La Marseillaise", pitches::marseillaise },
|
||||
{ "Tetris", pitches::tetris },
|
||||
{ "Twinkle Twinkle", pitches::twinkle_twinkle },
|
||||
{ "Vive le Vent", pitches::vive_le_vent }
|
||||
};
|
||||
|
||||
// Play melodies
|
||||
const MidiPlayer player;
|
||||
for (const auto &[title, melody] : melodies)
|
||||
{
|
||||
cout << " Playing: " << title << endl;
|
||||
player.playBuffer(melody);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
Reference in New Issue
Block a user