             CAShow(sequencePointer)
         }
     }
-    
+
     /// Set the midi output for all tracks
     public func setGlobalMIDIOutput(midiEndpoint: MIDIEndpointRef) {
         if isAVSequencer {

        MusicTrackNewExtendedTempoEvent(tempoTrack, position.beats, constrainedTempo)

    }
    
    /// Tempo retrieved from the sequencer
    public var tempo: Double {
        var tempoOut: Double = 120.0
        
        var tempoTrack: MusicTrack = nil
        MusicSequenceGetTempoTrack(sequence, &tempoTrack)
        
        var iterator:MusicEventIterator = nil
        NewMusicEventIterator(tempoTrack, &iterator);
        
        var eventTime: MusicTimeStamp = 0
        var eventType: MusicEventType = kMusicEventType_ExtendedTempo
        var eventData: UnsafePointer<Void> = nil
        var eventDataSize: UInt32 = 0
        
        var hasPreviousEvent: DarwinBoolean = false
        MusicEventIteratorSeek(iterator, currentPosition.beats)
        MusicEventIteratorHasPreviousEvent(iterator, &hasPreviousEvent)
        if hasPreviousEvent {
            MusicEventIteratorPreviousEvent(iterator)
            MusicEventIteratorGetEventInfo(iterator, &eventTime, &eventType, &eventData, &eventDataSize);
            if eventType == kMusicEventType_ExtendedTempo {
                let tempoEventPointer: UnsafePointer<ExtendedTempoEvent> = UnsafePointer(eventData)
                tempoOut = tempoEventPointer.memory.bpm

    public func newTrack(name: String = "Unnamed") -> AKMusicTrack? {
        if isAVSequencer {
            print("AKSequencer ERROR ! newTrack only work if not isAVSequencer ")
            return nil
        }

        var newMusicTrack: MusicTrack = nil
        MusicSequenceNewTrack(sequence, &newMusicTrack)
