diff -r 001b956610ca -r e5f0d3f92eb4 src/JackCommand.h --- a/src/JackCommand.h Mon May 18 18:04:12 2020 +0200 +++ b/src/JackCommand.h Mon May 18 22:00:20 2020 +0200 @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -61,7 +62,7 @@ uint32_t size; uint32_t time; }; - + public: int enqueueMessage(jack_nframes_t frames) { @@ -137,9 +138,8 @@ continueProcessing = false; } - void processJackStream(ostream &output) { + void processJackStream(std::shared_ptr writer, std::function relationalWriterFlush) { // Relation headers: - std::shared_ptr writer(Factory::create(output)); vector metadata; metadata.push_back({L"event", TypeId::STRING}); metadata.push_back({L"channel", TypeId::INTEGER}); @@ -149,7 +149,7 @@ metadata.push_back({L"controller_id", TypeId::INTEGER}); metadata.push_back({L"controller_value", TypeId::INTEGER}); writer->startRelation(L"midi", metadata, true); - output.flush(); + relationalWriterFlush(); // Initialize JACK connection: std::string clientName = "relpipe-in-jack"; @@ -177,7 +177,7 @@ MidiMessage m; jack_ringbuffer_read(ringBuffer, (char*) &m, sizeof (MidiMessage)); processMessage(writer, &m); - output.flush(); + relationalWriterFlush(); } pthread_cond_wait(&dataReady, &messageThreadLock); }