Jump to content

Cocoa/Objective C MIDI/Serial Communication


Recommended Posts

Hi,

at the risk of being a bit off-topic:

I want to program a driver for a MIDIBox project in Cocoa/Objective C/Xcode. Since some of you are using that as well: Do you have any tips for good classes that provide Core Midi and Serial Port functionality?

Thanks,

ALEXander.

Link to comment
Share on other sites

Ok I'll gather it up when I get home.  The application finds a connected Waldorf XT then requests all the patches from it so that it can extract the patch names, and hopefully someday it'll write them out to a file in the format that logic uses so that my logic environment objects can have all the real current patch names.  I've always wanted to take this application way further, but it rarely comes up very high on my list of things to do :-)

It current does succeed at receiving all of the patches and remember it's window settings.

Link to comment
Share on other sites

I just wanted to let you know that I'm working on getting this ready, but the last time I looked at this code I had a PPC Mac and the previous version of XCode, so it's going a little rocky at the moment.

I'm having to update the PYMIDI framework so it will contain PPC and Intel code.  Pete has posted his framework in a less than useable format right now.  I have it building successfully but it's failing to load the framework library for some reason.

If anyone knows anything about cocoa frameworks,  this is the error I'm getting:

dyld: Library not loaded: /Users/kurtarnlund/Library/Frameworks/PYMIDI_2008.framework/Versions/A/PYMIDI_2008

  Referenced from: /Users/kurtarnlund/Documents/Software Projects/My Midi Apps/XT Patch Grabber.2008/build/Debug/XT Patch Grabber.2008.app/Contents/MacOS/XT Patch Grabber.2008

  Reason: image not found

Kurt

Link to comment
Share on other sites

From the error message I was quite dumb.  I just needed to copy the framework into my ~/Library/Frameworks directory.

I have it running, but here is the gotcha.   I have two versions of this program.

The first version I named "XT Patch Grabber 2007", catchy name I know.  This one works and grabs patches and puts the names into the columns of a table view.  But.. its code is super super horrible, and some of the interface items are broken.  It's really the first time I ever started to play with cocoa, so the code is all in one file, and may be exceedingly hard to follow.

The second version I named "XT Patch Grabber 2008".  This one has been built from the ground up to have a clean code organization, with view controllers and data controllers and the whole works.  I think it's a darn good example of how I'd like build a cocoa app and interface.  But this version of the program seems to be more of a work in progress, in that it doesn't yet actually do anything (that I can tell yet).  It does however have most of the code to actually do the same things as the 2007 version.  I just need to hook up the buttons, and fix the things that the new XCode complains about.

I have all of next week off for vacation and this is a prime example of the kind of things I want to work on during that time.  If you can wait until early next week, I'll share what I can get going because I don't think anyone should learn how to do this by looking at the 2007 version.

Kurt

3676_XT_Patch_GrabberScreenSnapz002_jpg5

3678_XT_Patch_GrabberScreenSnapz003_jpgb

3676_XT_Patch_GrabberScreenSnapz002_jpg5

3678_XT_Patch_GrabberScreenSnapz003_jpgb

Link to comment
Share on other sites

Ok here we go.  While it's far from done, it is at least doing something usable now, and demonstrated using the PYMIDI framework.  There are three attachments below.

1) PYMIDI_RELEASE_FRAMEWORK.zip  -  Take the contents of this and place the PYMIDI_2008.framework in ~/Library/frameworks folder.  NOTE: You will most likely need to create the frameworks folder, I did.  The app will not run without this framework in place.  I've included Pete Yandell's license and other files just so you know I didn't create them.

The reason that I named this PYMIDI_2008 is because it now contains both i386 and PPC code, so it should be useable by most os x users here.  There may be other ways for the code to locate this framework.  If you know of a way that is cleaner than the frameworks folder, please let me know.

2) Shows you how to setup xcode to get the PYMIDI source.. its super simple to make a framework project for this code, but I'm lazy and don't feel like going into those details.  Just use the framework that I've already built and reference this code to see how it works.  http://notahat.com/pymidi

3) XT Patch Grabber 2008.zip  - This is is my code tree for the patch name grabber app.  Currently, the search button works very nicely.  When you click search, it will setup a timer and send a LCD screen request to all of your MIDI output ports to located the first Waldorf XT that responds.  Additionally, it tries all device ID's starting from zero and incrementing to 126 until it gives up. 

The window saves all of its setting, but for some reason it never saves the setting unless its an item that the user has clicked on.  This means that it doesn't save the selected ports and device id that it determined from a scan.

The app is probably pretty close to grabbing patch names, but I want to build it all the correct cocoa way and not use char pointers all over the place.  At least it shows you how to deal with the endpoint lists and sending and receiving midi.  If you have a microwave XT and want help out with this, let me know.

** UPDATE 2008-10-07 **

XT Patch Grabber.2008.zip  - contains memory leak fixes and now actually grabs patch names in both batch and single patch mode.

Kurt

PYMIDI_RELEASE_FRAMEWORK.zip

3697_XcodeScreenSnapz002_jpg98bac34383cd

XT Patch Grabber.2008.zip

PYMIDI_RELEASE_FRAMEWORK.zip

3697_XcodeScreenSnapz002_jpg98bac34383cd

XT Patch Grabber.2008.zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...