Jamoma API  0.6.0.a19
MIDIInput.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup modularMIDI
4  *
5  * @brief bind to an external device source
6  *
7  * @details MidiInput receives messages from one external device. @n
8  * It is a wrapper around the PortMidi library. @n
9  *
10  * @author Theo Delahogue
11  *
12  * @copyright © 2014, GMEA (http://www.gmea.net) @n
13  * This code is licensed under the terms of the "New BSD License" @n
14  * http://creativecommons.org/licenses/BSD/
15  */
16 
17 #ifndef __MIDI_INPUT_H__
18 #define __MIDI_INPUT_H__
19 
20 #include "MIDIInclude.h"
21 #include "MIDI.h"
22 #include "MIDIParserFrom.h"
23 
24 class MIDI;
25 typedef MIDI* MIDIPtr;
26 
27 class MIDIInput
28 {
29  MIDIPtr mProtocol; ///< The MIDI protocol object which manages all MIDI communications
30 
31  PortMidiStream* mStream; ///< a descriptor for a MIDI device that is opened when the device is set
32  TTThreadPtr mPollingThread; ///< our loop that constantly polls for new input
33  TTBoolean mRunning; ///< should the thread be running ?
34 
35 public:
36 
37  TTSymbol mApplication; ///< the application name this device handles
38  TTSymbol mName; ///< selected existing input name
39 
40  /** Constructor
41  @param protocol #MIDI protocol object pointer
42  @param application #TTSymbol application name to handle */
43  MIDIInput(MIDIPtr protocol, TTSymbol& application);
44 
45  /** Destructor */
46  virtual ~MIDIInput();
47 
48  /** Set device name
49  @param newName #TTSymbol for the MIDI device to select
50  @return #TTErr error code if the device name doesn't exist */
51  TTErr setName(TTSymbol& newName);
52 
53  /** Set running state
54  @param running #TTBoolean to enable disable polling thread
55  @return #TTErr error code */
56  TTErr setRunning(TTBoolean running);
57 
58  friend void* MIDIInputPoll(MIDIInput* self);
59 };
60 typedef MIDIInput* MIDIInputPtr;
61 
62 /** the function call by the polling thread
63  @param #MIDIInput pointer*/
64 void* MIDIInputPoll(MIDIInput* self);
65 
66 #endif // __MIDI_INPUT_H__
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
edit /channel.N/command.M TTAddress and a TTValue from incoming bytes
void * MIDIInputPoll(MIDIInput *self)
the function call by the polling thread
Definition: MIDIInput.cpp:105
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
the MIDI protocol for Jamoma Modular
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
Includes and definitions for the MIDI protocol for Jamoma Modular.