#include "BeatSequencePlayer.h" using namespace std; using namespace midi; int main() { Output out; out.openVirtualPort(); // wait for aconnect to link std::this_thread::sleep_for(std::chrono::seconds(1)); const int base = 54; BeatSequence s; s.resize(8); s[0].push_back(std::make_shared(0, base + 0 + 0, 127)); s[0].push_back(std::make_shared(0, base + 0 + 4, 127)); s[0].push_back(std::make_shared(0, base + 0 + 7, 127)); s[2].push_back(std::make_shared(0, base + 7 + 0, 127)); s[2].push_back(std::make_shared(0, base + 7 + 4, 127)); s[2].push_back(std::make_shared(0, base + 7 + 7, 127)); s[4].push_back(std::make_shared(0, base + 9 + 0, 127)); s[4].push_back(std::make_shared(0, base + 9 + 3, 127)); s[4].push_back(std::make_shared(0, base + 9 + 7, 127)); s[6].push_back(std::make_shared(0, base + 5 + 0, 127)); s[6].push_back(std::make_shared(0, base + 5 + 4, 127)); s[6].push_back(std::make_shared(0, base + 5 + 7, 127)); BeatSequencePlayer p(&out, &s); p.loop(); while(true) { BeatSequencePlayer::Bpm bpm; cin >> bpm; if(bpm == 0) { p.stop(); break; } p.setBpm(bpm); } return 0; }