Esempio n. 1
0
void Pipeline::remove(int index)
{
	int s = size();
	if(index >= s)
		return;
	if(debugMsg)
		qDebug(" Pipeline::remove(%d)", index);
    BasePlugin* plugin = (*this)[index];

    if (plugin && !(plugin->hints() & PLUGIN_IS_SYNTH))
    {//Synth type plugins are deleted elsewhere in SynthPluginDevice::close(), DO NOT delete here
        plugin->aboutToRemove();

        // Delete the appropriate class
        switch(plugin->type())
        {
        case PLUGIN_LADSPA:
            delete (LadspaPlugin*)plugin;
            break;
        case PLUGIN_LV2:
            delete (Lv2Plugin*)plugin;
            break;
        case PLUGIN_VST:
            delete (VstPlugin*)plugin;
            break;
        default:
            break;
        }
    }

	erase(begin()+index);
    //(*this)[index] = 0;
}
void GraphComponent::mouseUp (const MouseEvent& e)
{
    if (e.mods.isLeftButtonDown())
    {
        lassoComponent->endLasso ();
    }
    else if (e.mods.isMiddleButtonDown ())
    {
    }
    else if (e.mods.isRightButtonDown ())
    {
        // try to open internal plugins
        BasePlugin* newPlugin = PluginLoader::handlePopupMenu (false, 0, owner->getFilter());

        // now open plugin
        if (host && newPlugin)
        {
            host->openPlugin (newPlugin);
            host->addPlugin (newPlugin);

            newPlugin->setValue (PROP_GRAPHXPOS, e.x);
            newPlugin->setValue (PROP_GRAPHYPOS, e.y);

            createPluginNode (newPlugin);
        }
    }
    
    lassoComponent->endLasso ();
    setMouseCursor (MouseCursor::NormalCursor);
}
bool GraphComponent::loadAndAppendPlugin (const File& file, 
										  int mouseX,
										  int mouseY)
{
    DBG ("GraphComponent::loadAndAppendPlugin");

    jassert (host != 0);

    BasePlugin* plugin = host->loadPlugin (file);
    if (plugin)
    {
        Config::getInstance ()->addRecentPlugin (file);

		plugin->setValue(PROP_GRAPHXPOS, mouseX);
		plugin->setValue(PROP_GRAPHYPOS, mouseY);

        host->addPlugin (plugin);

        createPluginNode (plugin);

        return true;
    }

    return false;
}
Esempio n. 4
0
void AudioTrack::addPlugin(BasePlugin* plugin, int idx)/*{{{*/
{
	if(debugMsg)
    	qDebug("AudioTrack::addPlugin(%p, %d) \n", plugin, idx);
    if (!plugin)
    {
        BasePlugin* oldPlugin = (*_efxPipe)[idx];
        if (oldPlugin)
        {
            oldPlugin->setId(-1);
            oldPlugin->setTrack(0);

            uint32_t paramCount = oldPlugin->getParameterCount();
            for (uint32_t i = 0; i < paramCount; i++)
            {
                ParameterPort* paramPort = oldPlugin->getParameterPort(i);
                if (! paramPort || paramPort->type != PARAMETER_INPUT || (paramPort->hints & PARAMETER_IS_AUTOMABLE) == 0)
                    continue;

                int id = genACnum(idx, i);
                removeController(id);
            }
			_efxPipe->remove(idx);
        }
    }

    if (plugin)
    {
        idx = efxPipe()->addPlugin(plugin, idx);
        plugin->setId(idx);
        plugin->setTrack(this);

        uint32_t paramCount = plugin->getParameterCount();
        for (uint32_t i = 0; i < paramCount; i++)
        {
            ParameterPort* paramPort = plugin->getParameterPort(i);
            if (! paramPort || paramPort->type != PARAMETER_INPUT || (paramPort->hints & PARAMETER_IS_AUTOMABLE) == 0)
                continue;

            int id = genACnum(idx, i);

            CtrlValueType t = plugin->valueType();
            CtrlList* cl = new CtrlList(id);
            cl->setRange(paramPort->ranges.min, paramPort->ranges.max);
            cl->setName(plugin->getParameterName(i));
            cl->setPluginName(plugin->name());
            cl->setUnit(plugin->getParameterUnit(i));
            cl->setValueType(t);

            if (paramPort->hints & PARAMETER_IS_TOGGLED)
                cl->setMode(CtrlList::DISCRETE);
            else
                cl->setMode(CtrlList::INTERPOLATE);

            cl->setCurVal(plugin->getParameterValue(i));
            addController(cl);
        }
    }
}/*}}}*/
Esempio n. 5
0
void Pipeline::showNativeGui(int idx, bool flag)
{
	int s = size();
	if(idx >= s)
		return;
    BasePlugin* p = (*this)[idx];
    if(p)
        p->showNativeGui(flag);
}
//==============================================================================
void SurfaceComponent::fillPluginComboBox (ComboBox* combo)
{
    combo->clear ();

    for (int i = 0; i < host->getPluginsCount (); i++)
    {
        BasePlugin* plugin = host->getPluginByIndex (i);
        combo->addItem (plugin->getName (), plugin->getUniqueHash ());
    }
}
Esempio n. 7
0
bool Pipeline::hasNativeGui(int idx)
{
	int s = size();
	if(idx >= s)
		return false;
    BasePlugin* p = (*this)[idx];
    if (p)
        return p->hasNativeGui();
    return false;
}
Esempio n. 8
0
QString Pipeline::name(int idx) const
{
	int s = (*this).size();
	if(idx >= s)
		return QString("empty");
    BasePlugin* p = (*this)[idx];
    if (p)
        return p->name();
    return QString("empty");
}
Esempio n. 9
0
bool Pipeline::nativeGuiVisible(int idx)
{
	int s = size();
	if(idx >= s)
		return false;
    BasePlugin* p = (*this)[idx];
    if (p)
        return p->nativeGuiVisible();
    return false;
}
Esempio n. 10
0
bool Pipeline::isActive(int idx) const
{
	int s = size();
	if(idx >= s)
		return false;

    BasePlugin* p = (*this)[idx];
    if (p)
        return p->active();
    return false;
}
Esempio n. 11
0
QString Pipeline::label(int idx) const
{
	int s = size();
	if(idx >= s)
    	return QString("");
		
    BasePlugin* p = (*this)[idx];
    if (p)
        return p->label();
    return QString("");
}
Esempio n. 12
0
void Pipeline::deleteGui(int idx)
{
	int s = size();
    if (idx >= s)
        return;

    BasePlugin* p = (*this)[idx];

    if (p)
        p->deleteGui();
}
//==============================================================================
void SurfaceComponent::sliderValueChanged (Slider* sliderThatWasMoved)
{
    SurfaceSlider* slider = dynamic_cast<SurfaceSlider*> (sliderThatWasMoved);
    if (slider)
    {
        BasePlugin* plugin = host->getPluginByUniqueHash (slider->getPlugin ());
        if (plugin)
        {
            plugin->setParameter (slider->getParameter (0), slider->getValue ());
        }
    }
}
//==============================================================================
void HostFilterComponent::changeListenerCallback (void* source)
{
    if (source == this)
    {
        closePluginEditorWindows ();
    }
    else if (source == getFilter())
    {
        clearComponents ();
        rebuildComponents ();

        // reopen windows saved with session
        Host* host = getFilter()->host;
        for (int j = 0; j < host->getPluginsCount(); j++)
        {
            BasePlugin* plugin = host->getPluginByIndex (j);
            if (plugin && plugin->getIntValue (PROP_WINDOWOPEN, 0))
                openPluginEditorWindow (plugin);
        }

        resized ();
    }
    else if (source == getFilter()->getTransport())
    {
        // update transport !
        CommandManager::getInstance()->commandStatusChanged ();
    }
    else if (source == &knownPluginList)
    {
       // save the plugin list every time it gets changed, so that if we're scanning
       // and it crashes, we've still saved the previous ones
       XmlElement* const savedPluginList = knownPluginList.createXml();

       if (savedPluginList != 0)
       {
           ApplicationProperties::getInstance()->getUserSettings()
                 ->setValue (T("pluginList"), savedPluginList);

           delete savedPluginList;

           ApplicationProperties::getInstance()->saveIfNeeded();
       }    
    }
    else
    {
        for (int i = pluginWindows.size(); --i >= 0;)
        {
            VstPluginWindow* window = pluginWindows.getUnchecked (i);
            if (window)
                window->updateParameters ();
        }
    }
}
void SurfaceComponent::fillParametersComboBox (ComboBox* combo, const uint32 pluginHash)
{
    combo->clear ();

    BasePlugin* plugin = host->getPluginByUniqueHash (pluginHash);
    if (plugin)
    {
        for (int i = 0; i < plugin->getNumParameters (); i++)
        {
            combo->addItem (plugin->getParameterName (i), i + 1);
        }
    }
}
Esempio n. 16
0
void Pipeline::updateGuis()
{
    for (iPluginI i = begin(); i != end(); ++i)
    {
        BasePlugin* p = (BasePlugin*)*i;
        if(p)
        {
            p->updateNativeGui();
            //if (p->gui())
            //    p->gui()->updateValues();
        }
    }
}
void SurfaceComponent::joystickValueChanged (Joystick* joystickThatWasMoved)
{
    SurfaceJoystick* joystick = dynamic_cast<SurfaceJoystick*> (joystickThatWasMoved);
    if (joystick)
    {
        BasePlugin* plugin = host->getPluginByUniqueHash (joystick->getPlugin ());
        if (plugin)
        {
            plugin->setParameter (joystick->getParameter (0), joystick->getHorizontalValue ());
            plugin->setParameter (joystick->getParameter (1), joystick->getVerticalValue ());
        }
    }
}
Esempio n. 18
0
void Pipeline::setActive(int idx, bool flag)
{
	int s = size();
	if(idx >= s)
		return;
    BasePlugin* p = (*this)[idx];
    if (p)
    {
        p->setActive(flag);

        if (p->gui())
            p->gui()->setActive(flag);
    }
}
Esempio n. 19
0
void EffectRack::choosePlugin(QListWidgetItem* it, bool replace)/*{{{*/
{
    PluginI* plugi = PluginDialog::getPlugin(track->type(), this);
    if (plugi)
    {
        BasePlugin* nplug = 0;

        if (plugi->type() == PLUGIN_LADSPA)
            nplug = new LadspaPlugin();
        else if (plugi->type() == PLUGIN_LV2)
            nplug = new Lv2Plugin();
        else if (plugi->type() == PLUGIN_VST)
            nplug = new VstPlugin();

        if (nplug)
        {
            if (nplug->init(plugi->filename(), plugi->label()))
            {
                // just in case is needed later
                //if (!audioDevice || audioDevice->deviceType() != AudioDevice::JACK_AUDIO)
                //    nplug->aboutToRemove();

                int idx = row(it);
                if (replace)
                {
                    audio->msgAddPlugin(track, idx, 0);
                    //Do this part from the GUI context so user interfaces can be properly deleted
                    // track->efxPipe()->insert(0, idx); was set on lv2 only
                }
                audio->msgAddPlugin(track, idx, nplug);
                nplug->setChannels(track->channels());
                nplug->setActive(true);
                song->dirty = true;
            }
            else
            {
                QMessageBox::warning(this, tr("Failed to load plugin"), tr("Plugin '%1'' failed to initialize properly, error was:\n%2").arg(plugi->name()).arg(get_last_error()));
                nplug->deleteMe();
                return;
            }
        }

        updateContents();
    }
}/*}}}*/
Esempio n. 20
0
void GraphComponent::nodeMoved (GraphNodeComponent* node, const int deltaX, const int deltaY)
{
//    DBG ("GraphComponent::nodeMoved " + String (deltaX) + " " + String (deltaY));

    jassert (node != 0);

    for (int i = 0; i < selectedNodes.getNumSelected (); i++)
    {
        GraphNodeComponent* selected = selectedNodes.getSelectedItem (i);
        if (selected
            && selected != node
            && ! selected->isLocked ())
        {
            BasePlugin* plugin = (BasePlugin*) selected->getUserData ();
            if (plugin)
            {
                int x = selected->getX() + deltaX;
                int y = selected->getY() + deltaY;

                x = jmax (0, jmin (getWidth () - selected->getWidth(), x));
                y = jmax (0, jmin (getHeight () - selected->getHeight(), y));
            
                plugin->setValue (PROP_GRAPHXPOS, x);
                plugin->setValue (PROP_GRAPHYPOS, y);
                
                selected->setTopLeftPosition (x, y);
            }
        }
    }

    BasePlugin* plugin = (BasePlugin*) node->getUserData ();
    if (plugin)
    {
        plugin->setValue (PROP_GRAPHXPOS, node->getX());
        plugin->setValue (PROP_GRAPHYPOS, node->getY());
    }

    Viewport* parent = findParentComponentOfClass ((Viewport*) 0);
    if (parent)
    {
        parent->notifyComponentChanged ();
    }
}
Esempio n. 21
0
void GraphComponent::nodeDoubleClicked (GraphNodeComponent* node,
                                        const MouseEvent& e)
{
    DBG ("GraphComponent::nodeDoubleClicked");

    jassert (node != 0);

    if (e.mods.isLeftButtonDown ())
    {
        BasePlugin* plugin = (BasePlugin*) node->getUserData ();
        if (plugin && (plugin->hasEditor ()
                       || plugin->wantsEditor ()
                       || plugin->isEditorInternal ()))
        {
            if (owner->isPluginEditorWindowOpen (plugin))
            {
                owner->closePluginEditorWindow (plugin);
            }
            else
            {
                if (plugin->hasEditor() || plugin->wantsEditor ())
                    owner->openPluginEditorWindow (plugin);
            }
        }
    }
}
Esempio n. 22
0
        void Run(TimeKeeper& timeKeeper)
        {
            // Warm up some threads
            ThreadSynchronizer threads(m_numThreads);

            // Allocate storage
            Result result;
            result.params.items = new ItemSet[m_numItems];
            memset(result.params.items, 0, sizeof(ItemSet) * m_numItems);
            result.params.numItems = m_numItems;
            result.params.numThreads = m_numThreads;
            result.plugin = m_plugin;
            result.failed._nonatomic = 0;
        
            // Fill in pairs
            Random keySeq;
            Random valueRandom;
            for (uint32_t i = 0; i < m_numItems; i++)
            {
                do { result.params.items[i].key = keySeq.generateUnique32(); } while (result.params.items[i].key == 0);
                for (int j = 0; j < m_numThreads; j++)
                    do { result.params.items[i].value[j] = valueRandom.generate32(); } while (result.params.items[i].value[j] == 0);
            }

            // Kick threads through the experiment several times
            for (int i = 0; i < 10; i++)
            {
                m_plugin->CreateCollection(m_tableSize);
                threads.run(threadFunc, &result.params);

                // Check result
                if (result.failed._nonatomic || !m_plugin->CheckCollection(&result.params))
                    timeKeeper.failures++;

                // Return average thread time
                timeKeeper.totalTime += threads.getAverageThreadRunningTime();
                timeKeeper.trials++;
            }
        }
