Jamoma API  0.6.0.a19
MIDIDestination.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup modularMIDI
4  *
5  * @brief create an virtual MIDI destination
6  *
7  * @details MidiDestination receives messages from any external devices @n
8  * It is a wrapper around several plateform-specific 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_DESTINATION_H__
18 #define __MIDI_DESTINATION_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 MIDIDestination
28 {
29  MIDIPtr mProtocol; ///< The MIDI protocol object which manages all MIDI communications
30  TTBoolean mRunning; ///< should the destination receive message ?
31 
32 #if !defined(TT_PLATFORM_MAC)
33  TTPtr mClient; ///< TODO : a client handle to the Windows MIDI server
34  // TODO
35 #else
36  MIDIClientRef mClient; ///< a client handle to the Mac OS X Core MIDI server
37  MIDIEndpointRef mDestination; ///< a Mac OS X Core MIDI destination end point to receive messages
38 #endif
39 
40 public:
41 
42  TTSymbol mApplication; ///< the application name this destination handles
43  TTSymbol mName; ///< choosen device name
44 
45 #if !defined(TT_PLATFORM_MAC)
46  /** Windows system-specific constructor
47  @param protocol #MIDI protocol object pointer
48  @param application #TTSymbol application name to handle
49  @param name #TTSymbol name of the destination */
50  MIDIDestination(MIDIPtr protocol, TTSymbol& application, TTPtr client);
51 #else
52  /** Mac OS X system-specific constructor
53  @param protocol #MIDI protocol object pointer
54  @param application #TTSymbol application name to handle
55  @param client #MIDIClientRef to open a Mac OS X Core MIDI destination */
56  MIDIDestination(MIDIPtr protocol, TTSymbol& application, MIDIClientRef client);
57 #endif
58 
59  /** Destructor */
60  virtual ~MIDIDestination();
61 
62  /** Set device name
63  @param newName #TTSymbol for the MIDI destination device name to use
64  @return #TTErr error code if the device name is already used */
65  TTErr setName(TTSymbol& newName);
66 
67  /** Set running state
68  @param running #TTBoolean to enable disable message reception
69  @return #TTErr error code */
70  TTErr setRunning(TTBoolean running);
71 
72 #if !defined(TT_PLATFORM_MAC)
73  // TODO
74 #else
75  friend void TT_EXTENSION_EXPORT MIDIDestinationPacketReceivedCallback(const MIDIPacketList *data, void *baton, void *connectionInfo);
76 #endif
77 };
78 typedef MIDIDestination* MIDIDestinationPtr;
79 
80 #if !defined(TT_PLATFORM_MAC)
81 // TODO
82 #else
83 /** Mac OS X system-specific destiantion callback to receive messages
84  @param data the received MIDI packet
85  @param baton any informations passed by the owner
86  @param connectionInfo any informations relative to the connection
87  */
88 void TT_EXTENSION_EXPORT MIDIDestinationPacketReceivedCallback(const MIDIPacketList *data, void *baton, void *connectionInfo);
89 #endif
90 
91 #endif // __MIDI_DESTINATION_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 * TTPtr
A generic pointer.
Definition: TTBase.h:248
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.