Example #1
0
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;
}