Category Archives - Swift

Consolidating String Constants Among C++, Objective-C++ and Swift

June 18, 2017 12 Comments

I’m back to writing a synth audio unit. The Apple Example AudioUnit(s) Code is good, but one thing that bothers me about it is how many bare string constants there are.
I put up

Constraints, Scrollviews, and Custom Views

May 5, 2017 12 Comments

I recently have been trying to deal with NSScrollViews wrt embedding a view from a XIB in the scrollview and get it to work. As I was unsuccessful, and no web search got me to

Custom Keyboard View with Bindings

December 31, 2016 12 Comments

The code for this is at GitHub.
If you run it you will see that you can select/unselect keys, singly or with click-drag. Undo works. Save works. The “XYZ” label does nothing currently.


DispatchQueue Priorities

November 25, 2016 12 Comments

In attempting to create a high priority queue I ran into the problem of Apple’s terrible documentation on this front. We have this new DispatchQoS.QoSClass enumeration, which consists of { userInteractive, userInitiated, default, utility, background,

Nested withUnsafeMutablePointer()

November 22, 2016 12 Comments

Since withUnsafeMutablePointers() has gone away, I typed out this example of using nested withUnsafeMutablePointer() so I was sure I knew what I was doing:

var int1 = UInt32(1)
var bytes1 = [UInt8(1), UInt8(2), UInt8(3)]

AudioUnit Version 3 Test App

November 20, 2016 12 Comments

GitHub Repo for this project
I haven’t posted in quite awhile. I’ve been working on v3 AUs lately and because this stuff is sort of tangential to what I’m doing with MIDI, I’m posting this

First Foray into ‘reduce’

March 25, 2016 12 Comments

After trying to coax a Closure into being a Protocol and failing I realized I could do what I’m trying to do with reduce. The basic idea, MIDI-wise, is to run a MIDI message through

Popover from Separate XIB File

March 20, 2016 12 Comments

I’m going to need to display the same popover from many different subviews. I don’t want to have to duplicate the custom view etc in every view XIB so I added a XIB that just

C and Swift – strcpy

February 27, 2016 12 Comments

Below are some of the things I’ve needed to do recently, when interfacing with C code. Maybe these will be useful to someone. I’m trying to implement Unix-domain sockets in Swift, and it’s been kind

PThreads in Swift

February 20, 2016 12 Comments

Here’s some code that implements pthreads via swift.

class PTTask {
init () {
func run() -> Int32 {
let threadPtr = UnsafeMutablePointer.alloc(1)
let selfPtr = UnsafeMutablePointer.alloc(1)
selfPtr.memory = self
let attrPtr