本文整理汇总了C++中MidiDevice::rwFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiDevice::rwFlags方法的具体用法?C++ MidiDevice::rwFlags怎么用?C++ MidiDevice::rwFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiDevice
的用法示例。
在下文中一共展示了MidiDevice::rwFlags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatePollFd
void MidiSeq::updatePollFd()
{
if (!isRunning())
return;
clearPollFd();
addPollFd(timerFd, POLLIN, midiTick, this, 0);
if (timerFd == -1) {
fprintf(stderr, "updatePollFd: no timer fd\n");
if (!MusEGlobal::debugMode)
exit(-1);
}
addPollFd(toThreadFdr, POLLIN, MusECore::readMsg, this, 0);
//---------------------------------------------------
// midi ports
//---------------------------------------------------
for (iMidiDevice imd = MusEGlobal::midiDevices.begin(); imd != MusEGlobal::midiDevices.end(); ++imd) {
MidiDevice* dev = *imd;
int port = dev->midiPort();
if (port == -1)
continue;
if ((dev->rwFlags() & 0x2) || (MusEGlobal::extSyncFlag.value()
&& (MusEGlobal::midiPorts[port].syncInfo().MCIn())))
addPollFd(dev->selectRfd(), POLLIN, MusECore::midiRead, this, dev);
if (dev->bytesToWrite())
addPollFd(dev->selectWfd(), POLLOUT, MusECore::midiWrite, this, dev);
}
// special handling for alsa midi:
// (one fd for all devices)
// this allows for processing of some alsa events
// even if no alsa driver is active (assigned to a port)
addPollFd(alsaSelectRfd(), POLLIN, MusECore::alsaMidiRead, this, 0);
}
示例2: 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"));
//.........这里部分代码省略.........
示例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)
//.........这里部分代码省略.........