Advice needing, updating GUI from processBlock(I know


#1

I know, NOT a good idea, but hear me out. I’m using an external library for my signal processing and the flip side is I can only update/access certain parts of the library when it’s safe to do so. For example, if I want to update a wavetable in my table viewer component, I need to wait till it’s safe to call the libraries getTable() method. The only time it’s absolutely safe to do this is between processing blocks. This works fine, of course there is no need to update after every processing block, just so long as I update between processing blocks. And to the problem…

As soon as I try to delete my filter I get a hang. I’m using a simple routine borrowed from the Standalone code:

void StandaloneFilterWindow::deleteFilter() { player.setProcessor (nullptr); if (filter != nullptr && getContentComponent() != nullptr) { filter->editorBeingDeleted (dynamic_cast <AudioProcessorEditor*> (getContentComponent())); clearContentComponent(); } filter = nullptr; }

If I step through this code I first enter AudioProcessorPlayer::setProcessor() and get as far as this line(58):

const ScopedLock sl (lock);

Then my program hangs and I can no long step anywhere, but I get no errors, in fact I get no information at all about what’s happening? I guess something is preventing the processing thread from being destroyed? I can understand why, if the processing thread is not freed there will be problems, but I can’t understand why calling one of my editors functions every half second from my processing block would cause this problem? The function only gets called if there is an active editor. Any ideas?


#2

Sounds like a deadlock. Another thread is also locking the same CriticalSection.


#3

Thanks, any ideas on how to go about solving the problem, or finding out more information on what might be the case of the problem? I’m in need of a little direction here! In the mean time I’m going to revert back to a simple timer in my editor, and try to figure out another way of making things thread safe with the sound library I’m using. Thanks for the reply.


#4

After some digging I found the problem. My processor wasn’t being freed which was messing everything up. [insert embarrassed smiley face]