--- a/src/JackHandler.h Wed Sep 30 20:54:39 2020 +0200
+++ b/src/JackHandler.h Wed Sep 30 21:37:01 2020 +0200
@@ -96,6 +96,10 @@
int jackError = jack_activate(jackClient);
if (jackError) throw JackException(L"Could not activate client.");
+
+ // Wait for a port connection, because it does not make much sense to send MIDI events nowhere:
+ // TODO: configurable waiting?
+ while (jack_port_connected(jackPort) == 0) usleep(10000);
}
void startRelation(const relpipe::common::type::StringX name, std::vector<relpipe::reader::handlers::AttributeMetadata> attributes) override {
@@ -150,6 +154,7 @@
MidiMessage m;
jack_ringbuffer_read(ringBuffer, (char*) &m, sizeof (MidiMessage));
// TODO: send events from the ring buffer to JACK + correct timing
+ // FIXME: do not block here in the while loop; check frames
std::cout << "will process MidiMessage: " << &m << "" << std::endl; // TODO: remove debug message
}
pthread_cond_wait(&dataReady, &messageThreadLock);