Esempio n. 23
0
//==============================================================================
void GraphComponent::changeListenerCallback (void* source)
{
    ColourSelector* cs = (ColourSelector*) source;

    if (currentClickedNode)
    {
        Colour currentColour = cs->getCurrentColour();   
        
        BasePlugin* plugin = (BasePlugin*) currentClickedNode->getUserData ();
        if (plugin)
            plugin->setValue (PROP_GRAPHCOLOUR, currentColour.toString ());
        
        currentClickedNode->setNodeColour (currentColour);
        currentClickedNode->repaint ();

        Viewport* parent = findParentComponentOfClass ((Viewport*) 0);
        if (parent)
        {
            parent->notifyComponentChanged ();
        }
    }
}
Esempio n. 24
0
void Pipeline::apply(int ports, uint32_t nframes, float** buffer1)
{
    //fprintf(stderr, "Pipeline::apply data: nframes:%ld %e %e %e %e\n", nframes, buffer1[0][0], buffer1[0][1], buffer1[0][2], buffer1[0][3]);

    bool swap = false;

    for (iPluginI ip = begin(); ip != end(); ++ip)
    {
        BasePlugin* p = *ip;
        if (p && p->enabled())
        {
            p->setChannels(ports);

            if (p->hints() & PLUGIN_HAS_IN_PLACE_BROKEN)
            {
                if (swap)
                    p->process(nframes, buffer, buffer1, 0);
                else
                    p->process(nframes, buffer1, buffer, 0);
                swap = !swap;
            }
            else
            {
                if (swap)
                    p->process(nframes, buffer, buffer, 0);
                else
                    p->process(nframes, buffer1, buffer1, 0);
            }
        }
    }

    if (swap)
    {
        for (int i = 0; i < ports; ++i)
            AL::dsp->cpy(buffer1[i], buffer[i], nframes);
    }

    // p3.3.41
    //fprintf(stderr, "Pipeline::apply after data: nframes:%ld %e %e %e %e\n", nframes, buffer1[0][0], buffer1[0][1], buffer1[0][2], buffer1[0][3]);
}
Esempio n. 25
0
void GraphComponent::nodeSelected (GraphNodeComponent* node)
{
    DBG ("GraphComponent::nodeSelected");

    jassert (node != 0)

    switch (selectedNodes.getNumSelected ())
    {
    case 0: // no items selected
        {
            BasePlugin* plugin = (BasePlugin*) node->getUserData ();
            if (plugin)
                plugin->setValue (PROP_GRAPHSELECTED, 1);

            selectedNodes.addToSelection (node);

            node->repaint ();
        }
        break;
    default: // one or more items selected
        {
            if (! selectedNodes.isSelected (node))
            {
                for (int i = 0; i < selectedNodes.getNumSelected (); i++)
                {
                    GraphNodeComponent* selected = selectedNodes.getSelectedItem (i);

                    BasePlugin* plugin = (BasePlugin*) selected->getUserData ();
                    if (plugin)
                        plugin->setValue (PROP_GRAPHSELECTED, 0);

                    selected->repaint ();
                }

                selectedNodes.deselectAll ();

                BasePlugin* plugin = (BasePlugin*) node->getUserData ();
                if (plugin)
                    plugin->setValue (PROP_GRAPHSELECTED, 1);

                selectedNodes.addToSelection (node);

                node->repaint ();
            }
        }
        break;
    }
}
Esempio n. 26
0
void EffectRack::menuRequested(QListWidgetItem* it)/*{{{*/
{
    if (it == 0 || track == 0)
        return;
    RackSlot* curitem = (RackSlot*) it;

    Pipeline* epipe = track->efxPipe();

    int idx = row(curitem);
    QString name;
    bool mute = false;
    bool nativeGui = false;
    Pipeline* pipe = track->efxPipe();
    if (pipe)
    {
        name = pipe->name(idx);
        mute = (pipe->isActive(idx) == false);
        nativeGui = pipe->hasNativeGui(idx);
    }

    //enum { NEW, CHANGE, UP, DOWN, REMOVE, BYPASS, SHOW, SAVE };

    enum
    {
        NEW, CHANGE, UP, DOWN, REMOVE, BYPASS, SHOW, SHOW_NATIVE, SAVE
    };
    QMenu* menu = new QMenu;
    QAction* newAction = menu->addAction(tr("new"));
    QAction* changeAction = menu->addAction(tr("change"));
    QAction* upAction = menu->addAction(QIcon(*upIcon), tr("move up")); //,   UP, UP);
    QAction* downAction = menu->addAction(QIcon(*downIcon), tr("move down")); //, DOWN, DOWN);
    QAction* removeAction = menu->addAction(tr("remove")); //,    REMOVE, REMOVE);
    QAction* bypassAction = menu->addAction(tr("bypass")); //,    BYPASS, BYPASS);
    QAction* showGuiAction = menu->addAction(tr("show gui")); //,  SHOW, SHOW);
    QAction* showNativeGuiAction = menu->addAction(tr("show native gui")); //,  SHOW_NATIVE, SHOW_NATIVE);
    QAction* saveAction = menu->addAction(tr("save preset"));

    newAction->setData(NEW);
    changeAction->setData(CHANGE);
    upAction->setData(UP);
    downAction->setData(DOWN);
    removeAction->setData(REMOVE);
    bypassAction->setData(BYPASS);
    showGuiAction->setData(SHOW);
    showNativeGuiAction->setData(SHOW_NATIVE);
    saveAction->setData(SAVE);

    bypassAction->setCheckable(true);
    showGuiAction->setCheckable(true);
    showNativeGuiAction->setCheckable(true);

    bypassAction->setChecked(mute);
    showGuiAction->setChecked(pipe->guiVisible(idx));
    showNativeGuiAction->setEnabled(nativeGui);
    if (nativeGui)
        showNativeGuiAction->setChecked(pipe->nativeGuiVisible(idx));

    if (pipe->empty(idx))
    {
        menu->removeAction(changeAction);
        menu->removeAction(saveAction);
        upAction->setEnabled(false);
        downAction->setEnabled(false);
        removeAction->setEnabled(false);
        bypassAction->setEnabled(false);
        showGuiAction->setEnabled(false);
        showNativeGuiAction->setEnabled(false);
    }
    else
    {
        menu->removeAction(newAction);
        if (idx == 0)
            upAction->setEnabled(true);
        if (idx == ((int)epipe->size() - 1))
            downAction->setEnabled(false);
    }

    QPoint pt = QCursor::pos();
    QAction* act = menu->exec(pt, 0);

    //delete menu;
    if (!act)
    {
        delete menu;
        return;
    }

    int sel = act->data().toInt();
    delete menu;

    int pdepth = epipe->size();
    switch (sel)
    {
    case NEW:
    {
        choosePlugin(it);
        break;
    }
    case CHANGE:
    {
        choosePlugin(it, true);
        break;
    }
    case REMOVE:
    {
        BasePlugin* oldPlugin = (*epipe)[idx];
        oldPlugin->setActive(false);
        oldPlugin->aboutToRemove();

        if(debugMsg)
            qCritical("Plugin to remove now and here");

        audio->msgAddPlugin(track, idx, 0);
        song->dirty = true;
        break;
    }
    case BYPASS:
    {
        bool flag = !pipe->isActive(idx);
        pipe->setActive(idx, flag);
        break;
    }
    case SHOW:
    {
        bool flag = !pipe->guiVisible(idx);
        pipe->showGui(idx, flag);
        break;
    }
    case SHOW_NATIVE:
    {
        printf("Show native GUI called\n");
        bool flag = !pipe->nativeGuiVisible(idx);
        pipe->showNativeGui(idx, flag);
        break;
    }
    case UP:
        if (idx > 0)
        {
            setCurrentItem(item(idx - 1));
            pipe->move(idx, true);
        }
        break;
    case DOWN:
        if (idx < pdepth)
        {
            setCurrentItem(item(idx + 1));
            pipe->move(idx, false);
        }
        break;
    case SAVE:
        savePreset(idx);
        break;
    }
    //Already done on songChanged
    //updateContents();
    song->update(SC_RACK);
}/*}}}*/
Esempio n. 27
0
/*********************************************************************\
	Function name    : CCustomSubDialog::CreateLayout
	Description      :
	Created at       : 27.03.02, @ 12:04:28
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CCustomSubDialog::CreateLayout(void)
{
    Int32 i;
    GroupBegin(100, BFH_SCALEFIT | BFV_SCALEFIT, 2, 0, "", 0);
    Int32 lID = FIRST_CUSTOM_ELEMENT_ID;

    if (!m_pProp || m_pProp[0].type == CUSTOMTYPE_END)
    {
        GroupBegin(100, BFH_SCALEFIT, 1, 0, "", 0);
    }

    AddCheckbox(IDC_CUSTOM_OPEN_CLOSE, BFH_LEFT, 0, 0, "Open");
    Bool b = false;
    if (m_pElement)
    {
        CCustomElements* pElement = g_pCustomElements->GetItem(m_pElement->m_lElement);
        if (pElement)
        {
            BasePlugin *bs = (BasePlugin*)FindPlugin(pElement->m_lID, PLUGINTYPE_CUSTOMGUI);
            if (bs)
            {
                b = true;
                if (!(bs->GetInfo() & CUSTOMGUI_SUPPORT_LAYOUTSWITCH))
                    Enable(IDC_CUSTOM_OPEN_CLOSE, false);
                else
                    Enable(IDC_CUSTOM_OPEN_CLOSE, true);
            }
        }
    }
    if (!b)
        Enable(IDC_CUSTOM_OPEN_CLOSE, true);

    if (!m_pProp || m_pProp[0].type == CUSTOMTYPE_END)
    {
        AddStaticText(100, BFH_LEFT | BFV_CENTER, 0, 0, GeLoadString(IDS_CUSTOM_NO_PROPS), 0);
        GroupEnd();
    }

    AddStaticText(100, 0, 0, 0, "", 0);

    for (i = 0; m_pProp && m_pProp[i].type != CUSTOMTYPE_END; i++, lID++)
    {
        AddStaticText(100, BFH_LEFT | BFV_CENTER, 0, 0, m_pProp[i].ident, 0);
        switch (m_pProp[i].type)
        {
        case CUSTOMTYPE_FLAG:
            AddCheckbox(lID, BFH_LEFT | BFV_CENTER, 0, 0, "");
            break;
        case CUSTOMTYPE_LONG:
            AddEditNumber(lID, BFH_LEFT | BFV_CENTER);
            break;
        case CUSTOMTYPE_REAL:
            AddEditNumber(lID, BFH_LEFT | BFV_CENTER);
            break;
        case CUSTOMTYPE_STRING:
            AddEditText(lID, BFH_SCALEFIT | BFV_CENTER);
            break;
        case CUSTOMTYPE_VECTOR:
            AddEditNumber(lID++, BFH_LEFT | BFV_CENTER);
            AddEditNumber(lID++, BFH_LEFT | BFV_CENTER);
            AddEditNumber(lID, BFH_LEFT | BFV_CENTER);
            break;

        default:
            AddStaticText(lID, BFH_LEFT | BFV_CENTER, 0, 0, "wird auch noch ;-)", 0);
            break;
        }
    }
    /*if (!m_pProp || i == 0)
    	AddStaticText(100, BFH_LEFT | BFV_CENTER, 0, 0, GeLoadString(IDS_CUSTOM_NO_PROPS), 0);*/
    return true;
}
Esempio n. 28
0
void GraphComponent::graphChanged ()
{
    DBG ("GraphComponent::graphChanged");

    jassert (host != 0); // just to be sure !

    // AUDIO -
    ProcessingGraph* audioGraph = new ProcessingGraph ();

    // starting from inputs
    recalculateConnectionsRecursive (inputs,
                                     audioGraph,
                                     0,
                                     true);

    // then adding outputs if not already
    recalculateConnectionsRecursive (outputs,
                                     audioGraph,
                                     audioGraph->getNodeCount (),
                                     true);

    // all the others that are not connected (add them after input)
    for (int i = 0; i < nodes.size (); i++)
    {
        recalculateConnectionsRecursive (nodes.getUnchecked (i),
                                         audioGraph,
                                         1,
                                         true);
    }

    host->changePluginAudioGraph (audioGraph);

#if JUCE_DEBUG

    printf ("MIDI > \n");
    for (int i = 0; i < audioGraph->getNodeCount (); i++)
    {
        BasePlugin* plugin = (BasePlugin*) audioGraph->getData (i);
        printf ("%s > ", (const char*) plugin->getName());
    }
    printf ("\n");

    printf ("MIDI CONNECTIONS > \n");
    for (int i = 0; i < audioGraph->getNodeCount (); i++)
    {
        ProcessingNode* node = audioGraph->getNode (i);
        if (node)
        {
            for (int j = 0; j < node->getLinksCount (JOST_LINKTYPE_MIDI); j++)
            {
                ProcessingLink* conn = node->getLink (JOST_LINKTYPE_MIDI, j);
                printf ("%s,%d > %s,%d \n",
                        (const char*) ((BasePlugin*)node->getData())->getName(),
                        conn->sourcePort,
                        (const char*) ((BasePlugin*)conn->destination->getData())->getName(),
                        conn->destinationPort);
            }
        }
    }
    printf ("\n");

    printf ("AUDIO > \n");
    for (int i = 0; i < audioGraph->getNodeCount (); i++)
    {
        BasePlugin* plugin = (BasePlugin*) audioGraph->getData (i);
        printf ("%s > ", (const char*) plugin->getName());
    }
    printf ("\n");

    printf ("AUDIO CONNECTIONS > \n");
    for (int i = 0; i < audioGraph->getNodeCount (); i++)
    {
        ProcessingNode* node = audioGraph->getNode (i);
        if (node)
        {
            for (int j = 0; j < node->getLinksCount (JOST_LINKTYPE_AUDIO); j++)
            {
                ProcessingLink* conn = node->getLink (JOST_LINKTYPE_AUDIO, j);
                printf ("%s,%d > %s,%d \n",
                        (const char*) ((BasePlugin*)node->getData())->getName(),
                        conn->sourcePort,
                        (const char*) ((BasePlugin*)conn->destination->getData())->getName(),
                        conn->destinationPort);
            }
        }
    }
    printf ("\n");

#endif

    Viewport* parent = findParentComponentOfClass ((Viewport*) 0);
    if (parent)
    {
        parent->notifyComponentChanged ();
    }
}
Esempio n. 29
0
void GraphComponent::connectorPopupMenuSelected (GraphConnectorComponent* connector)
{
    DBG ("GraphComponent::connectorPopupMenuSelected");

    jassert (connector != 0);

    PopupMenu menu;

    Array<GraphConnectorComponent*> links;
    connector->getLinkedConnectors (links);

    int startCount = 0;
    
    if (links.size () > 0)
    {
        menu.addItem (1, "Break all wires");
        menu.addSeparator ();
        
        GraphConnectorComponent* conn;
        BasePlugin* linkedPlugin;
        
        for (int i = 0; i < links.size (); i++)
        {
            conn = links.getUnchecked (i);
            linkedPlugin = (BasePlugin*) conn->getParentGraphComponent ()->getUserData ();
            
            String itemString;
            itemString << "Unwire " 
                       << linkedPlugin->getName () 
                       << " (";

            switch (conn->getType ()) {
                case JOST_LINKTYPE_AUDIO: // audio
                    itemString << "audio port ";
                    break;
                case JOST_LINKTYPE_MIDI:
                    itemString << "midi port ";
                    break;
            }

            itemString << (conn->getConnectorID () + 1)
                       << ")";
            
            menu.addItem (10 + startCount, itemString);
            
            ++startCount;
        }
    }
    
    if (menu.getNumItems () > 0)
    {
        const int result = menu.show();
        switch (result)
        {
        case 1:
            connector->destroyAllLinks();
            connector->notifyGraphChanged ();
            break;
        default:
            if (result >= 10 && result < 10 + startCount)
            {
                connector->removeLinkWith (links.getUnchecked (result - 10));
                connector->notifyGraphChanged ();
            }
            break;
        }
    }
}
Esempio n. 30
0
void GraphComponent::nodePopupMenuSelected (GraphNodeComponent* node)
{
    DBG ("GraphComponent::nodePopupMenuSelected");

    jassert (node != 0);

    currentClickedNode = node;

    bool addFirstSeparator = false;
    PopupMenu menu, subMenu;

    BasePlugin* plugin = (BasePlugin*) node->getUserData ();

    if (plugin->hasEditor ()
        || plugin->wantsEditor ()
        || plugin->isEditorInternal ())
    {
        menu.addItem (1, "Open editor");
        addFirstSeparator = true;
    }

    if (node != inputs && node != outputs)
    {
        menu.addItem (2, "Remove " + plugin->getName());
        addFirstSeparator = true;
    }

    if (addFirstSeparator)
        menu.addSeparator ();

    menu.addItem (3, "Lock", true, node->isLocked ());

    // node colour..
    ColourSelector colourSelector;
    colourSelector.setName (T("background"));
    colourSelector.setCurrentColour (node->getNodeColour ());
    colourSelector.addChangeListener (this);

    subMenu.addCustomItem (1234, &colourSelector, 300, 300, false);
    menu.addSubMenu (T("Colour"), subMenu);
    menu.addSeparator ();

    menu.addItem (4, "Mute", true, plugin->isMuted ());
    menu.addItem (5, "Bypass", true, plugin->isBypass ());
    menu.addItem (6, "Solo", false, false);
    menu.addSeparator ();

    int inputLinks = node->getInputLinksCount ();
    int outputLinks = node->getOutputLinksCount ();

    if (inputLinks > 0 && outputLinks > 0)
        menu.addItem (7, "Disconnect all");
    if (inputLinks > 0)
        menu.addItem (8, "Disconnect inputs");
    if (outputLinks > 0)
        menu.addItem (9, "Disconnect outputs");

    const int result = menu.show();
    switch (result)
    {
    case 1: // Open editor
        {
            owner->openPluginEditorWindow (plugin);
            break;
        }

    case 2: // Close
        {
            if (owner->isPluginEditorWindowOpen (plugin))
                owner->closePluginEditorWindow (plugin);

            if (plugin)
            {
                host->closePlugin (plugin);

                selectedNodes.deselect (node);
                deletePluginNode (node);

                graphChanged ();
            }

            break;
        }
    case 3: // Lock / unlock
        {
            bool lockedState = ! node->isLocked ();

            if (plugin)
                plugin->setValue (PROP_GRAPHLOCKED, lockedState);

            node->setLocked (lockedState);
            node->repaint ();
        }
        break;
    case 4: // Mute
        {
            if (plugin)
                plugin->setMuted (! plugin->isMuted());
        }
        break;
    case 5: // Bypass
        {
            if (plugin)
                plugin->setBypass (! plugin->isBypass());
        }
        break;
    case 6: // Solo (TODO)
        break;
    case 7: // Disconnect all
        node->breakAllLinks();
        break;
    case 8: // Disconnect inputs
        node->breakInputLinks();
        break;
    case 9: // Disconnect outputs
        node->breakOutputLinks();
        break;
    default:
        break;
    }
    
    currentClickedNode = 0;
}