PluginWindow* PluginWindow::getWindowFor (AudioProcessorGraph::Node* node, bool useGenericView) { for (int i = activePluginWindows.size(); --i >= 0;) if (activePluginWindows.getUnchecked(i)->owner == node && activePluginWindows.getUnchecked(i)->isGeneric == useGenericView) return activePluginWindows.getUnchecked(i); AudioProcessorEditor* ui = nullptr; if (! useGenericView) { ui = node->getProcessor()->createEditorIfNeeded(); if (ui == nullptr) useGenericView = true; } if (useGenericView) { ui = new GenericAudioProcessorEditor (node->getProcessor()); } if (ui != nullptr) { AudioPluginInstance* const plugin = dynamic_cast <AudioPluginInstance*> (node->getProcessor()); if (plugin != nullptr) ui->setName (plugin->getName()); return new PluginWindow (ui, node, useGenericView); } return nullptr; }
static void show_gui(struct SoundPlugin *plugin){ #if JUCE_LINUX const MessageManagerLock mmLock; #endif Data *data = (Data*)plugin->data; if (data->window==NULL) { const char *title = strdup(plugin->patch==NULL ? talloc_format("%s %s",plugin->type->type_name, plugin->type->name) : plugin->patch->name); data->window = new PluginWindow(title, data); if (data->x < 0 || data->y < 0) data->window->centreWithSize (data->window->getWidth(), data->window->getHeight()); else { data->window->setTopLeftPosition(data->x, data->y); } AudioProcessorEditor *editor = data->audio_instance->createEditor(); //IfNeeded(); editor->setName (data->audio_instance->getName()); data->window->setContentOwned(editor, true); data->window->setUsingNativeTitleBar(true); } data->window->setVisible(true); }
PluginWindow* PluginWindow::getWindowFor (AudioProcessorGraph::Node* const node, WindowFormatType type) { jassert (node != nullptr); for (int i = activePluginWindows.size(); --i >= 0;) if (activePluginWindows.getUnchecked(i)->owner == node && activePluginWindows.getUnchecked(i)->type == type) return activePluginWindows.getUnchecked(i); AudioProcessor* processor = node->getProcessor(); AudioProcessorEditor* ui = nullptr; if (type == Normal) { ui = processor->createEditorIfNeeded(); if (ui == nullptr) type = Generic; } if (ui == nullptr) { //if (type == Generic || type == Parameters) //ui = new PMixGenericAudioProcessorEditor (processor); // else if (type == Programs) // ui = new ProgramAudioProcessorEditor (processor); } if (ui != nullptr) { if (AudioPluginInstance* const plugin = dynamic_cast<AudioPluginInstance*> (processor)) ui->setName (plugin->getName()); return new PluginWindow (ui, node, type); } return nullptr; }