本文整理汇总了C++中CtrlrModulator类的典型用法代码示例。如果您正苦于以下问题:C++ CtrlrModulator类的具体用法?C++ CtrlrModulator怎么用?C++ CtrlrModulator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CtrlrModulator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replaceComponent
void CtrlrPanelCanvas::replaceComponent (CtrlrModulator &modulator, const String &targetComponentType)
{
CtrlrComponent *oldComponent = modulator.getComponent();
CtrlrComponent *newComponent = nullptr;
/* detach the existing component so it doesn't get notified about anything, the pointer will be invalid */
if (getOwner().getSelection())
{
getOwner().getSelection()->deselectAll();
getOwner().getSelection()->dispatchPendingMessages();
getOwner().getSelection()->removeChangeListener(oldComponent);
}
if (oldComponent)
{
/* keep a copy of the old properties, we need to find out if the component is in a group */
ValueTree oldComponentProperties = oldComponent->getObjectTree().createCopy();
modulator.setComponentType(targetComponentType, false);
/* get the new component pointer and attach it */
newComponent = modulator.getComponent();
if (getOwner().getSelection())
getOwner().getSelection()->addChangeListener (newComponent);
addAndMakeVisibleNg (modulator.getComponent(), nullptr, true);
/* attach the new component to any group components the old component was int */
if (oldComponentProperties.hasProperty(Ids::componentGroupName))
{
CtrlrGroup *group = dynamic_cast<CtrlrGroup*>(owner.getOwner().getComponent(oldComponentProperties.getProperty(Ids::componentGroupName)));
if (group)
{
group->setOwned (newComponent, true);
}
}
if (oldComponentProperties.hasProperty(Ids::componentTabName))
{
CtrlrTabsComponent *tabs = dynamic_cast<CtrlrTabsComponent*>(owner.getOwner().getComponent(oldComponentProperties.getProperty(Ids::componentTabName)));
if (tabs)
{
tabs->setOwned (newComponent, oldComponentProperties.getProperty(Ids::componentTabId), true);
}
}
/* copy any old properties to the new component */
for (int i=0; i<oldComponentProperties.getNumProperties(); i++)
{
const Identifier propName = oldComponentProperties.getPropertyName(i);
const var propValue = oldComponentProperties.getProperty(propName);
if (propName != Ids::uiType)
{
if (newComponent->getObjectTree().hasProperty(propName))
newComponent->setProperty (propName, propValue);
}
}
}
}
示例2: refreshTargetModulationPropertyList
void CtrlrPanelComponentProperties::refreshTargetModulationPropertyList (const ValueTree &sourceModulationTree)
{
CtrlrModulator *target = owner.getOwner().getModulator (sourceModulationTree.getProperty (Ids::modulatorLinkedToModulator));
if (target)
{
modulatorPropertyList.clear();
modulatorPropertyList.add (COMBO_NONE_ITEM);
if ((bool)sourceModulationTree.getProperty (Ids::modulatorLinkedToComponent) == true)
{
CtrlrComponent *c = target->getComponent();
if (c)
{
for (int i=0; i<c->getComponentTree().getNumProperties(); i++)
{
modulatorPropertyList.add (c->getComponentTree().getPropertyName(i).toString());
}
}
}
else
{
for (int i=0; i<target->getModulatorTree().getNumProperties(); i++)
{
modulatorPropertyList.add (target->getModulatorTree().getPropertyName(i).toString());
}
}
}
}
示例3: gatherSnapshotData
void CtrlrPanelMIDISnapshot::gatherSnapshotData()
{
buffer.clear();
for (int i=0; i<owner.getModulators().size(); i++)
{
CtrlrModulator *m = owner.getModulators()[i];
if (m->getMidiMessagePtr())
{
if (m->getComponent())
{
if ((int)m->getComponent()->getProperty(Ids::componentRadioGroupId) > 0)
{
if (m->getComponent()->getToggleState() == false)
continue;
else if (!(bool)m->getProperty(Ids::modulatorExcludeFromSnapshot))
addCtrlrMidiMessageToBuffer (buffer, m->getMidiMessage());
}
else if (!(bool)m->getProperty(Ids::modulatorExcludeFromSnapshot))
{
addCtrlrMidiMessageToBuffer (buffer, m->getMidiMessage());
}
}
}
}
}
示例4: removeFromTab
void CtrlrComponent::removeFromTab ()
{
CtrlrModulator *tabsModulator = owner.getOwner().getModulator(getProperty(Ids::componentTabName));
if (tabsModulator)
{
CtrlrTabsComponent *tabsComponent = dynamic_cast<CtrlrTabsComponent*>(tabsModulator->getComponent());
if (tabsComponent)
{
tabsComponent->setOwned (this, getProperty(Ids::componentTabId), false);
}
}
}
示例5: getParameter
float CtrlrProcessor::getParameter (int index)
{
CtrlrModulator *m = ctrlrManager->getModulatorByVstIndex (index);
if (m)
{
return (m->getProcessor().getValueForHost());
}
else
{
return 0.0f;
}
}
示例6: getModulator
int CtrlrManager::getModulatorVstIndexByName(const String &modulatorName)
{
CtrlrModulator *m = getModulator(modulatorName);
if (m)
{
return (m->getVstIndex());
}
else
{
return (-1);
}
}
示例7: CtrlrComponent
//==============================================================================
CtrlrLCDLabel::CtrlrLCDLabel (CtrlrModulator &owner)
: CtrlrComponent(owner),
ctrlrLabel (0)
{
addAndMakeVisible (ctrlrLabel = new Label ("ctrlrLabel",
"LCD TEST"));
ctrlrLabel->setFont (Font (16.0000f, Font::plain));
ctrlrLabel->setJustificationType (Justification::centred);
ctrlrLabel->setEditable (false, false, false);
ctrlrLabel->setColour (Label::backgroundColourId, Colour (0x0));
ctrlrLabel->setColour (Label::textColourId, Colours::black);
ctrlrLabel->setColour (TextEditor::textColourId, Colours::black);
ctrlrLabel->setColour (TextEditor::backgroundColourId, Colour (0x0));
//[UserPreSize]
setBufferedToImage (true);
ctrlrLabel->setBufferedToImage (true);
owner.setProperty (Ids::modulatorIsStatic, true);
owner.setProperty (Ids::modulatorVstExported, false);
setProperty (Ids::uiLabelBgColour, "0xff000000");
setProperty (Ids::uiLabelTextColour, "0xff56c312");
setProperty (Ids::uiLabelOutline, 0);
setProperty (Ids::uiLabelOutlineColour, "0x00000000");
setProperty (Ids::uiLabelJustification, "centred");
setProperty (Ids::uiLabelFitFont, false);
setProperty (Ids::uiLCDLabelFont, 5);
setProperty (Ids::uiLCDLabelFontHeight, 18);
setProperty (Ids::uiLabelText, "Label text");
setProperty (Ids::uiLabelDisplaysAllValues, false);
setProperty (Ids::uiLabelDisplayFormat, "%n(%N) = %v(%h)");
setProperty (Ids::uiLabelInputHighlightTextColour, "0xffffffff");
setProperty (Ids::uiLabelInputHighlightColour, "0xff0000ff");
setProperty (Ids::uiLabelEditOnSingleClick, false);
setProperty (Ids::uiLabelEditOnDoubleClick, false);
setProperty (Ids::uiLabelEditFocusDiscardsChanges, true);
setProperty (Ids::uiLabelInputAllowedChars, "");
setProperty (Ids::uiLabelInputAllowedChars, "");
setProperty (Ids::uiLabelInputMaxLength, 1024);
setProperty (Ids::uiLabelChangedCbk, COMBO_NONE_ITEM);
componentTree.addListener (this);
//[/UserPreSize]
setSize (96, 32);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
示例8: CtrlrComponent
//==============================================================================
CtrlrToggleButton::CtrlrToggleButton (CtrlrModulator &owner)
: CtrlrComponent(owner),
ctrlrButton (0)
{
addAndMakeVisible (ctrlrButton = new ToggleButton ("ctrlrButton"));
ctrlrButton->setButtonText ("Button");
ctrlrButton->addListener (this);
//[UserPreSize]
ctrlrButton->setBufferedToImage (true);
setProperty (Ids::uiButtonTextColourOn, "0xff000000");
setProperty (Ids::uiToggleButtonFocusOutline, "0x00000000");
setProperty (Ids::uiToggleButtonText, "Button");
setProperty (Ids::uiButtonTrueValue, 1);
setProperty (Ids::uiButtonFalseValue, 0);
setProperty (Ids::uiButtonColourOff, "0xff0000ff");
owner.setProperty (Ids::modulatorMax, 1);
owner.setProperty (Ids::modulatorMin, 0);
//[/UserPreSize]
setSize (88, 32);
//[Constructor] You can add your own custom stuff here..
//owner.getProcessor().setValueFromGUI (0, true);
//[/Constructor]
}
示例9: CtrlrComponent
CtrlrMidiKeyboard::CtrlrMidiKeyboard (CtrlrModulator &owner)
: CtrlrComponent(owner),
midiKeyboard (0)
{
addAndMakeVisible (midiKeyboard = new MidiKeyboardComponent (keyboardState, MidiKeyboardComponent::horizontalKeyboard ));
midiKeyboard->setName ("midiKeyboard");
keyboardState.addListener (this);
setProperty (Ids::uiMidiKeyboardOrientation, "horizontalKeyboard");
setProperty (Ids::uiMidiKeyboardWhiteButtonColour, "0xffffffff");
setProperty (Ids::uiMidiKeyboardBlackButtonColour, "0xff000000");
setProperty (Ids::uiMidiKeyboardSeparatorLineColour, "0xff000000");
setProperty (Ids::uiMidiKeyboardMouseOverColour, "0xffff0000");
setProperty (Ids::uiMidiKeyboardMouseDownColour, "0xff0000ff");
setProperty (Ids::uiMidiKeyboardTextLabelColour, "0xff000000");
setProperty (Ids::uiMidiKeyboardButtonBackgroundColour, "0xff0f0f0f");
setProperty (Ids::uiMidiKeyboardButtonArrowColour, "0xff000000");
setProperty (Ids::uiMidiKeyboardLowestVisibleKey, 48);
setProperty (Ids::uiMidiKeyboardBaseOctaveKeyPress, 0);
setProperty (Ids::uiMidiKeyboardOctaveFroMiddleC, 3);
setProperty (Ids::uiMidiKeyboardMapToNoteNumber, false);
setSize (256, 64);
owner.getOwnerPanel().addPanelListener (this);
midiKeyboard->setKeyPressBaseOctave( 5 );
midiKeyboard->setOctaveForMiddleC( 4 );
}
示例10: setParameter
void CtrlrProcessor::setParameter (int index, float newValue)
{
CtrlrModulator *m = ctrlrManager->getModulatorByVstIndex (index);
if (m == nullptr)
{
return;
}
else if (newValue > 1.0f || newValue < 0.000000f)
{
return;
}
else
{
return (m->getProcessor().setValueFromHost(newValue));
}
}
示例11: CtrlrComponent
//==============================================================================
CtrlrGroup::CtrlrGroup (CtrlrModulator &owner)
: CtrlrComponent(owner), content(*this),
label (0)
{
addAndMakeVisible (label = new Label ("new label",
"Group Text"));
label->setFont (Font (14.0000f, Font::bold));
label->setJustificationType (Justification::centred);
label->setEditable (false, false, false);
label->setColour (TextEditor::textColourId, Colours::black);
label->setColour (TextEditor::backgroundColourId, Colour (0x0));
//[UserPreSize]
addAndMakeVisible(&content);
componentTree.addListener (this);
owner.setProperty (Ids::modulatorIsStatic, true);
owner.setProperty (Ids::modulatorVstExported, false);
setProperty (Ids::uiGroupText, "Group Text");
setProperty (Ids::uiGroupTextColour, "0xff000000");
setProperty (Ids::uiGroupOutlineColour1, "0xffa3a3a3");
setProperty (Ids::uiGroupOutlineColour2, "0xffffffff");
setProperty (Ids::uiGroupBackgroundColour1, "0xffa3a3a3");
setProperty (Ids::uiGroupBackgroundColour2, "0xffffffff");
setProperty (Ids::uiGroupOutlineGradientType, "Vertical");
setProperty (Ids::uiGroupBackgroundGradientType, 1);
setProperty (Ids::uiGroupBackgroundImage, "");
setProperty (Ids::uiGroupBackgroundImageLayout, 36);
setProperty (Ids::uiGroupBackgroundImageAlpha, 255);
setProperty (Ids::uiGroupTextPlacement, "top");
setProperty (Ids::uiGroupTextFont, FONT2STR (Font(14)));
setProperty (Ids::uiGroupOutlineThickness, 2.0);
setProperty (Ids::uiGroupOutlineRoundAngle, 8.0);
setProperty (Ids::uiGroupTextMargin, 0);
setProperty (Ids::componentLabelVisible, false);
owner.getModulatorTree().addListener (this);
//[/UserPreSize]
setSize (128, 128);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
示例12: setProgramState
void CtrlrPanel::setProgram(ValueTree programTree, const bool sendSnapshotNow)
{
ValueTree program;
if (programTree.hasType(Ids::panelState))
{
program = programTree;
}
else
{
if (programTree.getChildWithName(Ids::panelState).isValid())
{
program = programTree.getChildWithName(Ids::panelState);
}
}
setProgramState (true);
if (program.isValid())
{
for (int i=0; i<program.getNumChildren(); i++)
{
if (program.getChild(i).hasType(Ids::value))
{
CtrlrModulator *m = getModulator (program.getChild(i).getProperty(Ids::name));
if (m)
{
m->setRestoreState (true);
m->getProcessor().setValueFromGUI (program.getChild(i).getProperty(Ids::value), true);
if (m->getComponent())
{
m->getComponent()->setComponentValue (program.getChild(i).getProperty(Ids::value), false);
}
m->getProcessor().handleUpdateNowIfNeeded();
m->setRestoreState (false);
}
}
}
if ((bool)getProperty (Ids::panelMidiSnapshotAfterProgramChange) == true)
{
snapshot.sendSnapshot();
}
if (luaPanelProgramChangedCbk && !luaPanelProgramChangedCbk.wasObjectDeleted())
{
if (luaPanelProgramChangedCbk->isValid())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelProgramChangedCbk);
}
}
}
setProgramState (false);
if (sendSnapshotNow)
{
_DBG("CtrlrPanel::setProgram sendSnapshotNow");
sendSnapshot();
}
}
示例13: CtrlrModulator
CtrlrModulator *CtrlrPanel::createNewModulator(const Identifier &guiType)
{
CtrlrModulator *newModulator = nullptr;
if (CtrlrComponentTypeManager::isStatic(guiType))
{
newModulator = new CtrlrModulator (*this);
}
else
{
newModulator = new CtrlrModulator (*this, owner.getNextVstIndex());
}
newModulator->setProperty (Ids::name, getUniqueModulatorName("modulator-1"));
addModulator (newModulator);
return (newModulator);
}
示例14: gatherSnapshotData
void CtrlrPanelMIDISnapshot::gatherSnapshotData()
{
buffer.clear();
for (int i=0; i<owner.getModulators().size(); i++)
{
CtrlrModulator *m = owner.getModulators()[i];
if (m->getMidiMessagePtr())
{
if (m->getComponent())
{
if ((int)m->getComponent()->getProperty(Ids::componentRadioGroupId) > 0)
{
if (m->getComponent()->getToggleState() == false)
continue;
else if (!(bool)m->getProperty(Ids::modulatorExcludeFromSnapshot))
addCtrlrMidiMessageToBuffer (buffer, m->getMidiMessage());
}
else if (!(bool)m->getProperty(Ids::modulatorExcludeFromSnapshot))
{
addCtrlrMidiMessageToBuffer (buffer, m->getMidiMessage());
}
}
}
}
showDialog = owner.getProperty(Ids::panelMidiSnapshotShowProgress);
if (showDialog)
{
if (alertWindow == nullptr)
alertWindow = LookAndFeel::getDefaultLookAndFeel().createAlertWindow ("MIDI Snapshot", String(), "Stop", String(), String(), AlertWindow::NoIcon, 1, nullptr);
alertWindow->setEscapeKeyCancels (false);
alertWindow->addProgressBarComponent (progress);
}
else
{
alertWindow = nullptr;
}
if (luaPanelMidiSnapshotPreCbk && !luaPanelMidiSnapshotPreCbk.wasObjectDeleted())
{
if (luaPanelMidiSnapshotPreCbk->isValid())
{
owner.getCtrlrLuaManager().getMethodManager().call (luaPanelMidiSnapshotPreCbk, &buffer);
}
}
}
示例15: program
ValueTree CtrlrPanel::getProgram(ValueTree treeToWriteTo)
{
if (treeToWriteTo.isValid())
{
treeToWriteTo.removeAllChildren(0);
}
ValueTree program(Ids::panelState);
program.setProperty (Ids::panelVersionMajor, getProperty(Ids::panelVersionMajor), 0);
program.setProperty (Ids::panelVersionMinor, getProperty(Ids::panelVersionMinor), 0);
program.setProperty (Ids::time, Time::getCurrentTime().currentTimeMillis(), 0);
for (int i=0; i<ctrlrModulators.size(); i++)
{
CtrlrModulator *m = ctrlrModulators[i];
ValueTree v(Ids::value);
if ((bool)m->getProperty (Ids::modulatorIsStatic) == true)
continue;
v.setProperty(Ids::name, m->getName(),0);
v.setProperty(Ids::value, m->getModulatorValue(),0);
if (treeToWriteTo.isValid())
{
treeToWriteTo.addChild (v,-1,0);
}
else
{
program.addChild (v,-1,0);
}
}
return (program);
}