diff options
author | Roland Reichwein <mail@reichwein.it> | 2025-01-11 14:59:22 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2025-01-11 14:59:22 +0100 |
commit | 445b696f43a9106f8871a67c077e990ce1ca14ab (patch) | |
tree | 4bcabf7a38db8cbd96cafc9452f84aa8ff4e11c3 /MIDI.cpp | |
parent | 0cb4b08d406caff8cd2081ddb09bceb74d4e3a16 (diff) |
Age out bpm data
Diffstat (limited to 'MIDI.cpp')
-rw-r--r-- | MIDI.cpp | 43 |
1 files changed, 24 insertions, 19 deletions
@@ -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() |