本文整理汇总了C++中Pattern::getNumInstruments方法的典型用法代码示例。如果您正苦于以下问题:C++ Pattern::getNumInstruments方法的具体用法?C++ Pattern::getNumInstruments怎么用?C++ Pattern::getNumInstruments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pattern
的用法示例。
在下文中一共展示了Pattern::getNumInstruments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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);
}
}
示例3: 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);
}