diff include/Midi.h @ 191:b3a306da03e0

Implemented Midi output
author Giulio Moro <giuliomoro@yahoo.it>
date Wed, 03 Feb 2016 01:18:30 +0000
parents 391ad036557d
children 265a527f8be8
line wrap: on
line diff
--- a/include/Midi.h	Tue Jan 26 00:02:15 2016 +0000
+++ b/include/Midi.h	Wed Feb 03 01:18:30 2016 +0000
@@ -30,7 +30,7 @@
 	int writeTo(int port);
 
 	/**
-	 * Get received midi byte, one at a time.
+	 * Get received midi bytes, one at a time.
 	 * @return  -1 if no new byte is available, -2 on error,
 	 * the oldest not yet retrieved midi byte otherwise
 	*/
@@ -49,21 +49,25 @@
 	 * @param length number of bytes to write
 	 * @return 1 on success, -1 on error
 	 */
-	int writeMidiOut(short unsigned int* bytes, unsigned int length);
+	int writeOutput(midi_byte_t* bytes, unsigned int length);
 
 	virtual ~Midi();
 	static void midiInputLoop();
+	static void midiOutputLoop();
     static bool staticConstructed;
 	static void staticConstructor();
 private:
 	void readInputLoop();
+	void writeOutputLoop();
 	int outputPort;
 	int inputPort;
 	std::vector<midi_byte_t> inputBytes;
 	unsigned int inputBytesWritePointer;
 	unsigned int inputBytesReadPointer;
 	std::vector<midi_byte_t> outputBytes;
-	static std::vector<Midi*> objAddrs;
+	unsigned int outputBytesWritePointer;
+	unsigned int outputBytesReadPointer;
+	static std::vector<Midi*> objAddrs[2];
 	static AuxiliaryTask midiInputTask;
 	static AuxiliaryTask midiOutputTask;
 };