                 //return   Double(Double(startingFrame) / sampleRate)  +  Double(Double(playerTime.sampleTime) / playerTime.sampleRate)
                 return Double(Double(playerTime.sampleTime) / playerTime.sampleRate)
             }
-
+            
         }
         return lastCurrentTime
     }
-
-
+    
     /// Time within the audio file at the current time
     open var playhead: Double {
-
+        
         let endTime = Double(Double(endingFrame) / internalAudioFile.sampleRate)
         let startTime = Double(Double(startingFrame) / internalAudioFile.sampleRate)
-
+        
         if endTime > startTime {
-
+            
             if looping {
                 return  startTime + currentTime.truncatingRemainder(dividingBy: (endTime - startTime))
             } else {

            internalPlayer.pan = Float(pan)
        }
    }

    /// sets the start time, If it is playing, player will
    /// restart playing from the start time each time end time is set
    open var startTime: Double {
        get {
            return Double(startingFrame) / internalAudioFile.sampleRate

        }
        set {
            let wasPlaying = playing
            if newValue > Double(endingFrame) / internalAudioFile.sampleRate {
                print("ERROR: AKAudioPlayer cannot set a startTime bigger that endTime: \(Double(endingFrame) / internalAudioFile.sampleRate) seconds")
            } else {
                startingFrame = UInt32(newValue * internalAudioFile.sampleRate
                )
                stop()
            }
            if wasPlaying {

            internalPlayer.volume = Float(volume)
        }
    }
    
    /// Whether or not the audio player is currently started
    open var isStarted: Bool {
        return  internalPlayer.isPlaying
    }
    
    
    /// Current playback time (in seconds)
    open var currentTime: Double {
        if playing {
