     
     private var sampleRate : Double = 1.0
     private var totalFrameCount : Int64
+    private var initialFrameCount : Int64 = -1
     
     /// Boolean indicating whether or not to loop the playback
     public var looping = false

        internalPlayer.stop()
    }
    
    // The currentTime
    public var currentTime : Double {
        
        if internalPlayer.playing {
            if let time = internalPlayer.lastRenderTime {
                // wrap the sampleTime by the totalFrameCount as sampleTime does not reset when audio loops.
                return Double( ( Int64(time.sampleTime) % totalFrameCount) ) / sampleRate
            }
        }
        return 0.0

            internalPlayer.scheduleBuffer(audioFileBuffer, atTime: nil, options: options, completionHandler: nil)
        }
        internalPlayer.play()
        // get the initialFrameCount for currentTime as it's relative to the audio engine's time.
        if (initialFrameCount == -1){
            if let t = internalPlayer.lastRenderTime {
                initialFrameCount = t.sampleTime
            }
        }
    }
    
    /// Pause playback
