summaryrefslogtreecommitdiffhomepage
path: root/MIDI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'MIDI.cpp')
-rw-r--r--MIDI.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/MIDI.cpp b/MIDI.cpp
index 1e43a96..afcca28 100644
--- a/MIDI.cpp
+++ b/MIDI.cpp
@@ -21,25 +21,29 @@ MIDI::MIDI()
debug_cout << "in_port: " << std::to_string(in_port) << std::endl;
-#if 1
- snd_seq_addr_t sender, dest;
- snd_seq_port_subscribe_t *subs;
- sender.client = 24;
- sender.port = 0;
- dest.client = snd_seq_client_id(seq_handle);
- dest.port = in_port;
- snd_seq_port_subscribe_alloca(&subs);
- snd_seq_port_subscribe_set_sender(subs, &sender);
- snd_seq_port_subscribe_set_dest(subs, &dest);
- snd_seq_port_subscribe_set_queue(subs, 1);
- snd_seq_port_subscribe_set_time_update(subs, 1);
- snd_seq_port_subscribe_set_time_real(subs, 1);
- // TODO: fix timestamp (currently always 0)
- if (0 > snd_seq_subscribe_port(seq_handle, subs))
-#endif
- //if (0 > snd_seq_connect_from(seq_handle, in_port, 24, 0))
- {
- throw std::runtime_error("MIDI port couldn't be connected");
+ if (1) {
+ snd_seq_addr_t sender, dest;
+ snd_seq_port_subscribe_t *subs;
+ sender.client = 24;
+ sender.port = 0;
+ dest.client = snd_seq_client_id(seq_handle);
+ dest.port = in_port;
+ snd_seq_port_subscribe_alloca(&subs);
+ snd_seq_port_subscribe_set_sender(subs, &sender);
+ snd_seq_port_subscribe_set_dest(subs, &dest);
+ snd_seq_port_subscribe_set_queue(subs, 1);
+ snd_seq_port_subscribe_set_time_update(subs, 1);
+ snd_seq_port_subscribe_set_time_real(subs, 1);
+ // TODO: fix timestamp (currently always 0)
+ if (0 > snd_seq_subscribe_port(seq_handle, subs))
+ {
+ throw std::runtime_error("MIDI port couldn't be connected");
+ }
+ } else {
+ if (0 > snd_seq_connect_from(seq_handle, in_port, 24, 0))
+ {
+ throw std::runtime_error("MIDI port couldn't be connected");
+ }
}
npfd = snd_seq_poll_descriptors_count(seq_handle, POLLIN);
@@ -150,6 +154,7 @@ void MIDI::process(snd_seq_event_t *ev)
}
signal_count_events(snd_seq_event_length(ev));
+ //log_cout << fmt::format("MIDI Bytes: {}", snd_seq_event_length(ev)) << std::endl;
}
void MIDI::flush()