19 #if !defined(TT_PLATFORM_MAC)
20 MIDIDestination::MIDIDestination(MIDIPtr protocol,
TTSymbol& application,
TTPtr client) :
23 mApplication(application)
28 MIDIDestination::MIDIDestination(MIDIPtr protocol,
TTSymbol& application, MIDIClientRef client) :
31 mApplication(application)
37 MIDIDestination::~MIDIDestination()
39 #if !defined(TT_PLATFORM_MAC)
42 MIDIEndpointDispose(mDestination);
48 if (newName != mName) {
55 #if !defined(TT_PLATFORM_MAC)
58 MIDIEndpointDispose(mDestination);
61 CFStringEncoding defaultEncoding = CFStringGetSystemEncoding();
64 CFStringRef s_name = CFStringCreateWithCString(kCFAllocatorDefault, mName.c_str(), defaultEncoding);
65 OSStatus status = MIDIDestinationCreate(mClient, s_name, &MIDIDestinationPacketReceivedCallback,
TTPtr(
this), &mDestination);
66 if (status != noErr) {
67 TTLogError(
"Could not create destination : %d\n", (
int)status);
78 if (running != mRunning) {
86 #if !defined(TT_PLATFORM_MAC)
89 void MIDIDestinationPacketReceivedCallback(
const MIDIPacketList *data,
void *baton,
void *connectionInfo)
91 MIDIPacket *packet = (MIDIPacket *) &data->packet[0];
92 MIDIDestination *
self = (MIDIDestination *)baton;
93 MIDIParserFrom parser;
98 for (
TTUInt32 packetIndex = 0; packetIndex < data->numPackets; packetIndex++) {
104 switch (packet->length) {
106 statusByte = packet->data[0];
111 statusByte = packet->data[0];
112 dataByte1 = packet->data[1];
116 statusByte = packet->data[0];
117 dataByte1 = packet->data[1];
118 dataByte2 = packet->data[2];
126 if (parser.parse(statusByte, dataByte1, dataByte2))
127 self->mProtocol->receivedMessage(self->mApplication, parser.address, parser.value);
129 packet = MIDIPacketNext(packet);
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
void * TTPtr
A generic pointer.
create an virtual MIDI destination
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
void TTFOUNDATION_EXPORT TTLogError(TTImmutableCString message,...)
Platform and host independent method for posting errors.
Something went wrong, but what exactly is not known. Typically used for context-specific problems...
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
std::uint32_t TTUInt32
32 bit unsigned integer
unsigned char TTUInt8
8 bit unsigned integer (char)