summaryrefslogtreecommitdiffhomepage
path: root/main.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2025-01-03 18:36:05 +0100
committerRoland Reichwein <mail@reichwein.it>2025-01-03 18:36:05 +0100
commit1f1e71e0d9e1a60eac38040ea5e6a49c14d81b71 (patch)
treebb924a1605e66974de6fe8bfc890b0cda312aef3 /main.cpp
parent7d98b5d410233fd9608ed5682f5a98b283f83d12 (diff)
Added log
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/main.cpp b/main.cpp
index 4c33bc4..8fb4822 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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;