franta-hg@0: /** franta-hg@0: * DJM-Fix franta-hg@0: * Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info) franta-hg@0: * franta-hg@0: * This program is free software: you can redistribute it and/or modify franta-hg@0: * it under the terms of the GNU General Public License as published by franta-hg@0: * the Free Software Foundation, version 3 of the License. franta-hg@0: * franta-hg@0: * This program is distributed in the hope that it will be useful, franta-hg@0: * but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@0: * GNU General Public License for more details. franta-hg@0: * franta-hg@0: * You should have received a copy of the GNU General Public License franta-hg@0: * along with this program. If not, see . franta-hg@0: */ franta-hg@0: franta-hg@1: #include franta-hg@1: #include franta-hg@2: #include franta-hg@2: #include franta-hg@2: #include franta-hg@5: #include franta-hg@1: franta-hg@1: #include "DJMFix.h" franta-hg@2: #include "AlsaBridge.h" franta-hg@2: franta-hg@5: static std::atomic run{true}; franta-hg@2: franta-hg@2: void interrupt(int signal) { franta-hg@2: run = false; franta-hg@2: std::cerr << "interrupt()" << std::endl; // TODO: do not mess STDIO franta-hg@2: } franta-hg@1: franta-hg@0: int main(int argc, char**argv) { franta-hg@5: std::string deviceName = argc == 2 ? argv[1] : "hw:1"; // FIXME: parse CLI options + automatic device search franta-hg@5: franta-hg@2: signal(SIGINT, interrupt); franta-hg@2: std::unique_ptr djmFix(djmfix::create()); franta-hg@5: std::unique_ptr alsaBridge(djmfix::alsa::create(djmFix.get(), deviceName)); franta-hg@1: franta-hg@2: alsaBridge->start(); franta-hg@2: while (run) std::this_thread::sleep_for(std::chrono::milliseconds(100)); franta-hg@2: alsaBridge->stop(); franta-hg@1: franta-hg@0: return 0; franta-hg@0: }