src/JackHandler.h
branchv_0
changeset 18 7a74e9f9e674
parent 17 0fcd9944016a
child 19 dcd98589f4b8
equal deleted inserted replaced
17:0fcd9944016a 18:7a74e9f9e674
   203 		while (jack_port_connected(realTimeContext.jackPort) < configuration.requiredJackConnections) usleep(10000);
   203 		while (jack_port_connected(realTimeContext.jackPort) < configuration.requiredJackConnections) usleep(10000);
   204 
   204 
   205 	}
   205 	}
   206 
   206 
   207 	void startRelation(const relpipe::common::type::StringX name, std::vector<relpipe::reader::handlers::AttributeMetadata> attributes) override {
   207 	void startRelation(const relpipe::common::type::StringX name, std::vector<relpipe::reader::handlers::AttributeMetadata> attributes) override {
   208 		// TODO: validate metadata and prepare attribute mappings (names and types are important, order does not matter)
       
   209 
       
   210 		relationContext = RelationContext();
   208 		relationContext = RelationContext();
   211 		relationContext.attributes = attributes;
   209 		relationContext.attributes = attributes;
   212 
   210 
   213 		// TODO: check also data types and skipt relation if important attributes are missing
       
   214 		// TODO: configurable relation name
   211 		// TODO: configurable relation name
   215 
   212 
   216 		if (!relationContext.hasAttribute(L"raw")) {
   213 		if (!relationContext.hasAttribute(L"raw")) {
   217 			relationContext.skip = true;
   214 			relationContext.skip = true;
   218 			fwprintf(stderr, L"Relation „%ls“ will be ignored because mandatory attribute „raw“ is missing.\n", name.c_str());
   215 			fwprintf(stderr, L"Relation „%ls“ will be ignored because mandatory attribute „raw“ is missing.\n", name.c_str());
   220 
   217 
   221 	}
   218 	}
   222 
   219 
   223 	void attribute(const relpipe::common::type::StringX& value) override {
   220 	void attribute(const relpipe::common::type::StringX& value) override {
   224 		if (relationContext.skip) return;
   221 		if (relationContext.skip) return;
   225 		// TODO: switch to RelationalReaderStringHandler
   222 		// TODO: switch to RelationalReaderValueHandler
   226 		// TODO: if (continueProcessing) {} ?
   223 		// TODO: if (continueProcessing) {} ?
   227 
   224 
   228 		RelationContext& rel = relationContext;
   225 		RelationContext& rel = relationContext;
   229 		RelationContext::RecordContext& rec = rel.recordContext;
   226 		RelationContext::RecordContext& rec = rel.recordContext;
   230 
   227 
   285 		}
   282 		}
   286 
   283 
   287 	}
   284 	}
   288 
   285 
   289 	void endOfPipe() {
   286 	void endOfPipe() {
   290 		// TODO: send optional (configurable) MIDI events
       
   291 
       
   292 		// Wait until the ring buffer is empty
   287 		// Wait until the ring buffer is empty
   293 		while (continueProcessing && jack_ringbuffer_read_space(realTimeContext.ringBuffer)) usleep(1000);
   288 		while (continueProcessing && jack_ringbuffer_read_space(realTimeContext.ringBuffer)) usleep(1000);
   294 		usleep(1000000);
   289 		usleep(1000000);
   295 		// TODO: better waiting (ringBuffer might be empty, but events have not been sent to JACK yet)
   290 		// TODO: better waiting (ringBuffer might be empty, but events have not been sent to JACK yet)
   296 		// TODO: optionally mute all; probably enabled by default
   291 		// TODO: optionally mute all; probably enabled by default