comparison 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
comparison
equal deleted inserted replaced
189:7144c5594d16 191:b3a306da03e0
28 * @return 1 on success, -1 on failure 28 * @return 1 on success, -1 on failure
29 */ 29 */
30 int writeTo(int port); 30 int writeTo(int port);
31 31
32 /** 32 /**
33 * Get received midi byte, one at a time. 33 * Get received midi bytes, one at a time.
34 * @return -1 if no new byte is available, -2 on error, 34 * @return -1 if no new byte is available, -2 on error,
35 * the oldest not yet retrieved midi byte otherwise 35 * the oldest not yet retrieved midi byte otherwise
36 */ 36 */
37 int getInput(); 37 int getInput();
38 38
47 * Writes Midi bytes to the output port 47 * Writes Midi bytes to the output port
48 * @param bytes an array of bytes to be written 48 * @param bytes an array of bytes to be written
49 * @param length number of bytes to write 49 * @param length number of bytes to write
50 * @return 1 on success, -1 on error 50 * @return 1 on success, -1 on error
51 */ 51 */
52 int writeMidiOut(short unsigned int* bytes, unsigned int length); 52 int writeOutput(midi_byte_t* bytes, unsigned int length);
53 53
54 virtual ~Midi(); 54 virtual ~Midi();
55 static void midiInputLoop(); 55 static void midiInputLoop();
56 static void midiOutputLoop();
56 static bool staticConstructed; 57 static bool staticConstructed;
57 static void staticConstructor(); 58 static void staticConstructor();
58 private: 59 private:
59 void readInputLoop(); 60 void readInputLoop();
61 void writeOutputLoop();
60 int outputPort; 62 int outputPort;
61 int inputPort; 63 int inputPort;
62 std::vector<midi_byte_t> inputBytes; 64 std::vector<midi_byte_t> inputBytes;
63 unsigned int inputBytesWritePointer; 65 unsigned int inputBytesWritePointer;
64 unsigned int inputBytesReadPointer; 66 unsigned int inputBytesReadPointer;
65 std::vector<midi_byte_t> outputBytes; 67 std::vector<midi_byte_t> outputBytes;
66 static std::vector<Midi*> objAddrs; 68 unsigned int outputBytesWritePointer;
69 unsigned int outputBytesReadPointer;
70 static std::vector<Midi*> objAddrs[2];
67 static AuxiliaryTask midiInputTask; 71 static AuxiliaryTask midiInputTask;
68 static AuxiliaryTask midiOutputTask; 72 static AuxiliaryTask midiOutputTask;
69 }; 73 };
70 74
71 75