             MusicPlayerSetSequence(existingMusicPlayer, sequence)
         }
     }
-
+    
     deinit {
         AKLog("deinit:")
-
+        
         if let player = musicPlayer {
             DisposeMusicPlayer(player)
         }
-
+        
         if let seq = sequence {
             for track in self.tracks {
                 if let intTrack = track.internalMusicTrack {
                     MusicSequenceDisposeTrack(seq, intTrack)
                 }
             }
-
+            
             DisposeMusicSequence(seq)
         }
     }
-
+    
     /// Initialize the sequence with a MIDI file
     ///
     /// - parameter filename: Location of the MIDI File

        outSecs *= sign
        return outSecs
    }

    /// Play the sequence
    open func play() {
        if let existingMusicPlayer = musicPlayer {
            MusicPlayerStart(existingMusicPlayer)
        }
    }

    /// Stop the sequence
    @objc open func stop() {
        if let existingMusicPlayer = musicPlayer {
            MusicPlayerStop(existingMusicPlayer)
        }
    }

    /// Rewind the sequence
    open func rewind() {
        if let existingMusicPlayer = musicPlayer {
            MusicPlayerSetTime(existingMusicPlayer, 0)
        }
    }

    /// Wheter or not the sequencer is currently playing
    open var isPlaying: Bool {
        var isPlayingBool: DarwinBoolean = false


/// Sequencer based on tried-and-true CoreAudio/MIDI Sequencing
open class AKSequencer {
    
    /// Music sequence
    open var sequence: MusicSequence?
    
    /// Pointer to Music Sequence
    open var sequencePointer: UnsafeMutablePointer<MusicSequence>?
    
    /// Array of AudioKit Music Tracks
    open var tracks = [AKMusicTrack]()
    
    /// Music Player
    var musicPlayer: MusicPlayer?
    
    /// Loop control
    open private(set) var loopEnabled: Bool = false
    
    /// Sequencer Initialization
    @objc public init() {
        NewMusicSequence(&sequence)
