本文整理汇总了C++中MidiDevice::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiDevice::getId方法的具体用法?C++ MidiDevice::getId怎么用?C++ MidiDevice::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiDevice
的用法示例。
在下文中一共展示了MidiDevice::getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Device
MidiDevice::MidiDevice(const MidiDevice &dev) :
Device(dev.getId(), dev.getName(), dev.getType()),
Controllable(),
m_programList(dev.m_programList),
m_bankList(dev.m_bankList),
m_controlList(dev.m_controlList),
m_keyMappingList(dev.m_keyMappingList),
m_metronome(0),
m_direction(dev.getDirection()),
m_variationType(dev.getVariationType()),
m_librarian(dev.getLibrarian()),
m_allocator(new AllocateChannels(ChannelSetup::MIDI))
{
// Create and assign a metronome if required
//
if (dev.getMetronome())
{
m_metronome = new MidiMetronome(*dev.getMetronome());
}
// Copy the instruments
//
InstrumentList insList = dev.getAllInstruments();
InstrumentList::iterator iIt = insList.begin();
for (; iIt != insList.end(); ++iIt)
{
Instrument *newInst = new Instrument(**iIt);
newInst->setDevice(this);
m_instruments.push_back(newInst);
}
// generate presentation instruments
generatePresentationList();
}
示例2:
// Run through the Devices checking for MidiDevices and
// returning the first Metronome we come across
//
const MidiMetronome*
Studio::getMetronomeFromDevice(DeviceId id)
{
std::vector<Device*>::iterator it;
for (it = m_devices.begin(); it != m_devices.end(); ++it) {
std::cerr << "Studio::getMetronomeFromDevice: Having a look at device " << (*it)->getId() << std::endl;
MidiDevice *midiDevice = dynamic_cast<MidiDevice*>(*it);
if (midiDevice &&
midiDevice->getId() == id &&
midiDevice->getMetronome()) {
std::cerr << "Studio::getMetronomeFromDevice(" << id << "): device is a MIDI device" << std::endl;
return midiDevice->getMetronome();
}
SoftSynthDevice *ssDevice = dynamic_cast<SoftSynthDevice *>(*it);
if (ssDevice &&
ssDevice->getId() == id &&
ssDevice->getMetronome()) {
std::cerr << "Studio::getMetronomeFromDevice(" << id << "): device is a soft synth device" << std::endl;
return ssDevice->getMetronome();
}
}
return 0;
}
示例3:
bool
ManageMetronomeDialog::isSuitable(Device *dev, bool *hasConnectionReturn)
{
MidiDevice *md = dynamic_cast<MidiDevice *>(dev);
if (md && md->getDirection() == MidiDevice::Play) {
if (hasConnectionReturn) {
QString conn = RosegardenSequencer::getInstance()->getConnection
(md->getId());
if (conn == "") *hasConnectionReturn = false;
else *hasConnectionReturn = true;
}
return true;
}
if (dynamic_cast<SoftSynthDevice *>(dev)) {
if (hasConnectionReturn) *hasConnectionReturn = true;
return true;
}
return false;
}
示例4: NamedCommand
CreateOrDeleteDeviceCommand::CreateOrDeleteDeviceCommand(Studio *studio,
DeviceId id) :
NamedCommand(getGlobalName(true)),
m_studio(studio),
m_deviceId(id),
m_deviceCreated(true)
{
Device *device = m_studio->getDevice(m_deviceId);
if (device) {
m_name = device->getName();
m_type = device->getType();
m_direction = MidiDevice::Play;
MidiDevice *md = dynamic_cast<MidiDevice *>(device);
if (md) m_direction = md->getDirection();
m_connection = qstrtostr(RosegardenSequencer::getInstance()
->getConnection(md->getId()));
} else {
RG_DEBUG << "CreateOrDeleteDeviceCommand: No such device as "
<< m_deviceId << endl;
}
}
示例5: QDialog
SplitByRecordingSrcDialog::SplitByRecordingSrcDialog(QWidget *parent, RosegardenDocument *doc) :
QDialog(parent)
{
setModal(true);
setWindowTitle(tr("Split by Recording Source"));
QGridLayout *metagrid = new QGridLayout;
setLayout(metagrid);
QWidget *vBox = new QWidget(this);
QVBoxLayout *vBoxLayout = new QVBoxLayout;
metagrid->addWidget(vBox, 0, 0);
QGroupBox *groupBox = new QGroupBox( tr("Recording Source"), vBox );
groupBox->setContentsMargins(10, 10, 10, 10);
QGridLayout *layout = new QGridLayout(groupBox);
layout->setSpacing(5);
vBoxLayout->addWidget(groupBox);
vBox->setLayout(vBoxLayout);
layout->addWidget(new QLabel( tr("Channel:"), groupBox ), 0, 0);
m_channel = new QComboBox( groupBox );
m_channel->setMaxVisibleItems( 17 );
layout->addWidget(m_channel, 0, 1);
QSpacerItem *spacer = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout->addItem( spacer, 0, 2 );
m_channel->addItem(tr("any"));
for (int i = 1; i < 17; ++i) {
m_channel->addItem(QString::number(i));
}
layout->addWidget(new QLabel( tr("Device:"), groupBox ), 1, 0);
m_device = new QComboBox( groupBox );
layout->addWidget( m_device, 1, 1, 0+1, 2 - 1+1);
m_deviceIds.clear();
m_deviceIds.push_back( -1);
m_device->addItem(tr("any"));
DeviceList *devices = doc->getStudio().getDevices();
DeviceListConstIterator it;
for (it = devices->begin(); it != devices->end(); it++) {
MidiDevice *dev =
dynamic_cast<MidiDevice*>(*it);
if (dev && dev->getDirection() == MidiDevice::Record) {
QString label = QString::number(dev->getId());
label += ": ";
label += strtoqstr(dev->getName());
QString connection = RosegardenSequencer::getInstance()->getConnection
(dev->getId());
label += " - ";
if (connection == "")
label += tr("No connection");
else
label += connection;
m_device->addItem(label);
m_deviceIds.push_back(dev->getId());
}
}
m_channel->setCurrentIndex(0);
m_device->setCurrentIndex(0);
groupBox->setLayout(layout);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
metagrid->addWidget(buttonBox, 1, 0);
metagrid->setRowStretch(0, 10);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
示例6: connection
void
MIDIInstrumentParameterPanel::updateWidgets()
{
RG_DEBUG << "updateWidgets() begin";
if (!getSelectedInstrument())
return;
MidiDevice *md = dynamic_cast<MidiDevice *>(getSelectedInstrument()->getDevice());
if (!md) {
std::cerr << "WARNING: MIDIInstrumentParameterPanel::updateWidgets(): No MidiDevice for Instrument " << getSelectedInstrument()->getId() << '\n';
RG_DEBUG << "setupForInstrument() end";
return;
}
// Instrument name
m_instrumentLabel->setText(
getSelectedInstrument()->getLocalizedPresentationName());
// Studio Device (connection) name
QString connection(RosegardenSequencer::getInstance()->getConnection(md->getId()));
if (connection == "") {
connection = tr("No connection");
} else {
// remove trailing "(duplex)", "(read only)", "(write only)" etc
connection.replace(QRegExp("\\s*\\([^)0-9]+\\)\\s*$"), "");
}
m_connectionLabel->setText("[ " + connection + " ]");
// Percussion
m_percussionCheckBox->setChecked(getSelectedInstrument()->isPercussion());
// Bank
m_bankCheckBox->setChecked(getSelectedInstrument()->sendsBankSelect());
updateBankComboBox();
// Program
m_programCheckBox->setChecked(getSelectedInstrument()->sendsProgramChange());
updateProgramComboBox();
// Variation
m_variationCheckBox->setChecked(getSelectedInstrument()->sendsBankSelect());
updateVariationComboBox();
// Channel
m_channelValue->setCurrentIndex(
getSelectedInstrument()->hasFixedChannel() ? 1 : 0);
// Controller Rotaries
// Make sure we have the right number of Rotary widgets and
// they have the proper labels.
// rename: setupRotaries()?
setupControllers(md);
// For each rotary
for (RotaryInfoVector::iterator rotaryIter = m_rotaries.begin();
rotaryIter != m_rotaries.end(); ++rotaryIter) {
MidiByte value = 0;
try {
value = getSelectedInstrument()->getControllerValue(rotaryIter->controller);
} catch (...) { // unknown controller, try the next one
continue;
}
rotaryIter->rotary->setPosition(static_cast<float>(value));
}
RG_DEBUG << "updateWidgets() end";
}