aboutsummaryrefslogtreecommitdiffstats
path: root/daemon/src/main.cpp
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2025-07-23 14:05:13 +0200
committerEddy Pedroni <epedroni@pm.me>2025-07-23 14:05:13 +0200
commit41f95375a65a3f67a75258680d6d8b03bb4d678b (patch)
tree57a2ffafc6d9203fa1dde1249b2ec83110fff72e /daemon/src/main.cpp
parent29ca6bac4565d754a67414e503a215627d3aa566 (diff)
Working with hardcoded routing table
Diffstat (limited to 'daemon/src/main.cpp')
-rw-r--r--daemon/src/main.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/daemon/src/main.cpp b/daemon/src/main.cpp
index dc72433..008fd2a 100644
--- a/daemon/src/main.cpp
+++ b/daemon/src/main.cpp
@@ -1,5 +1,5 @@
#include "connection_manager.h"
-#include "configuration.h"
+#include "types.h"
#include "routing.h"
#include <iostream>
@@ -10,17 +10,29 @@ using namespace midi_router;
int main()
{
- Configuration const config {{
- {"Deluge MIDI 1", "deluge"},
- {"MPK mini Plus MIDI 1", "mpk"},
- }};
-
+ // LTG: move configuration to TOML file
+ Device_Map const devices {
+ { "Deluge MIDI 1", "deluge" },
+ { "MPK mini Plus MIDI 1", "mpk" },
+ { "Xjam MIDI 1", "xjam" },
+ { "OP-1 MIDI 1", "op1" },
+ };
+
Router router {};
- Connection_Manager cm { config.devices, [&](Message const & m){ router.submit(m); } }; // works
- //Connection_Manager cm { config.devices, std::bind(&Router::submit, &router, std::placeholders::_1) }; // why doesn't this work?
+ Connection_Manager cm { devices, router };
+
+ Route_Map const routes {
+ { "mpk",
+ {
+ { Message_Type::NOTE_ON, { cm.get_sender("deluge"), cm.get_sender("op1") } },
+ { Message_Type::NOTE_OFF, { cm.get_sender("deluge"), cm.get_sender("op1")} },
+ }
+ },
+ };
while(true)
{
- std::this_thread::sleep_for(std::chrono::seconds(1));
+ router.route(routes);
+ //std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
}