             AVLinearPCMIsNonInterleaved: false
         ]
 
-        let readerOutput = AVAssetReaderTrackOutput(track: assetTrack, outputSettings: outputSettingsDict)
+        let readerOutput = AVAssetReaderTrackOutput(track: audioContext.assetTrack, outputSettings: outputSettingsDict)
         readerOutput.alwaysCopiesSampleData = false
         reader.add(readerOutput)
 
         var channelCount = 1
-        let formatDesc = assetTrack.formatDescriptions
+        let formatDesc = audioContext.assetTrack.formatDescriptions
         for item in formatDesc {
+            // TODO: handle error here
             guard let fmtDesc = CMAudioFormatDescriptionGetStreamBasicDescription(item as! CMAudioFormatDescription) else { return }    // TODO: Can the forced downcast in here be safer?
             channelCount = Int(fmtDesc.pointee.mChannelsPerFrame)
         }
 
         var sampleMax = noiseFloor
+        // TODO: bad things happen if target samples is 0
         let samplesPerPixel = max(1, channelCount * slice.count / targetSamples)
         let filter = [Float](repeating: 1.0 / Float(samplesPerPixel), count: samplesPerPixel)
 


    override open func layoutSubviews() {
        super.layoutSubviews()
        guard assetTrack != nil && !renderingInProgress && zoomEndSamples > 0 else {
            return
        }

        if cacheIsDirty() {
            if #available(iOS 8.0, *) {
                DispatchQueue.global(qos: .background).async { self.renderAsset() }
            } else {
                DispatchQueue.global(priority: .background).async { self.renderAsset() }
            }
            return
        }


        retval.clipsToBounds = true
        return retval
    }()

    /// The range of samples we rendered
    fileprivate var cachedSampleRange = 0..<0
