     
     private var audioFileBuffer: AVAudioPCMBuffer
     private var internalPlayer: AVAudioPlayerNode
+    
+    private var sampleRate : Double = 1.0
+    private var totalFrameCount : Int64
     
     /// Boolean indicating whether or not to loop the playback
     public var looping = false

        let audioFrameCount = UInt32(audioFile.length)
        audioFileBuffer = AVAudioPCMBuffer(PCMFormat: audioFormat, frameCapacity: audioFrameCount)
        try! audioFile.readIntoBuffer(audioFileBuffer)
        
        internalPlayer = AVAudioPlayerNode()
        super.init()

    public func stop() {
        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
    }
}
