diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -4,6 +4,7 @@ #include "Timer.h" #include "UI.h" #include "config.h" +#include "log.h" #include <chrono> #include <cmath> @@ -32,6 +33,8 @@ int main(void) { try { //debug_cout.activate(); + log_cout.activate(); + log_cout.log_lines(log_lines); MIDI midi; ClickStream stream; @@ -40,19 +43,19 @@ int main(void) pcm.write(); - Timer timer_300ms(300ms, true); - timer_300ms.start(); + Timer timer_500ms(500ms, true); + timer_500ms.start(); // Main signals boost::signals2::signal<void()> signal_count_loops; // Signal-Slot Connections: midi.signal_click.connect([&](){stream.click();}); - timer_300ms.elapsed.connect([&](){ui.draw();}); + timer_500ms.elapsed.connect([&](){ui.draw();}); signal_count_loops.connect([&](){ui.count_main_loops();}); while (true) { - //std::cout << "Main loop entered." << std::endl; + debug_cout << "Main loop entered." << std::endl; signal_count_loops(); fd_set read_set; @@ -67,14 +70,14 @@ int main(void) #endif struct timeval timeout; - timeout.tv_sec = 1; - timeout.tv_usec = 300000; + timeout.tv_sec = 0; + timeout.tv_usec = 20000; int result = select(FD_SETSIZE, &read_set, nullptr/*&write_set*/, nullptr, &timeout); if (result < 0) { throw std::runtime_error("select() failed"); } else if (result == 0) { - std::cout << "select() timeout" << std::endl; + debug_cout << "select() timeout" << std::endl; } while (midi.event_ready()) @@ -91,7 +94,7 @@ int main(void) } // handle timers, TODO: make updates more efficient at scale - timer_300ms.update(); + timer_500ms.update(); } } catch (const std::exception& ex) { std::cerr << "Error: " << ex.what() << std::endl; |