本文整理汇总了C++中MidiDevice::midiPort方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiDevice::midiPort方法的具体用法?C++ MidiDevice::midiPort怎么用?C++ MidiDevice::midiPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiDevice
的用法示例。
在下文中一共展示了MidiDevice::midiPort方法的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: createWidget
QWidget* MenuList::createWidget(QWidget* parent)
{
if(!_track)
return 0;
//if(!_track->isMidiTrack() || _track->type() != Track::AUDIO_SOFTSYNTH)
// return 0;
MidiTrack* track = (MidiTrack*) _track;
MidiDevice* md = 0;
int port = -1;
if (track->type() == Track::AUDIO_SOFTSYNTH)
{
md = dynamic_cast<MidiDevice*> (track);
if (md)
port = md->midiPort();
}
else
port = track->outPort();
list = new QListWidget(parent);
list->setSelectionMode(QAbstractItemView::SingleSelection);
list->setAlternatingRowColors(true);
list->setEditTriggers(QAbstractItemView::NoEditTriggers);
list->setFixedHeight(300);
for (int i = 0; i < MIDI_PORTS; ++i)
{
QString name;
name.sprintf("%d:%s", i + 1, midiPorts[i].portname().toLatin1().constData());
list->insertItem(i, name);
if (i == port)
list->setCurrentRow(i);
}
connect(list, SIGNAL(itemPressed(QListWidgetItem*)), this, SLOT(updateData(QListWidgetItem*)));
//connect(list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(updateData(QListWidgetItem*)));
//connect(list, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(updateData(QListWidgetItem*)));
return list;
}
示例3: read
void Route::read(Xml& xml)/*{{{*/
{
QString s;
int dtype = MidiDevice::ALSA_MIDI;
int port = -1;
unsigned char rtype = Route::TRACK_ROUTE;
for (;;)
{
const QString& tag = xml.s1();
Xml::Token token = xml.parse();
switch (token)
{
case Xml::Error:
case Xml::End:
return;
case Xml::Attribut:
#ifdef ROUTE_DEBUG
printf("Route::read(): attribute:%s\n", tag.toLatin1().constData());
#endif
if (tag == "type")
rtype = xml.s2().toInt();
else if (tag == "devtype")
{
dtype = xml.s2().toInt();
rtype = Route::MIDI_DEVICE_ROUTE;
}
else if (tag == "name")
s = xml.s2();
else if(tag == "trackId")
{
trackId = xml.s2().toLongLong();
rtype = Route::TRACK_ROUTE;
}
else if (tag == "mport") // p3.3.49
{
port = xml.s2().toInt();
rtype = Route::MIDI_PORT_ROUTE;
}
else if(tag == "mportId")
{
midiPortId = xml.s2().toLongLong();
rtype = Route::MIDI_PORT_ROUTE;
}
else
printf("Route::read(): unknown attribute:%s\n", tag.toLatin1().constData());
break;
case Xml::TagEnd:
#ifdef ROUTE_DEBUG
printf("Route::read(): tag end type:%d channel:%d name:%s\n", rtype, channel, s.toLatin1().constData());
#endif
if (rtype == MIDI_PORT_ROUTE)
{
if(midiPortId > 0)
{
//qDebug("Route::read(): MIDI_PORT_ROUTE Finding midiport from id");
type = rtype;
MidiPort *mp = oomMidiPorts.value(midiPortId);
if(mp)
{
midiPort = mp->portno();
//qDebug("Route::read(): Found midiport from id: %d", midiPort);
}
}
else if (port >= 0 && port < MIDI_PORTS)
{
type = rtype;
midiPort = port;
MidiPort *mp = &midiPorts[midiPort];
midiPortId = mp->id();
}
else
printf("Route::read(): midi port <%d> out of range\n", port);
}
else if (!s.isEmpty())
{
if (rtype == TRACK_ROUTE)
{
if(trackId > 0)
{
track = song->findTrackById(trackId);
type = rtype;
}
else
{
TrackList* tl = song->tracks();
iTrack i = tl->begin();
for (; i != tl->end(); ++i)
{
Track* t = *i;
if (t->name() == s)
{
track = t;
type = rtype;
trackId = t->id();
break;
}
}
if (i == tl->end())
printf("Route::read(): track <%s> not found\n", s.toLatin1().constData());
//.........这里部分代码省略.........