本文整理汇总了C++中MidiDevice::replaceProgramList方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiDevice::replaceProgramList方法的具体用法?C++ MidiDevice::replaceProgramList怎么用?C++ MidiDevice::replaceProgramList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiDevice
的用法示例。
在下文中一共展示了MidiDevice::replaceProgramList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
ModifyDeviceCommand::unexecute()
{
Device *device = m_studio->getDevice(m_device);
if (!device) {
std::cerr << "ERROR: ModifyDeviceCommand::unexecute(): no such device as " << m_device << std::endl;
return;
}
MidiDevice *midiDevice = dynamic_cast<MidiDevice *>(device);
if (!midiDevice) {
std::cerr << "ERROR: ModifyDeviceCommand::unexecute(): device " << m_device << " is not a MIDI device" << std::endl;
return;
}
if (m_rename)
midiDevice->setName(m_oldName);
midiDevice->replaceBankList(m_oldBankList);
midiDevice->replaceProgramList(m_oldProgramList);
midiDevice->replaceControlParameters(m_oldControlList);
midiDevice->replaceKeyMappingList(m_oldKeyMappingList);
midiDevice->setLibrarian(m_oldLibrarianName, m_oldLibrarianEmail);
if (m_changeVariation)
midiDevice->setVariationType(m_oldVariationType);
InstrumentList instruments = midiDevice->getAllInstruments();
for (size_t i = 0; i < instruments.size(); ++i) {
instruments[i]->setProgram(m_oldInstrumentPrograms[i]);
}
// ??? Instead of this kludge, we should be calling a Studio::hasChanged()
// which would then notify all observers (e.g. MIPP) who, in turn,
// would update themselves.
RosegardenMainWindow::self()->uiUpdateKludge();
}
示例2: program
bool
ImportDeviceDialog::importFromSF2(QString filename)
{
SF2PatchExtractor::Device sf2device;
try {
sf2device = SF2PatchExtractor::read( qstrtostr(filename) );
// These exceptions shouldn't happen -- the isSF2File call before this
// one should have weeded them out
} catch (SF2PatchExtractor::FileNotFoundException e) {
return false;
} catch (SF2PatchExtractor::WrongFileFormatException e) {
return false;
}
std::vector<MidiBank> banks;
std::vector<MidiProgram> programs;
for (SF2PatchExtractor::Device::const_iterator i = sf2device.begin();
i != sf2device.end(); ++i) {
int bankNumber = i->first;
const SF2PatchExtractor::Bank &sf2bank = i->second;
int msb = bankNumber / 128;
int lsb = bankNumber % 128;
MidiBank bank
(msb == 1, msb, lsb,
qstrtostr(tr("Bank %1:%2").arg(msb).arg(lsb)));
banks.push_back(bank);
for (SF2PatchExtractor::Bank::const_iterator j = sf2bank.begin();
j != sf2bank.end(); ++j) {
MidiProgram program(bank, j->first, j->second);
programs.push_back(program);
}
}
// This is a temporary device, so we can use device and instrument
// IDs that other devices in the Studio may also be using without
// expecting any problems
MidiDevice *device = new MidiDevice
(0, MidiInstrumentBase, "", MidiDevice::Play);
device->replaceBankList(banks);
device->replaceProgramList(programs);
m_devices.push_back(device);
return true;
}
示例3: bank
bool
ImportDeviceDialog::importFromLSCP(QString filename)
{
LSCPPatchExtractor::Device lscpDevice;
lscpDevice = LSCPPatchExtractor::extractContent(filename);
std::vector<MidiBank> banks;
std::vector<MidiProgram> programs;
int comparableBankNumber = -1; //Make sure that first bank is read too by comparing to -1 first (invalid bank number)
for (LSCPPatchExtractor::Device::const_iterator i = lscpDevice.begin();
i != lscpDevice.end(); ++i) {
int bankNumber = (*i).bankNumber; //Local variable bankNumber gets value from struct's member bankNumber
std::string bankName = (*i).bankName; //Local variable bankName gets value from struct's member bankName
int msb = bankNumber / 128;
int lsb = bankNumber % 128;
MidiBank bank (msb == 1, msb, lsb, bankName);
if (comparableBankNumber != bankNumber) {
banks.push_back(bank);
comparableBankNumber = bankNumber;
}
MidiProgram program(bank, (*i).programNumber, (*i).programName);
programs.push_back(program);
}
// This is a temporary device, so we can use device and instrument
// IDs that other devices in the Studio may also be using without
// expecting any problems
MidiDevice *device = new MidiDevice
(0, MidiInstrumentBase, "", MidiDevice::Play);
device->replaceBankList(banks);
device->replaceProgramList(programs);
m_devices.push_back(device);
return true;
}