Example #1
0
void Valter::autoInitialization()
{
    if (getGlobalSetting("autoInit").compare("true") == 0)
    {
        autoScanAndConnectAllControlDevices();
        typedef map<string, IValterModule*>::iterator it_type;
        for(it_type iterator = valterModulesMap.begin(); iterator != valterModulesMap.end(); iterator++)
        {
            IValterModule *valterModule = valterModulesMap[iterator->first];
            if (valterModule->getControlDeviceIsSet())
            {
                valterModule->sendCommand("WDINTENTIONALRESETON");
                valterModule->getControlDevice()->setResetWDTimer(true);
            }
        }
    }
}
Example #2
0
void mlrVSTGUI::setupTempoUI(int &xPosition, int &yPosition)
{
    int bpmSliderWidth = 180, bpmSliderHeight = 30;
    int bpmLabelWidth = bpmSliderWidth, bpmLabelHeight = 16;

    int quantiseBoxWidth = 80, quantiseBoxHeight = 30;
    int quantiseLabelWidth = quantiseBoxWidth, quantiseLabelHeight = 16;

    ///////////////////////
    // First add the labels
    addAndMakeVisible(&bpmLabel);
    bpmLabel.setBounds(xPosition, yPosition, bpmLabelWidth, bpmLabelHeight);
    bpmLabel.setColour(Label::textColourId, Colours::white);
    bpmLabel.setColour(Label::backgroundColourId, Colours::black);
    bpmLabel.setFont(defaultFont);
    xPosition += bpmLabelWidth + PAD_AMOUNT;

    addAndMakeVisible(&quantiseLabel);
    quantiseLabel.setBounds(xPosition, yPosition, quantiseLabelWidth, quantiseLabelHeight);
    quantiseLabel.setColour(Label::textColourId, Colours::white);
    quantiseLabel.setColour(Label::backgroundColourId, Colours::black);
    quantiseLabel.setFont(defaultFont);

    xPosition = PAD_AMOUNT;
    yPosition += quantiseLabelHeight;

    ///////////////////////////////
    // Then add sliders and boxes
    addAndMakeVisible(&bpmSlider);
    bpmSlider.setBounds(xPosition, yPosition, bpmSliderWidth, bpmSliderHeight);
    bpmSlider.setColour(Slider::backgroundColourId, Colours::black.withAlpha(0.3f));
    bpmSlider.setSliderStyle(Slider::LinearBar);
    bpmSlider.setRange(20.0, 300.0, 0.01);
    bpmSlider.setTextBoxIsEditable(true);
    bpmSlider.addListener(this);
    bpmSlider.setLookAndFeel(&overrideLF);

    useExternalTempo = *static_cast<const bool*>(getGlobalSetting(GlobalSettings::sUseExternalTempo));
    if (useExternalTempo)
    {
        bpmSlider.setEnabled(false);
        bpmLabel.setText("bpm (external)", NotificationType::dontSendNotification);
    }
    else
    {
        double newBPM = *static_cast<const double*>(getGlobalSetting(GlobalSettings::sCurrentBPM));
        bpmSlider.setValue(newBPM);
        bpmLabel.setText("bpm (internal)", NotificationType::dontSendNotification);
    }

    xPosition += bpmSliderWidth + PAD_AMOUNT;

    // add dropdown box for quantisation settings
    addAndMakeVisible(&quantiseSettingsCbox);
    quantiseSettingsCbox.setBounds(xPosition, yPosition, quantiseBoxWidth, quantiseBoxHeight);
    quantiseSettingsCbox.addListener(this);

    // add items to it
    quantiseSettingsCbox.addItem("None", 1);
    for (int i = 2, denom = 1; i < 8; ++i, denom *= 2)
        quantiseSettingsCbox.addItem(String(denom) + "n", i);

    // and load the stored selection if suitable
    const int menuSelection = *static_cast<const int*>(parent->getGlobalSetting(GlobalSettings::sQuantiseMenuSelection));
    if (menuSelection >= 0 && menuSelection < 8) quantiseSettingsCbox.setSelectedId(menuSelection);
    else quantiseSettingsCbox.setSelectedId(1);

    quantiseSettingsCbox.setLookAndFeel(&overrideLF);

    xPosition = PAD_AMOUNT;
    yPosition += bpmSliderHeight + PAD_AMOUNT;
}