After Steve Jobs’ WWDC keynote I got itching to get going and leave the tutorials behind. After a while they become (for me) plodding and uninspiring, and I thought that I’d picked up enough to build something of my own. I decided that the keynote was Day 0 of my Cocoa work. So I started a project to rewrite David Clarke’s Chroma command line patch conversion tools in Cocoa, with a graphical user interface.
Day 1: The first thing I decided to explore was the opening of files. It didn’t take long to find that I had to set an application delegate to respond to Apple events. I created an application controller object in my NIB file and ended up using
application:openFiles: (I didn’t seem to get anything from
application:openFile; a subject for further exploration). Confirmed that the array received contained the paths of files dragged to the application icon. (Have to option-command drag files to the Dock icon in order for it to highlight; fooled around with the application properties and file types without success. Another thing to get back to.)
Day 2: Next I investigated NSFileHandle which provides the ability to read data from a file; I used the
fileHandleForReadingAtPath: method. Successfully output file contents to the console, using the
Day 3: The most interesting progress I’ve made in these early days involves the application of MVC to my thinking and its effect even on user interface design. I was going to start by doing an application for converting Chroma sysex files to tape (audio) format: see syx2tape and syx2tape.c.
However, I realized that the app controller object shouldn’t do the conversion work: I need a patch bank object that will encapsulate the data and conversion methods, with the controller object mediating between this object and the user interface (and files). It became obvious that the ChromaBank class would be generic to all the conversions and, rather than using it across a number of applications, my application should do them all, and hopefully be smart enough to discern the format being requested for conversion (and ask the user for the destination format). So, when the user requests conversion of a Syntech sysex file, and desires a textual patch listing, the ChromaBank class converts itself from sysex to tape (the original
syx2tape, which becomes a method in the class), and then does a
So I started on the ChromaBank class and thought about the methods, particularly initialization. It makes sense to initialize to a Chroma “scratch patch” (default sound) in sysex format. I will write that method later: perhaps the app will include a scratch sysex file in its bundle. I wrote an initializer method,
initWithSysexData. Good progress in my thinking and with the code: compilation errors are a great learning tool.
Day 4: Didn’t have much time but thought about the application icon and started fooling around with IconBuilder Pro.
Day 5: Started rewriting the
syx2tape routines (C) in Objective-C.