Monthly Archives: June 2015

iOS: trimming audio files with Swift

Swift Language

iOS: trimming audio files I’ve written about how to record audio on iOS using Swift. But, how do you trim the recording? Introduction Summary Resources Introduction Table of Contents One way to trim an audio file is to use AVFoundation’s AVAssetExportSession. You create an export session instance, set its parameters, and then tell it to […]

Posted in Computer Music, Core Audio, Swift | Tagged , | 6 Responses

Swift 2 OptionSetType

Swift Language

Swift 2 OptionSetType Swift 2/iOS 9 broke my calendar/date code. What’s going on? Introduction RawOptionSetType OptionSetType Some Other Examples Summary Resources Introduction Table of Contents If you have an app that does anything with dates, you most likely have code someplace like this. You get the date’s components, do something with them, and construct a […]

Posted in Swift | Tagged , | 1 Response

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 […]

Posted in Apple, Computer Music, Core MIDI, 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 […]

Posted in Core MIDI, 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 […]

Posted in Core MIDI, Swift | Tagged , , | 1 Response

Disabled UIToolbar appearance

Swift Language

Disabled UIToolbar appearance A short tip on how to show that a UIToolbar is disabled. Introduction How to do it Summary Resources Introduction I wanted to disable a UIToolbar and then enable it later via an In App Purchase. So, you just loop over your bar buttons and disable them, right? Well, no.

That […]

Posted in Swift | Tagged | Leave a comment