Jamoma API  0.6.0.a19
MIDISource.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup modularMIDI
4  *
5  * @brief create an virtual MIDI source
6  *
7  * @details MidiSource sends messages to 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_SOURCE_H__
18 #define __MIDI_SOURCE_H__
19 
20 #include "MIDIInclude.h"
21 #include "MIDI.h"
22 #include "MIDIParserTo.h"
23 
24 class MIDI;
25 typedef MIDI* MIDIPtr;
26 
27 class MIDISource
28 {
29  MIDIPtr mProtocol; ///< The MIDI protocol object which manages all MIDI communications
30  TTBoolean mRunning; ///< should the source send messages ?
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 mSource; ///< a Mac OS X Core MIDI source end point to send messages
38 #endif
39 
40 public:
41 
42  TTSymbol mApplication; ///< the application name this source 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 source */
50  MIDISource(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 source */
56  MIDISource(MIDIPtr protocol, TTSymbol& application, MIDIClientRef client);
57 #endif
58 
59  /** Destructor */
60  virtual ~MIDISource();
61 
62  /** Set device name
63  @param newName #TTSymbol for the MIDI source 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 midi message sending
69  @return #TTErr error code */
70  TTErr setRunning(TTBoolean running);
71 
72  /** Send MIDI message using an address and a value
73  @param address #TTAddress like /channel.N/command.M
74  @param value #TTValue
75  @return #TTErr error code */
76  TTErr sendMessage(TTAddress& address, const TTValue& value);
77 };
78 typedef MIDISource* MIDISourcePtr;
79 
80 #endif // __MIDI_SOURCE_H__
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
The TTAddress class is used to represent a string and efficiently pass and compare that string...
Definition: TTAddress.h:29
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
edit bytes from /channel.N/command.M TTAddress and a TTValue
Includes and definitions for the MIDI protocol for Jamoma Modular.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34