本文整理汇总了C++中MidiDevice::getProgramName方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiDevice::getProgramName方法的具体用法?C++ MidiDevice::getProgramName怎么用?C++ MidiDevice::getProgramName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiDevice
的用法示例。
在下文中一共展示了MidiDevice::getProgramName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: program
void
MIDIInstrumentParameterPanel::updateVariationComboBox()
{
RG_DEBUG << "updateVariationComboBox() begin...";
if (!getSelectedInstrument())
return;
MidiDevice *md =
dynamic_cast<MidiDevice *>(getSelectedInstrument()->getDevice());
if (!md) {
std::cerr << "WARNING: MIDIInstrumentParameterPanel::updateVariationComboBox(): No MidiDevice for Instrument " << getSelectedInstrument()->getId() << '\n';
return;
}
RG_DEBUG << "updateVariationComboBox(): Variation type is " << md->getVariationType();
if (md->getVariationType() == MidiDevice::NoVariations) {
showVariation(false);
return;
}
// Get the variations.
bool useMSB = (md->getVariationType() == MidiDevice::VariationFromMSB);
MidiByteList variationBanks;
if (useMSB) {
MidiByte lsb = getSelectedInstrument()->getLSB();
variationBanks = md->getDistinctMSBs(getSelectedInstrument()->isPercussion(),
lsb);
RG_DEBUG << "updateVariationComboBox(): Have " << variationBanks.size() << " variations for LSB " << lsb;
} else {
MidiByte msb = getSelectedInstrument()->getMSB();
variationBanks = md->getDistinctLSBs(getSelectedInstrument()->isPercussion(),
msb);
RG_DEBUG << "updateVariationComboBox(): Have " << variationBanks.size() << " variations for MSB " << msb;
}
// Convert variationBanks to a ProgramList.
ProgramList variations;
// For each variation
for (size_t i = 0; i < variationBanks.size(); ++i) {
// Assemble the program for the variation.
MidiBank bank;
if (useMSB) {
bank = MidiBank(getSelectedInstrument()->isPercussion(),
variationBanks[i],
getSelectedInstrument()->getLSB());
} else {
bank = MidiBank(getSelectedInstrument()->isPercussion(),
getSelectedInstrument()->getMSB(),
variationBanks[i]);
}
MidiProgram program(bank, getSelectedInstrument()->getProgramChange());
// Skip any programs without names.
if (md->getProgramName(program) == "")
continue;
variations.push_back(program);
}
// Compute the current variation.
// ??? This might be combined into the previous for loop.
int currentVariation = -1;
// For each variation
for (size_t i = 0; i < variations.size(); ++i) {
if (getSelectedInstrument()->getProgram().partialCompare(variations[i])) {
currentVariation = i;
break;
}
}
// If the variations have changed, repopulate the combobox.
if (!partialCompareWithName(variations, m_variations)) {
RG_DEBUG << "updateVariationComboBox(): Repopulating the combobox";
// Update the cache.
m_variations = variations;
// Copy from m_variations to m_variationComboBox.
m_variationComboBox->clear();
for (size_t i = 0; i < m_variations.size(); ++i) {
std::string programName = md->getProgramName(m_variations[i]);
// Pick the correct bank number.
MidiBank bank = m_variations[i].getBank();
MidiByte variationBank = useMSB ? bank.getMSB() : bank.getLSB();
m_variationComboBox->addItem(QObject::tr("%1. %2")
.arg(variationBank)
.arg(QObject::tr(programName.c_str())));
}
//.........这里部分代码省略.........