comparison data/midi/rtmidi/RtMidi.cpp @ 563:a5e0d1068cae

* os/x build fixes
author Chris Cannam
date Mon, 23 Feb 2009 19:08:58 +0000
parents ecce042cc374
children 3086876472dc
comparison
equal deleted inserted replaced
562:ecce042cc374 563:a5e0d1068cae
313 313
314 void RtMidiIn :: initialize(std::string name) 314 void RtMidiIn :: initialize(std::string name)
315 { 315 {
316 // Set up our client. 316 // Set up our client.
317 MIDIClientRef client; 317 MIDIClientRef client;
318 OSStatus result = MIDIClientCreate( CFSTR(name.c_str()), NULL, NULL, &client ); 318 OSStatus result = MIDIClientCreate
319 ( CFStringCreateWithBytes(0, (unsigned char *)name.data(),
320 name.size(), kCFStringEncodingUTF8, 0), NULL, NULL, &client );
319 if ( result != noErr ) { 321 if ( result != noErr ) {
320 errorString_ = "RtMidiIn::initialize: error creating OS-X MIDI client object."; 322 errorString_ = "RtMidiIn::initialize: error creating OS-X MIDI client object.";
321 error( RtError::DRIVER_ERROR ); 323 error( RtError::DRIVER_ERROR );
322 } 324 }
323 325
350 error( RtError::INVALID_PARAMETER ); 352 error( RtError::INVALID_PARAMETER );
351 } 353 }
352 354
353 MIDIPortRef port; 355 MIDIPortRef port;
354 CoreMidiData *data = static_cast<CoreMidiData *> (apiData_); 356 CoreMidiData *data = static_cast<CoreMidiData *> (apiData_);
355 OSStatus result = MIDIInputPortCreate( data->client, CFSTR("RtMidi MIDI Input Port"), midiInputCallback, (void *)&inputData_, &port ); 357 OSStatus result = MIDIInputPortCreate( data->client, CFSTR("MIDI Input Port"), midiInputCallback, (void *)&inputData_, &port );
356 if ( result != noErr ) { 358 if ( result != noErr ) {
357 MIDIClientDispose( data->client ); 359 MIDIClientDispose( data->client );
358 errorString_ = "RtMidiIn::openPort: error creating OS-X MIDI input port."; 360 errorString_ = "RtMidiIn::openPort: error creating OS-X MIDI input port.";
359 error( RtError::DRIVER_ERROR ); 361 error( RtError::DRIVER_ERROR );
360 } 362 }
481 483
482 void RtMidiOut :: initialize(std::string name) 484 void RtMidiOut :: initialize(std::string name)
483 { 485 {
484 // Set up our client. 486 // Set up our client.
485 MIDIClientRef client; 487 MIDIClientRef client;
486 OSStatus result = MIDIClientCreate( CFSTR(name.c_str()), NULL, NULL, &client ); 488 OSStatus result = MIDIClientCreate
489 ( CFStringCreateWithBytes(0, (unsigned char *)name.data(),
490 name.size(), kCFStringEncodingUTF8, 0), NULL, NULL, &client );
487 if ( result != noErr ) { 491 if ( result != noErr ) {
488 errorString_ = "RtMidiOut::initialize: error creating OS-X MIDI client object."; 492 errorString_ = "RtMidiOut::initialize: error creating OS-X MIDI client object.";
489 error( RtError::DRIVER_ERROR ); 493 error( RtError::DRIVER_ERROR );
490 } 494 }
491 495
517 error( RtError::INVALID_PARAMETER ); 521 error( RtError::INVALID_PARAMETER );
518 } 522 }
519 523
520 MIDIPortRef port; 524 MIDIPortRef port;
521 CoreMidiData *data = static_cast<CoreMidiData *> (apiData_); 525 CoreMidiData *data = static_cast<CoreMidiData *> (apiData_);
522 OSStatus result = MIDIOutputPortCreate( data->client, CFSTR("RtMidi Virtual MIDI Output Port"), &port ); 526 OSStatus result = MIDIOutputPortCreate( data->client, CFSTR("Virtual MIDI Output Port"), &port );
523 if ( result != noErr ) { 527 if ( result != noErr ) {
524 MIDIClientDispose( data->client ); 528 MIDIClientDispose( data->client );
525 errorString_ = "RtMidiOut::openPort: error creating OS-X MIDI output port."; 529 errorString_ = "RtMidiOut::openPort: error creating OS-X MIDI output port.";
526 error( RtError::DRIVER_ERROR ); 530 error( RtError::DRIVER_ERROR );
527 } 531 }