本文整理汇总了C++中Pattern::getInstrumentAt方法的典型用法代码示例。如果您正苦于以下问题:C++ Pattern::getInstrumentAt方法的具体用法?C++ Pattern::getInstrumentAt怎么用?C++ Pattern::getInstrumentAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pattern
的用法示例。
在下文中一共展示了Pattern::getInstrumentAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setState
void StateWriter::setState (const void* data, int sizeInBytes)
{
DBG("StateWriter::setState(): Loading state.")
ValueTree settingsTree = ValueTree::readFromData (data, sizeInBytes);
ValueTree libTree = settingsTree.getChildWithName ("library");
library->setThreshold (libTree.getProperty ("threshold"));
library->setReleaseTicks (libTree.getProperty ("release"));
library->setVelocityScale (libTree.getProperty ("velocity"));
ValueTree patternsTree = settingsTree.getChildWithName ("patterns");
for (int i = 0; i < patternsTree.getNumChildren(); i++) {
Pattern* pattern = library->getPattern (i);
ValueTree patternTree = patternsTree.getChild (i);
ValueTree instrumentsTree = patternTree.getChildWithName ("instruments");
for (int j = 0; j < instrumentsTree.getNumChildren(); j++) {
ValueTree instrumentTree = instrumentsTree.getChild (j);
Instrument* instrument = pattern->getInstrumentAt (j);
instrument->setIndex (instrumentTree.getProperty ("index"));
instrument->setName (instrumentTree.getProperty ("name"));
instrument->setNoteNumber (instrumentTree.getProperty ("noteNumber"));
}
}
ValueTree seqTree = settingsTree.getChildWithName ("sequencer");
sequencer->setSequencerNum (seqTree.getProperty("sequencerNum"));
}
示例2: InstrumentComponent
InstrumentListComponent::InstrumentListComponent (Sequencer* sequencer_) :
Component ("InstrumentListComponent"),
sequencer (sequencer_),
lastPattern (nullptr),
lastActiveInstrument (nullptr)
{
Pattern* pattern = sequencer->getPattern();
lastPattern = pattern;
int numInstruments = pattern->getNumInstruments();
for (int i = 0; i < numInstruments; i++) {
Instrument* instrument = pattern->getInstrumentAt (i);
InstrumentComponent* instrumentComponent = new InstrumentComponent (instrument);
addAndMakeVisible (instrumentComponent);
instrumentComponents.add (instrumentComponent);
}
for (int i = 0; i < numInstruments; i++) {
ToggleButton* btn = new ToggleButton ((String)i);
btn->setRadioGroupId (kRadioGroupId);
btn->setColour (ToggleButton::textColourId, Colours::white);
addAndMakeVisible (btn);
btn->addListener (this);
activeButtons.add (btn);
}
startTimer (100);
}
示例3: buttonClicked
// Button::Listener methods
void InstrumentListComponent::buttonClicked (Button* button)
{
int instrumentNum = button->getButtonText().getIntValue();
Pattern* pattern = sequencer->getPattern();
Instrument* instrument = pattern->getInstrumentAt (instrumentNum);
pattern->setActiveInstrument (instrument);
lastActiveInstrument = instrument;
}
示例4: timerCallback
// Timer methods
void InstrumentListComponent::timerCallback()
{
Pattern* pattern = sequencer->getPattern();
if (sequencer->getPattern() != lastPattern) {
lastPattern = pattern;
for (int i = 0; i < pattern->getNumInstruments(); i++) {
Instrument* instrument = pattern->getInstrumentAt (i);
instrumentComponents[i]->setInstrument (instrument);
}
}
if (pattern->getActiveInstrument() != lastActiveInstrument) {
lastActiveInstrument = pattern->getActiveInstrument();
int i = lastActiveInstrument->getIndex();
activeButtons[i]->setToggleState (true, false);
}
}
示例5: getState
void StateWriter::getState (MemoryBlock& destData)
{
DBG("StateWriter::getState(): Saving state.")
ValueTree settingsTree ("settings");
ValueTree libTree ("library");
libTree.setProperty ("threshold", library->getThreshold(), nullptr);
libTree.setProperty ("release", library->getReleaseTicks(), nullptr);
libTree.setProperty ("velocity", library->getVelocityScale(), nullptr);
settingsTree.addChild (libTree, -1, nullptr);
ValueTree patternsTree ("patterns");
for (int i = 0; i < library->getNumPatterns(); i++) {
Pattern* pattern = library->getPattern (i);
ValueTree patternTree ("pattern");
ValueTree instrumentsTree ("instruments");
for (int j = 0; j < pattern->getNumInstruments(); j++) {
Instrument* instrument = pattern->getInstrumentAt (j);
ValueTree instrumentTree ("instrument");
instrumentTree.setProperty ("index", instrument->getIndex(), nullptr);
instrumentTree.setProperty ("name", instrument->getName(), nullptr);
instrumentTree.setProperty ("noteNumber", instrument->getNoteNumber(), nullptr);
instrumentsTree.addChild (instrumentTree, -1, nullptr);
}
patternTree.addChild (instrumentsTree, -1, nullptr);
patternsTree.addChild (patternTree, -1, nullptr);
}
settingsTree.addChild (patternsTree, -1, nullptr);
ValueTree seqTree ("sequencer");
seqTree.setProperty ("sequencerNum", sequencer->getSequencerNum(), nullptr);
settingsTree.addChild (seqTree, -1, nullptr);
MemoryOutputStream stream (destData, false);
settingsTree.writeToStream (stream);
}