                     return
                 }
                 
-                print(audioFormat)
                 self!.audioFormat = audioFormat
-                print(self!.audioFormat.mBitsPerChannel)
                 dispatch_async(dispatch_get_main_queue()) {
                     completion(true)
                 }

        }
    }

    func configureChannelsForValuesCount(count: Int, timeRange: CMTimeRange) {
        
        let estimatedSampleCount = timeRange.duration.seconds * self.audioFormat.mSampleRate
        
        for index in self.maxValueChannels.indices {
            let channel = self.maxValueChannels[index]
            channel.totalCount = Int(Double(count) * pow(2.0, Double(index)))
            channel.blockSize  = Int(ceil(estimatedSampleCount/Double(channel.totalCount)))
        }

        for index in self.avgValueChannels.indices {
            let channel = self.avgValueChannels[index]
            channel.totalCount = Int(Double(count) * pow(2.0, Double(index)))
            channel.blockSize  = Int(ceil(estimatedSampleCount/Double(channel.totalCount)))
        }
    }
    
    func configureChannelsForLogic() {
        var maxValueChannels = [Channel<Int16>]()
        for _ in 0..<channelPerLogicProviderType {
            let channel        = Channel<Int16>(logicProvider: AudioMaxValueLogicProvider())
            channel.identifier = self.identifierForLogicProviderType(AudioMaxValueLogicProvider)
            maxValueChannels.append(channel)
        }
        self.maxValueChannels = maxValueChannels
        
        var avgValueChannels = [Channel<Float>]()
        for _ in 0..<channelPerLogicProviderType {
            let channel        = Channel<Float>(logicProvider: AudioAverageValueLogicProvider())
            channel.identifier = self.identifierForLogicProviderType(AudioAverageValueLogicProvider)
            avgValueChannels.append(channel)
        }
        self.avgValueChannels = avgValueChannels
    }

    func identifierForLogicProviderType(type: LogicProvider.Type) -> String {
        return "\(self.identifier).\(type.typeIdentifier)"
    }
    
    func read(count: Int, dataRange: DataRange = DataRange(), completion: () -> () = {}) {

        assert(self.asset != nil, "No asset")

    }
    
    init() {
        self.createChannelsForDefaultLogicTypes()
    }
    
    //MARK: -
    //MARK: - Inner configuration
    func configureChannelsForSamplesCount(samplesCount: Int, timeRange: CMTimeRange) {
        
        let estimatedSampleCount = timeRange.duration.seconds * self.audioFormat.mSampleRate
        
        for index in self.maxValueChannels.indices {
            let channel = self.maxValueChannels[index]
            channel.totalCount = Int(Double(samplesCount) * pow(2.0, Double(index)))
            channel.blockSize  = Int(ceil(estimatedSampleCount/Double(channel.totalCount)))
        }
        
        for index in self.avgValueChannels.indices {
            let channel = self.avgValueChannels[index]
            channel.totalCount = Int(Double(samplesCount) * pow(2.0, Double(index)))
            channel.blockSize  = Int(ceil(estimatedSampleCount/Double(channel.totalCount)))
        }
    }
    
    func createChannelsForDefaultLogicTypes() {
        
        var maxValueChannels = [Channel<Int16>]()
        
        for _ in 0..<channelPerLogicProviderType {
            let channel        = Channel<Int16>(logicProvider: AudioMaxValueLogicProvider())
            channel.identifier = self.identifierForLogicProviderType(AudioMaxValueLogicProvider)
            maxValueChannels.append(channel)
        }
        
        self.maxValueChannels = maxValueChannels
        //???: Is there any reason to store Float?
        var avgValueChannels = [Channel<Float>]()
        
        for _ in 0..<channelPerLogicProviderType {
            let channel        = Channel<Float>(logicProvider: AudioAverageValueLogicProvider())
            channel.identifier = self.identifierForLogicProviderType(AudioAverageValueLogicProvider)
            avgValueChannels.append(channel)
        }
        self.avgValueChannels = avgValueChannels
    }

    //MARK: - Reading
    //TODO: There's no need in such public methods (combine with read method)
    func prepareToRead(completion: (Bool) -> ()) {
        
        assert(self.audioSource != nil, "No audio source")
