My OS X Programming Blog
Mac OS X Cocoa and CoreMIDI Programming
About Andrew Choi


MIDI Programs

MIDI File Player (External Device)

MIDI Destination Pop-Up Button

MIDI File Player (Internal Synth)

MusicSequence Sample Code

MIDI File Writer

MIDI Name Document Parser

NameConfigSetup

Fish Creek MIDI Framework

MidnamUtility

SysExSenderX

Other Programs

FCBlogEditor

FCBlog and Patch

Chinese Checkers Program

jyut6 ping3 Cantonese Input Method

Cocoa Sample Programs

Syntax Coloring Using Flex

NSTextField and Undo

NSToolbar

Implementing File Import

Launch Application and Open URL

Saving Uncommitted Text Field Edits

Algorithms

Jazz Chord Analysis as Optimization

Optimal Line Breaking for Music

Optimal Chord Spacing

   

A blog where I will write mostly about programming in Cocoa and CoreMIDI, and experiences from my ports of Emacs and XEmacs to the Mac OS.

Bank Selects and Program Changes from Patch Names
Friday October 1, 2004

Today I worked on code to translate patch names in MIDI Name Documents to the corresponding bank selects and program changes. Suppose “Walking Bass” in “Bank 1” is selected on the K2000R:

The K2000R uses Control Change 32 to select banks. So the patch above is selected by sending to the K2000R a Control Change 32 message with value 1 and a Program Change with value 46. This can be verified by switching to the “Bank and Patch Numbers” selection method, as shown in the following diagram. Selecting a patch by name automatically sets the (then hidden) bank and patch numbers subpanel.

Because of all the programming effort that has been put into this patch selection interface, changes made in NameConfigSetup and Audio MIDI Setup are immediately reflected in its menus, and exceptional conditions are handled appropriately. This must be the most complete implementation of patch names that one can find in a MIDI application of this size.

Rearranging Subviews in Interface Builder while Preserving Connections
Thursday September 30, 2004

Here’s the current look of my Preference Panel. It’s simply yesterday’s layout rearranged in a NSTabview with four tab view items. The Piano Patch and Drums Patch items are similar to the Bass Patch item and are not shown.

The nice thing about using Cocoa tab views is that no programming is required. All the necessary rearrangement occurs in Interface Builder. A good trick to know though is the “select-click-hold-drag” move! To move a group of subviews into a tab view item without disturbing the connections already made, first select them, then click and hold down the mouse button. When the group of subviews “float” above their containing view, drag them into the tab view. This is probably not a HIG recommendation gesture. Ironic it should be used by the IB of all places :-). In any case it works and saved me a lot of time reconnecting outlets and specifying actions.

On another note, in July I wrote about my attempt to propagate dieffenbachia from tip cuttings. I want to show a picture of the result. It’s quite amazing the amount of new roots that have grown in two and a half months. Time to transfer the plants into bigger pots!

Preference Panel With Patch Selection Controller
Wednesday September 29, 2004

Here’s a peek at my Preference Panel. It requires some more programming to be fully functional. There are too many controls in a single panel at present. I’ll probably put each section in a tab view item in the final version.

Deer!
Tuesday September 28, 2004

Saw this doe out with her two babies two weeks ago.

Also, there’s a full moon tonight.

NSWorkspace Services
Monday September 27, 2004

I need a way to launch Audio MIDI Setup from my MIDI application. After a little searching around, I found the launchApplication method in the Cocoa class NSWorkspace. It is very easy to use and a single statement does what I need:

  [[NSWorkspace sharedWorkspace] launchApplication:@"Audio MIDI Setup"];
Notice that this method does not require one to specify where the “Audio MIDI Setup” utility is! The NSWorkspace class also provides an openURL method, which opens a URL in the default browser. Here’s how it is used:
  NSString *stringURL = @"../../index.html";
  [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:stringURL]];
No wonder so many Cocoa applications have menu commands that take you to web pages. Anyway I have written a sample program that demonstrates the use of these two methods. Here’s a screen shot.

On another note, here’s some chocolate ice cream I made last weekend.

Very basic recipe: 2 cups cream, 2 cups whole milk, 1/4 cup sugar, 5 oz. semi-sweet chocolate, 2 egg yolks, and 1 teaspoon vanilla extract. Care must be taken not to cook the egg yolks when added them to the chocolate cream. Why do I make ice cream instead of getting it from the store? Homemade really tastes better.

September 2004
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30

October 2004
Sun Mon Tue Wed Thu Fri Sat
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Aug  Nov

xml

Search this blog with


Lists

Less-Known Facts About Emacs

Emacs Rants

Chinese Restaurants in Calgary

Calgary/Banff Tourist Attractions

C++ Reading List

Science Fiction Series

Top-10 Reason I Stopped Working on Emacs

Top-10 Types of Questions I Get About Emacs

10 Defining Moments as Programmer


Misc

Carbon XEmacs

Emacs for Mac OS X


Copyright © 2003, 2004, 2005 Andrew Choi (Contact Information). Created with FCBlog