Category Archives - Swift

CoreMIDI and Memory Leaks

December 18, 2015 12 Comments

I recently wrote a “MIDIChimes” app that sends note-on and off somewhat randomly for a given set of notes. I noticed a memory leak, investigated, and after many hours of poking at it finally plugged

GCD – Accurate Enough for MIDI?

December 6, 2015 12 Comments

I’m not familiar with either GCD or high precision timers on the Mac (I don’t currently write code for iOS but I’m sure it’s similar). Since I’m working on MIDI code, this means I’m going

Linear Mapping Between Two Triangles

December 6, 2015 12 Comments

Here is unoptimized Swift code for generating the linear transformation between two triangles. It’s extremely easy to miss dealing with some corner cases. I’m pretty sure this is correct. I’ve used it to generate dozens

Cocoa Bindings, Custom Views, and Swift

November 28, 2015 12 Comments

Pounding my head against a wall, trying to 1) understand bindings properly and 2) get them to work in Swift properly.
Here is a custom view. It simply draws its rect as the color specified

MIDI – Swift to Objective C

November 28, 2015 12 Comments

A month or so ago I started playing around with MIDI and Swift, and immediately became disenchanted with the way one has to deal with the C-isms of CoreMIDI. Correct me if I’m wrong, but

Binding MIDI Outputs

November 21, 2015 12 Comments

This took quite awhile to figure out. At first I tried and failed to use a mutable dictionary, then gave up and went with a mutable array of OutputPort.
class OutputPort: NSObject {
let source:

NSObjectController and NSMutableDictionary

November 9, 2015 12 Comments

I’ve had nothing but trouble lately with cocoa bindings. This started out with me wanting to be able to choose from available MIDI output ports via a drop-down that used cocoa bindings. After failing miserably


November 2, 2015 12 Comments

First post… I’ve been learning Swift, and as a C programmer who fell in love with Objective C a long time ago, I’ve just got to say … Meh. I enjoy Swift, but recent experiments