Category Archives: Core MIDI

Swift 3 Core MIDI

Swift Language

Swift 3 Core MIDI The Swift 3 betas bring many changes. Here’s an update for Core MIDI based on Swift 3 beta 3. Introduction Some changes Beta 6 changes Summary Resources Introduction Table of Contents There aren’t a great number of changes specifically to Core MIDI; it’s just as awful as it’s always been. Much […]

Posted in Core MIDI | 16 Responses

MusicSequence via a MIDI Virtual Source

Swift Language

MusicSequence via a MIDI Virtual Source Virtual MIDI sources and destinations are a bit confusing. This is one way to use a Virtual MIDI source. Introduction MIDI Setup MusicSequence Summary Resources Introduction Table of Contents If you want other apps to the “see” your app as a MIDI source, i.e. a producer of MIDI data, […]

Also posted in MIDI, Swift | Leave a comment

Swift 2: AVFoundation to play audio or MIDI

Swift Language

Swift AVFoundation There are many ways to play sound in iOS. Core Audio has been around for a while and it is very powerful. It is a C API, so using it from Objective-C and Swift is possible, but awkward. Apple has been moving towards a higher level API with AVFoundation. Here I will summarize […]

Also posted in Swift | Tagged , , | 13 Responses

Swift 2 AVAudioSequencer

Swift Language

Swift 2 AVAudioSequencer There’s a brand new MIDI sequencer class in Swift 2 beta! It’s the AVAudioSequencer. Introduction AVAudioSequencer Setup AVAudioEngine Setup AVMusicTrack Summary Update Resources Introduction Table of Contents At WWDC15 there was a presentation entitled “What’s New in Core Audio“. If you were able to get past the first 29 minutes of a […]

Also posted in Apple, Computer Music, MIDI, Swift | Tagged , | 12 Responses

Swift 2 and CoreMIDI

Swift Language

Swift 2 and CoreMIDI Swift 1.2 is notorious regarding its lack of function pointers to deal with C APIs such as Core MIDI. I’ve complained^H^H^H^H^H written about this several times. Introduction MIDI Client Input Port Virtual Destination Summary Resources Introduction Well, praise Zeus, Thor, and the FSM, in Swift 2 beta, Core MIDI is easier […]

Also posted in Swift | Tagged , | 19 Responses

Swift MIDI Trampoline

Swift Language

Swift MIDI Trampoline Swift does not support C Function pointers. I’ve written about that a few times. So, what do you do if you need to use a C API that relies on C callbacks? Core MIDI is just one example of C APIs that rely on function pointers. Introduction Notify callback Read callback Summary […]

Also posted in Swift | Tagged , , | 1 Response

Swift and C API callbacks

Swift Language

Swift and C API callbacks Swift is supposed to have been designed for compatibility with existing Apple APIs, including C APIs such as CoreMIDI. N.B. Apple has improved Core MIDI support for Swift since this was written. Introduction Creating Function Pointers Swift 2 beta update Summary Resources Introduction Core MIDI is Apple’s C API for […]

Also posted in Swift | Tagged , | 3 Responses

Swift 1.2 beta2 and CoreMIDI

Swift 1.2 beta2 and CoreMIDI Someone is actually working on CoreMIDI with Swift. N.B. Apple has improved Core MIDI support for Swift since this was written. The Problem Summary Resources The Problem Prior to Swift 1.2, various CoreMIDI types defined in MIDIServices.h were architecture dependent. Like this:

This mean that you had to deal […]

Also posted in Swift | Tagged | 1 Response

Swift fail: MIDIClientCreate

Swift Language

Swift fail: MIDIClientCreate There is a problem with calling Core MIDI’s MIDIClientCreate function from Swift. N.B. This article was true when published. Apple has since fixed the problem. Introduction The Test Summary Resources Introduction Let’s start with a simple call to Core MIDI’s client create function. You need the midi client to create MIDI input […]

Also posted in Apple, MIDI, Swift | 2 Responses