Skip to content

Commit 730cd15

Browse files
committed
Remove debug print statements.
1 parent 909ca1c commit 730cd15

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

Source/FDWaveformView.swift

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ open class FDWaveformView: UIView {
174174
private var inProgressWaveformRenderOperation: FDWaveformRenderOperation? {
175175
willSet {
176176
if newValue !== inProgressWaveformRenderOperation {
177-
print("cancelling")
178177
inProgressWaveformRenderOperation?.cancel()
179178
}
180179
}
@@ -404,8 +403,6 @@ open class FDWaveformView: UIView {
404403
func renderWaveform() {
405404
guard let audioContext = audioContext else { return }
406405

407-
print("rendering")
408-
409406
let displayRange = zoomEndSamples - zoomStartSamples
410407
guard displayRange > 0 else { return }
411408

@@ -420,7 +417,6 @@ open class FDWaveformView: UIView {
420417
let waveformRenderOperation = FDWaveformRenderOperation(audioContext: audioContext, imageSize: imageSize, sampleRange: renderSampleRange, format: renderFormat) { image in
421418
DispatchQueue.main.async {
422419
self.renderForCurrentAssetFailed = (image == nil)
423-
print("done")
424420
self.waveformImage = image
425421
self.renderingInProgress = false
426422
self.cachedWaveformRenderOperation = self.inProgressWaveformRenderOperation
@@ -658,14 +654,12 @@ final public class FDWaveformRenderOperation: Operation {
658654
return image
659655
}()
660656

661-
print("image: \(image?.description ?? "nil"), scale: \(image?.scale.description ?? "nil")")
662-
663657
finish(with: image)
664658
}
665659

666660
/// Read the asset and create create a lower resolution set of samples
667661
func sliceAsset(withRange slice: CountableRange<Int>, andDownsampleTo targetSamples: Int) -> (samples: [CGFloat], sampleMax: CGFloat)? {
668-
guard !isCancelled else { print("sampling cancelled!"); return nil }
662+
guard !isCancelled else { return nil }
669663

670664
guard
671665
!slice.isEmpty,
@@ -705,10 +699,10 @@ final public class FDWaveformRenderOperation: Operation {
705699

706700
// 16-bit samples
707701
reader.startReading()
708-
defer { reader.cancelReading(); print("canceled reading") } // Cancel reading if we exit early if operation is cancelled
702+
defer { reader.cancelReading() } // Cancel reading if we exit early if operation is cancelled
709703

710704
while reader.status == .reading {
711-
guard !isCancelled else { print("sampling cancelled!"); return nil }
705+
guard !isCancelled else { return nil }
712706

713707
guard let readSampleBuffer = readerOutput.copyNextSampleBuffer(),
714708
let readBuffer = CMSampleBufferGetDataBuffer(readSampleBuffer) else {
@@ -742,7 +736,7 @@ final public class FDWaveformRenderOperation: Operation {
742736
// Process the remaining samples at the end which didn't fit into samplesPerPixel
743737
let samplesToProcess = sampleBuffer.count / MemoryLayout<Int16>.size
744738
if samplesToProcess > 0 {
745-
guard !isCancelled else { print("sampling cancelled!"); return nil }
739+
guard !isCancelled else { return nil }
746740

747741
let downSampledLength = 1
748742
let samplesPerPixel = samplesToProcess
@@ -760,8 +754,6 @@ final public class FDWaveformRenderOperation: Operation {
760754
// if (reader.status == AVAssetReaderStatusFailed || reader.status == AVAssetReaderStatusUnknown)
761755
// Something went wrong. Handle it.
762756
if reader.status == .completed {
763-
print("totalSampleCount \(totalSampleCount), expected sample count: \(channelCount * slice.count)")
764-
print("outputSampleCount: \(outputSamples.count), expected target samples: \(targetSamples)")
765757
return (outputSamples, sampleMax)
766758
} else {
767759
print("FDWaveformRenderOperation failed to read audio: \(reader.error)")
@@ -798,8 +790,6 @@ final public class FDWaveformRenderOperation: Operation {
798790
return element
799791
}
800792

801-
print("samplesPerPixel: \(samplesPerPixel), samples to process: \(samplesToProcess), downsample length: \(downSampledDataCG.count)")
802-
803793
// Remove processed samples
804794
sampleBuffer.removeFirst(samplesToProcess * MemoryLayout<Int16>.size)
805795

@@ -811,8 +801,6 @@ final public class FDWaveformRenderOperation: Operation {
811801
func plotLogGraph(_ samples: [CGFloat], maximumValue max: CGFloat, zeroValue min: CGFloat) -> UIImage? {
812802
guard !isCancelled else { return nil }
813803

814-
print("samples \(samples)")
815-
816804
let imageSize = CGSize(width: CGFloat(samples.count) / format.scale,
817805
height: self.imageSize.height)
818806

0 commit comments

Comments
 (0)