本文整理汇总了C++中MidiDevice::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiDevice::setName方法的具体用法?C++ MidiDevice::setName怎么用?C++ MidiDevice::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiDevice
的用法示例。
在下文中一共展示了MidiDevice::setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: mdevViewItemRenamed
void MPConfig::mdevViewItemRenamed(QTableWidgetItem* item)
{
int col = item->column();
QString s = item->text();
//printf("MPConfig::mdevViewItemRenamed col:%d txt:%s\n", col, s.toLatin1().constData());
if (item == 0)
return;
switch (col)
{
case DEVCOL_DEF_IN_CHANS:
{
QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text();
int no = atoi(id.toLatin1().constData()) - 1;
if (no < 0 || no >= kMaxMidiPorts)
return;
midiPorts[no].setDefaultInChannels(((1 << kMaxMidiChannels) - 1) & string2bitmap(s));
song->update();
}
break;
case DEVCOL_DEF_OUT_CHANS:
{
QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text();
int no = atoi(id.toLatin1().constData()) - 1;
if (no < 0 || no >= kMaxMidiPorts)
return;
midiPorts[no].setDefaultOutChannels(((1 << kMaxMidiChannels) - 1) & string2bitmap(s));
song->update();
}
break;
case DEVCOL_NAME:
{
QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text();
int no = atoi(id.toLatin1().constData()) - 1;
if (no < 0 || no >= kMaxMidiPorts)
return;
MidiPort* port = &midiPorts[no];
MidiDevice* dev = port->device();
// Only Jack midi devices.
if (!dev || dev->deviceType() != MidiDevice::JACK_MIDI)
return;
if (dev->name() == s)
return;
if (midiDevices.find(s))
{
QMessageBox::critical(this,
tr("LOS: bad device name"),
tr("please choose a unique device name"),
QMessageBox::Ok,
Qt::NoButton,
Qt::NoButton);
songChanged(-1);
return;
}
dev->setName(s);
song->update();
}
break;
default:
//printf("MPConfig::mdevViewItemRenamed unknown column clicked col:%d txt:%s\n", col, s.toLatin1().constData());
break;
}
}