fulldecent / FDWaveformView

Reads an audio file and displays the waveform
MIT License
1.25k stars 171 forks source link

Crashes when zoom too far in. No maximum zoom parameter. #93

Open cormacsugrue opened 7 years ago

cormacsugrue commented 7 years ago

Hi I noticed a bug where if you continue to zoom into the waveform as far as it will zoom the view crashes. The waveform resets but it is frozen.

I found a fix by surrounding a section of the handlePinchGesture function in a if statement and hard coded a maximum frame value.

desctop screenshot

fulldecent commented 7 years ago

You just HAD to zoom that far!

I think this will be fixed with the TODO note. I am very jet lagged (PHL->MNL-DOH->PHL) and didn't want to make refactoring changes in a plane.

BUT I think the long-term solution is #86 Could you please help to take a look at that as it GUARANTEES a range will always be at least one.

cormacsugrue commented 7 years ago

OK great thanks, I will take a look at that. Should I leave this issue open until it has been resolved by #86 . I'm new to github and swift so apologies if I'm not going about any of this the correct way.

Also I don't know if this place to ask but i'm having difficulty initializing a waveform programmatically. I had success using the outlet as per the example. I'm sure it's something obvious. Any help would be greatly appreciated.

var waveform: FDWaveformView!

override func viewDidLoad() {

waveform.frame = CGRect(x: 80, y: 20, width: 240, height: 128) let url = samplerAudioFileURLs[SamplerPlayButton.selectedSamplerIndex] waveform.delegate = self waveform.audioURL = url waveform.alpha = 0.0 }

fulldecent commented 7 years ago

Welcome.

Yes. This issue needs to be fixed and should stay open under any circumstance until that happens.

Right now your alpha is 0.0 which is going to be REALLY hard to see.

wykeenjenga commented 2 years ago

Hey and how can I limit maximum zoo value?