syedhali / EZAudio

An iOS and macOS audio visualization framework built upon Core Audio useful for anyone doing real-time, low-latency audio processing and visualizations.
Other
4.94k stars 822 forks source link

GL Error: 502 When Recording in Modal View Opened More Than Once #68

Open dyelax opened 10 years ago

dyelax commented 10 years ago

This may be something I'm doing wrong, but it seems like something going on with the graphics code in the framework (I'm not very familiar with Open GL, so I can't really tell.)

I'm trying to create a recording controller presented in a modal view. While it works perfectly the first time I present the view and record, if I cancel the recording and open it again, when I try to record I get thrown a GL Error: 502 and only the top half of the waveform draws. I've tried destroying every EZAudio property I'm using (AudioPlotGL, Microphone and Recorder) when I dismiss the view and recreating them all in case there's some information hanging around from the first recording that's screwing something up, but I still get the error.

If I stay in the same view and reset everything (The retry button on the top right) It will re-record just fine. The issue is only when I dismiss the view and reopen it.

Video of the problem: http://youtu.be/PtlIa_uM1W4

Link to the Xcode Project: https://www.dropbox.com/sh/kf8cxo3pcsh5u9p/AABk7zpekdVvL2rZrVA40CkZa

dyelax commented 10 years ago

@syedhali: Update: I'm now pretty sure it really is an issue inside the framework, as I tweaked the included "EZAudioRecordExample" project so the recording view controller is presented modally and the same error happens.

emajcher commented 10 years ago

@dyelax Unfortunately I ran into this also ... after spending a night trying to fix it (with little Open GL knowledge) I gave up and wrote my own waveform display with Core Graphics that sort of mimics the audio display of the voice memo app, but instead of a contiguous graph, it just draws straight vertical lines (which was in the original design anyway). I would be happy to share this with you, it was only about 70 lines of code and might be a good starting point for you to write something custom if you need to launch in a modal ... I suspect instead of vertical lines you could modify it to use a connected path, discarding old data points.

dyelax commented 10 years ago

@emajcher Thanks! That would be really helpful. You can email me at matthew_cooper@brown.edu. (Or just post it here if that's possible to help others with the problem until it's resolved.)

ogoldfinger commented 10 years ago

+1 for this. I had the same problem so I tried using just audioplot (not GL) and it worked fine except then I ran into this problem: https://github.com/syedhali/EZAudio/issues/55

But uncommenting that line as suggested in that thread worked for me as well so now I have it working in a modal (albeit not with openGL)

emajcher commented 10 years ago

AHH!! I ran into that issue also (non open GL audio plot) which is why I ended up writing my own waveform display, I hadn't seen the problem/solution #55 which would have saved me some time. Dyelax, you might want to try that option first (use AudioPlot vs. AudioPlotGL) which will use core graphics and adding the fix in #55. My implementation will require you to do some additional work to get a connected graph like audio plot, but I will still send it as a simple reference.

dyelax commented 10 years ago

Thanks a ton guys. I'll try out those two options. Glad I'm not the only one with this issue though -- hopefully it'll get patched up for the openGL plot.

syedhali commented 10 years ago

Know I'm a little late here, but this seems to be an issue with the OpenGL context. I'll look into this a bit, but TBH I'm in the process of writing a new version of EZAudio with a completely new EZAudioPlotGL that's much easier to customize and allows multiple GL plots at once. This probably won't get released until sometime in October, but I figured I'll let you guys know!

nmcc24 commented 9 years ago

Some fix on the AudioPlotGL plot would be great, otherwise i'll adopt AudioPlot

don-inkscreen commented 8 years ago

Having this issue as well; have switched to EZAudioPlot in the meantime.