diff options
author | Roland Reichwein <mail@reichwein.it> | 2025-01-03 17:31:21 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2025-01-03 17:31:21 +0100 |
commit | 7d98b5d410233fd9608ed5682f5a98b283f83d12 (patch) | |
tree | 8e3f24c126ffc4494a8b07ba48906e0ed97bc409 /main.cpp | |
parent | 9de0b7f8937b7f6ce990132609f0b26851b31f2b (diff) |
Diagnostics
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -43,32 +43,41 @@ int main(void) Timer timer_300ms(300ms, true); timer_300ms.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();}); + signal_count_loops.connect([&](){ui.count_main_loops();}); while (true) { //std::cout << "Main loop entered." << std::endl; + signal_count_loops(); + fd_set read_set; FD_ZERO(&read_set); FD_SET(midi.fd(), &read_set); +#if 0 + // PCM fd almost always writeable: for single frames at high speed fd_set write_set; FD_ZERO(&write_set); FD_SET(pcm.fd(), &write_set); +#endif struct timeval timeout; - timeout.tv_sec = 0; + timeout.tv_sec = 1; timeout.tv_usec = 300000; - int result = select(FD_SETSIZE, &read_set, &write_set, NULL, &timeout); + 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) { - throw std::runtime_error("select() timeout"); + std::cout << "select() timeout" << std::endl; } - if (midi.event_ready()) + while (midi.event_ready()) { //std::cout << "read..." << std::endl; auto event = midi.read(); |