MIDIClientCreate fail
MIDIClientCreate fail
- Subject: MIDIClientCreate fail
- From: Ben <email@hidden>
- Date: Sun, 03 Feb 2013 05:20:27 +0000
(Sorry for the repost, I forgot to change the title)
Hi, I'm mighty confused by the following code. When I run this in one project it works fine, when I run it in another one it crashes.
Both projects appear identical in terms of frameworks CoreAudio, CoreFoundation, CoreMIDI, AudioToolbox, Both target iOS 6 iPad Simulator.
Though clearly something differs.
Fails with:
2013-02-03 04:53:59.229 Project[1398:c07] viewDidLoad
2013-02-03 04:53:59.896 Project[1398:c07] *** Assertion failure in -[BMAudio midiTest], /Users/me/Documents/sites/Project/Project/Project/BMAudio.m:63
2013-02-03 04:53:59.898 Project[1398:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'MIDIDestinationCreate failed. Error code: -10844 '§’ˇˇ''
*** First throw call stack:
(0x161012 0x1888e7e 0x160e78 0x131ef35 0xc298 0x2a50 0x8b1817 0x8b1882 0x80ad99 0x7d42a0 0x81b6b7 0x81b8c6 0x7d420b 0x7d42dd 0x7d446c 0x27a8 0x7cd7b7 0x7cdda7 0x7cefab 0x7e0315 0x7e124b 0x7d2cf8 0x206fdf9 0x206fad0 0xd6bf5 0xd6962 0x107bb6 0x106f44 0x106e1b 0x7ce7da 0x7d065c 0x26fd 0x2625)
libc++abi.dylib: terminate called throwing an exception
Any ideas?
The code....
The following code is instantiated within a view controller...
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"viewDidLoad" );
_bMAudio = [[BMAudio alloc]init];
[_bMAudio midiTest];
}
------------------------------------
#import "BMAudio.h"
@interface BMAudio ()
@end
@implementation BMAudio
- (id) init{
if (self = [super init]) {
}
return (self);
}
static void MyMIDIReadProc(const MIDIPacketList *pktlist,
void *refCon,
void *connRefCon) {
NSLog(@"test ");
}
void MyMIDINotifyProc (const MIDINotification *message, void *refCon) {
printf("MIDI Notify, messageId=%ld,", message->messageID);
}
-(void) midiTest {
OSStatus result = noErr;
// Create a client
MIDIClientRef virtualMidi;
result = MIDIClientCreate(CFSTR("Virtual Client"),
MyMIDINotifyProc,
NULL,
&virtualMidi);
NSAssert( result == noErr, @"MIDIClientCreate failed. Error code: %d '%.4s'", (int) result, (const char *)&result);
// Create an endpoint
MIDIEndpointRef virtualEndpoint;
result = MIDIDestinationCreate(virtualMidi, (CFStringRef)@"Virtual Destination", MyMIDIReadProc, (__bridge void *)(self), &virtualEndpoint);
NSAssert( result == noErr, @"MIDIDestinationCreate failed. Error code: %d '%.4s'", (int) result, (const char *)&result);
}
@end
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden