本文整理汇总了C++中MidiTrack::type方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiTrack::type方法的具体用法?C++ MidiTrack::type怎么用?C++ MidiTrack::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiTrack
的用法示例。
在下文中一共展示了MidiTrack::type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: processMidi
void Audio::processMidi()
{
midiBusy = true;
//
// TODO: syntis should directly write into recordEventList
//
for (iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id)
{
MidiDevice* md = *id;
MPEventList* playEvents = md->playEvents();
//
// erase already played events:
//
iMPEvent nextPlayEvent = md->nextPlayEvent();
playEvents->erase(playEvents->begin(), nextPlayEvent);
// klumsy hack for synti devices:
if (md->isSynti())
{
SynthI* s = (SynthI*) md;
while (s->eventsPending())
{
MidiRecordEvent ev = s->receiveEvent();
md->recordEvent(ev);
}
}
// Is it a Jack midi device?
//MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(md);
//if(mjd)
// mjd->collectMidiEvents();
md->collectMidiEvents();
// Take snapshots of the current sizes of the recording fifos,
// because they may change while here in process, asynchronously.
md->beforeProcess();
}
MPEventList* playEvents = metronome->playEvents();
iMPEvent nextPlayEvent = metronome->nextPlayEvent();
playEvents->erase(playEvents->begin(), nextPlayEvent);
// p3.3.25
bool extsync = extSyncFlag.value();
for (iMidiTrack t = song->midis()->begin(); t != song->midis()->end(); ++t)
{
MidiTrack* track = *t;
int port = track->outPort();
MidiDevice* md = midiPorts[port].device();
// Changed by Tim. p3.3.8
//if(md == 0)
// continue;
//MPEventList* playEvents = md->playEvents();
//if (playEvents == 0)
// continue;
//if (!track->isMute())
MPEventList* playEvents = 0;
if (md)
{
playEvents = md->playEvents();
// only add track events if the track is unmuted
if (!track->isMute())
{
if (isPlaying() && (curTickPos < nextTickPos))
collectEvents(track, curTickPos, nextTickPos);
}
}
//
//----------midi recording
//
if (track->recordFlag())
{
//int portMask = track->inPortMask();
// p3.3.38 Removed
//unsigned int portMask = track->inPortMask();
//int channelMask = track->inChannelMask();
MPEventList* rl = track->mpevents();
MidiPort* tport = &midiPorts[port];
// p3.3.38
//for (iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id)
//{
RouteList* irl = track->inRoutes();
for (ciRoute r = irl->begin(); r != irl->end(); ++r)
{
//if(!r->isValid() || (r->type != Route::ALSA_MIDI_ROUTE && r->type != Route::JACK_MIDI_ROUTE))
//if(!r->isValid() || (r->type != Route::MIDI_DEVICE_ROUTE))
if (!r->isValid() || (r->type != Route::MIDI_PORT_ROUTE)) // p3.3.49
continue;
int devport = r->midiPort; // p3.3.49
if (devport == -1)
continue;
//.........这里部分代码省略.........
示例3: removePortCtrlEvents
void removePortCtrlEvents(Part* part, bool doClones)
{
// Traverse and process the clone chain ring until we arrive at the same part again.
// The loop is a safety net.
// Update: Due to the varying calls, and order of, incARefcount, (msg)ChangePart, replaceClone, and remove/addPortCtrlEvents,
// we can not rely on the reference count as a safety net in these routines. We will just have to trust the clone chain.
Part* p = part;
//int j = doClones ? p->cevents()->arefCount() : 1;
//if(j > 0)
{
//for(int i = 0; i < j; ++i)
while (1)
{
Track* t = p->track();
if (t && t->isMidiTrack())
{
MidiTrack* mt = (MidiTrack*) t;
int port = mt->outPort();
const EventList* el = p->cevents();
//unsigned len = p->lenTick();
for (ciEvent ie = el->begin(); ie != el->end(); ++ie)
{
const Event& ev = ie->second;
// Added by T356. Do not remove events which are past the end of the part.
// No, actually, do remove ALL of them belonging to the part.
// Just in case there are stray values left after the part end.
//if(ev.tick() >= len)
// break;
if (ev.type() == Controller)
{
int ch = mt->outChannel();
int tck = ev.tick() + p->tick();
int cntrl = ev.dataA();
MidiPort* mp = &midiPorts[port];
// Is it a drum controller event, according to the track port's instrument?
if (mt->type() == Track::DRUM)
{
MidiController* mc = mp->drumController(cntrl);
if (mc)
{
int note = cntrl & 0x7f;
cntrl &= ~0xff;
ch = drumMap[note].channel;
mp = &midiPorts[drumMap[note].port];
cntrl |= drumMap[note].anote;
}
}
mp->deleteController(ch, tck, cntrl, p);
}
}
}
if (!doClones)
break;
// Get the next clone in the chain ring.
p = p->nextClone();
// Same as original part? Finished.
if (p == part)
break;
}
}
}
示例4: addPortCtrlEvents
void addPortCtrlEvents(Event& event, Part* part, bool doClones)
{
// Traverse and process the clone chain ring until we arrive at the same part again.
// The loop is a safety net.
// Update: Due to the varying calls, and order of, incARefcount, (msg)ChangePart, replaceClone, and remove/addPortCtrlEvents,
// we can not rely on the reference count as a safety net in these routines. We will just have to trust the clone chain.
Part* p = part;
//int j = doClones ? p->cevents()->arefCount() : 1;
//if(j > 0)
{
//for(int i = 0; i < j; ++i)
while (1)
{
// Added by Tim. p3.3.6
//printf("addPortCtrlEvents i:%d %s %p events %p refs:%d arefs:%d\n", i, p->name().toLatin1().constData(), p, part->cevents(), part->cevents()->refCount(), j);
Track* t = p->track();
if (t && t->isMidiTrack())
{
MidiTrack* mt = (MidiTrack*) t;
int port = mt->outPort();
//const EventList* el = p->cevents();
unsigned len = p->lenTick();
//for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
//{
//const Event& ev = ie->second;
// Added by Tim. p3.3.6
//printf("addPortCtrlEvents %s len:%d end:%d etick:%d\n", p->name().toLatin1().constData(), p->lenTick(), p->endTick(), event.tick());
// Do not add events which are past the end of the part.
if (event.tick() >= len)
break;
if (event.type() == Controller)
{
int ch = mt->outChannel();
int tck = event.tick() + p->tick();
int cntrl = event.dataA();
int val = event.dataB();
MidiPort* mp = &midiPorts[port];
// Is it a drum controller event, according to the track port's instrument?
if (mt->type() == Track::DRUM)
{
MidiController* mc = mp->drumController(cntrl);
if (mc)
{
int note = cntrl & 0x7f;
cntrl &= ~0xff;
ch = drumMap[note].channel;
mp = &midiPorts[drumMap[note].port];
cntrl |= drumMap[note].anote;
}
}
mp->setControllerVal(ch, tck, cntrl, val, p);
}
//}
}
if (!doClones)
break;
// Get the next clone in the chain ring.
p = p->nextClone();
// Same as original part? Finished.
if (p == part)
break;
}
}
}