本文整理汇总了C++中MidiDevice::openFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiDevice::openFlags方法的具体用法?C++ MidiDevice::openFlags怎么用?C++ MidiDevice::openFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiDevice
的用法示例。
在下文中一共展示了MidiDevice::openFlags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: songChanged
void MPConfig::songChanged(int flags)
{
// Is it simply a midi controller value adjustment? Forget it.
if (flags == SC_MIDI_CONTROLLER)
return;
// Get currently selected index...
int no = -1;
QTableWidgetItem* sitem = mdevView->currentItem();
if (sitem)
{
QString id = sitem->tableWidget()->item(sitem->row(), DEVCOL_NO)->text();
no = atoi(id.toLatin1().constData()) - 1;
if (no < 0 || no >= kMaxMidiPorts)
no = -1;
}
sitem = 0;
for (int i = kMaxMidiPorts - 1; i >= 0; --i)
{
mdevView->blockSignals(true); // otherwise itemChanged() is triggered and bad things happen.
MidiPort* port = &midiPorts[i];
MidiDevice* dev = port->device();
QString s;
s.setNum(i + 1);
QTableWidgetItem* itemno = mdevView->item(i, DEVCOL_NO);
QTableWidgetItem* itemstate = mdevView->item(i, DEVCOL_STATE);
itemstate->setText(port->state());
QTableWidgetItem* iteminstr = mdevView->item(i, DEVCOL_INSTR);
QString instrumentName = port->instrument() ? port->instrument()->iname() : tr("<unknown>");
iteminstr->setText(instrumentName);
iteminstr->setToolTip(instrumentName);
QTableWidgetItem* itemname = mdevView->item(i, DEVCOL_NAME);
QTableWidgetItem* itemgui = mdevView->item(i, DEVCOL_GUI);
QTableWidgetItem* itemfb = mdevView->item(i, DEVCOL_CACHE_NRPN);
QTableWidgetItem* itemrec = mdevView->item(i, DEVCOL_REC);
QTableWidgetItem* itemplay = mdevView->item(i, DEVCOL_PLAY);
QTableWidgetItem* itemout = mdevView->item(i, DEVCOL_OUTROUTES);
QTableWidgetItem* itemin = mdevView->item(i, DEVCOL_INROUTES);
QTableWidgetItem* itemdefin = mdevView->item(i, DEVCOL_DEF_IN_CHANS);
itemdefin->setText(bitmap2String(port->defaultInChannels()));
QTableWidgetItem* itemdefout = mdevView->item(i, DEVCOL_DEF_OUT_CHANS);
itemdefout->setText(bitmap2String(port->defaultOutChannels()));
mdevView->blockSignals(false);
if (dev)
{
itemname->setText(dev->name());
itemname->setToolTip(dev->name());
// Is it a Jack midi device? Allow renaming.
//if(dynamic_cast<MidiJackDevice*>(dev))
if (dev->deviceType() == MidiDevice::JACK_MIDI)
itemname->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);
if (dev->rwFlags() & 0x2)
{
itemrec->setIcon(dev->openFlags() & 2 ? QIcon(*dotIcon) : QIcon(*dothIcon));
}
else
{
itemrec->setIcon(QIcon(QPixmap()));
}
if (dev->rwFlags() & 0x1)
{
itemplay->setIcon(dev->openFlags() & 1 ? QIcon(*dotIcon) : QIcon(*dothIcon));
}
else
itemplay->setIcon(QIcon(QPixmap()));
itemfb->setIcon(dev->cacheNRPN() ? QIcon(*dotIcon) : QIcon(*dothIcon));
}
else
{
itemname->setText(tr("<none>"));
itemname->setToolTip("");
itemgui->setIcon(QIcon(*dothIcon));
itemrec->setIcon(QIcon(QPixmap()));
itemplay->setIcon(QIcon(QPixmap()));
itemfb->setIcon(QIcon(QPixmap()));
}
// falkTX, we don't want this in the connections manager
//if (port->hasGui())
//{
// itemgui->setIcon(port->guiVisible() ? QIcon(*dotIcon) : QIcon(*dothIcon));
//}
//else
//{
itemgui->setIcon(QIcon(QPixmap()));
//}
iteminstr->setIcon(QIcon(*buttondownIcon));
itemname->setIcon(QIcon(*buttondownIcon));
//if(dev && dynamic_cast<MidiJackDevice*>(dev))
if (dev && dev->deviceType() == MidiDevice::JACK_MIDI)
{
//item->setPixmap(DEVCOL_ROUTES, *buttondownIcon);
//item->setText(DEVCOL_ROUTES, tr("routes"));
//.........这里部分代码省略.........
示例2: writeSeqConfiguration
static void writeSeqConfiguration(int level, Xml& xml, bool writePortInfo)/*{{{*/
{
xml.tag(level++, "sequencer");
if (writePortInfo)
{
//
// write information about all midi ports, their assigned
// instruments and all managed midi controllers
//
for (int i = 0; i < MIDI_PORTS; ++i)
{
bool used = false;
MidiPort* mport = &midiPorts[i];
// Route check by Tim. Port can now be used for routing even if no device.
// Also, check for other non-defaults and save port, to preserve settings even if no device.
// Dont write the config for the global inputs list they will be auto created with each startup
if (mport->defaultInChannels() || mport->defaultOutChannels() ||
(mport->instrument() && !mport->instrument()->iname().isEmpty() && mport->instrument()->iname() != "GM") /*|| !mport->syncInfo().isDefault()*/ )
{
used = true;
}
else
{//Put the ID of this track into a list
MidiTrackList* tl = song->midis();
for (iMidiTrack it = tl->begin(); it != tl->end(); ++it)
{
MidiTrack* t = *it;
if (t->outPort() == i)
{
used = true;
break;
}
}
}
MidiDevice* dev = mport->device();
if (!used && !dev)
continue;
bool isGlobal = gInputListPorts.contains(mport->portno());
xml.tag(level++, "midiport portId=\"%lld\" isGlobalInput=\"%d\"", mport->id(), isGlobal);
if (mport->defaultInChannels())
xml.intTag(level, "defaultInChans", mport->defaultInChannels());
if (mport->defaultOutChannels())
xml.intTag(level, "defaultOutChans", mport->defaultOutChannels());
if (mport->instrument() && !mport->instrument()->iname().isEmpty() &&
(mport->instrument()->iname() != "GM")) // FIXME: TODO: Make this user configurable.
{
xml.strTag(level, "instrument", mport->instrument()->iname());
}
if (dev)
{
xml.strTag(level, "name", dev->name());
xml.intTag(level, "cacheNRPN", (int)dev->cacheNRPN());
if (dev->deviceType() != MidiDevice::ALSA_MIDI)
xml.intTag(level, "type", dev->deviceType());
xml.intTag(level, "openFlags", dev->openFlags());
}
// write out registered controller for all channels
MidiCtrlValListList* vll = mport->controller();
for (int k = 0; k < MIDI_CHANNELS; ++k)
{
int min = k << 24;
int max = min + 0x100000;
xml.tag(level++, "channel idx=\"%d\"", k);
iMidiCtrlValList s = vll->lower_bound(min);
iMidiCtrlValList e = vll->lower_bound(max);
if (s != e)
{
for (iMidiCtrlValList i = s; i != e; ++i)
{
if(i->second->num() != 262145)
{
xml.tag(level++, "controller id=\"%d\"", i->second->num());
if (i->second->hwVal() != CTRL_VAL_UNKNOWN)
xml.intTag(level, "val", i->second->hwVal());
xml.etag(--level, "controller");
}
}
}
xml.etag(--level, "channel");
}
QList<PatchSequence*> *patchSequences = mport->patchSequences();
if (patchSequences && !patchSequences->isEmpty())
{
for (int p = 0; p < patchSequences->size(); ++p)
{
PatchSequence* ps = patchSequences->at(p);
QString pm = ps->name.replace('\n', " ");
xml.put(level, "<patchSequence id=\"%d\" name=\"%s\" checked=\"%d\" />", ps->id, pm.toLatin1().constData(), ps->selected);
}
}
if(!mport->presets()->isEmpty())
{
//.........这里部分代码省略.........
示例3: rbClicked
void MPConfig::rbClicked(QTableWidgetItem* item)
{
if (item == 0)
return;
QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text();
int no = atoi(id.toLatin1().constData()) - 1;
if (no < 0 || no >= kMaxMidiPorts)
return;
int n;
MidiPort* port = &midiPorts[no];
MidiDevice* dev = port->device();
int rwFlags = dev ? dev->rwFlags() : 0;
int openFlags = dev ? dev->openFlags() : 0;
QTableWidget* listView = item->tableWidget();
QPoint ppt = listView->visualItemRect(item).bottomLeft();
QPoint mousepos = QCursor::pos();
int col = item->column();
ppt += QPoint(0, listView->horizontalHeader()->height());
ppt = listView->mapToGlobal(ppt);
switch (col)
{
case DEVCOL_GUI:
if (dev == 0)
//break;
return;
// falkTX, we don't want this in the connections manager
//if (port->hasGui())
//{
// port->instrument()->showGui(!port->guiVisible());
// item->setIcon(port->guiVisible() ? QIcon(*dotIcon) : QIcon(*dothIcon));
//}
//break;
return;
case DEVCOL_CACHE_NRPN:
if (!dev)
return;
dev->setCacheNRPN(!dev->cacheNRPN());
item->setIcon(dev->cacheNRPN() ? QIcon(*dotIcon) : QIcon(*dothIcon));
return;
case DEVCOL_REC:
if (dev == 0 || !(rwFlags & 2))
return;
openFlags ^= 0x2;
dev->setOpenFlags(openFlags);
midiSeq->msgSetMidiDevice(port, dev); // reopen device
item->setIcon(openFlags & 2 ? QIcon(*dotIcon) : QIcon(*dothIcon));
if (dev->deviceType() == MidiDevice::JACK_MIDI)
{
if (dev->openFlags() & 2)
{
item->tableWidget()->item(item->row(), DEVCOL_INROUTES)->setText(tr("in"));
}
else
{
item->tableWidget()->item(item->row(), DEVCOL_INROUTES)->setText("");
}
}
return;
case DEVCOL_PLAY:
if (dev == 0 || !(rwFlags & 1))
return;
openFlags ^= 0x1;
dev->setOpenFlags(openFlags);
midiSeq->msgSetMidiDevice(port, dev); // reopen device
item->setIcon(openFlags & 1 ? QIcon(*dotIcon) : QIcon(*dothIcon));
if (dev->deviceType() == MidiDevice::JACK_MIDI)
{
if (dev->openFlags() & 1)
{
item->tableWidget()->item(item->row(), DEVCOL_OUTROUTES)->setText(tr("out"));
}
else
{
item->tableWidget()->item(item->row(), DEVCOL_OUTROUTES)->setText("");
}
}
return;
case DEVCOL_INROUTES:
case DEVCOL_OUTROUTES:
{
if (!checkAudioDevice())
return;
if (audioDevice->deviceType() != AudioDevice::JACK_AUDIO) //Only if Jack is running.
return;
if (!dev)
//.........这里部分代码省略.........