本文整理汇总了C++中MidiEvent::size方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiEvent::size方法的具体用法?C++ MidiEvent::size怎么用?C++ MidiEvent::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiEvent
的用法示例。
在下文中一共展示了MidiEvent::size方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printMidiEvent
void printMidiEvent(MidiEvent& event) {
// print the time:
cout << "v" << event.tick << "\t";
// print the command byte in hex format (two digits):
int commandbyte = event[0];
printHexByte(commandbyte);
int i;
switch (commandbyte & 0xf0) {
case 0x90:
case 0x80:
for (i=1; i<(int)event.size(); i++) {
cout << " ";
printDecByte(event[i]);
}
break;
default:
for (i=1; i<(int)event.size(); i++) {
cout << " ";
printHexByte(event[i]);
}
}
cout << endl;
}
示例2:
MidiEvent::MidiEvent(const MidiEvent& mfevent) {
tick = mfevent.tick;
track = mfevent.track;
eventlink = NULL;
this->resize(mfevent.size());
for (int i=0; i<this->size(); i++) {
(*this)[i] = mfevent[i];
}
}
示例3: MidiMessage
MidiEvent::MidiEvent(const MidiEvent& mfevent) : MidiMessage() {
track = mfevent.track;
tick = mfevent.tick;
seconds = mfevent.seconds;
seq = mfevent.seq;
m_eventlink = NULL;
this->resize(mfevent.size());
for (int i=0; i<(int)this->size(); i++) {
(*this)[i] = mfevent[i];
}
}
示例4: getTrackByteCount
int getTrackByteCount(MidiFile& midifile, int track) {
int sum = 0;
int i;
int eventcount = midifile.getEventCount(track);
MidiEvent event;
for (i=0; i<eventcount; i++) {
event = midifile.getEvent(track, i);
sum += getVlvSize(event.tick);
sum += event.size();
}
return sum;
}
示例5: processMidiFile
void processMidiFile(MidiFile& midifile) {
midifile.absoluteTicks();
midifile.joinTracks();
int i, j;
int eventcount = midifile.getEventCount(0);
int track;
int timeinticks;
double timeinsecs;
MidiEvent *ptr;
int attack;
for (i=0; i<eventcount; i++) {
ptr = &(midifile[0][i]);
track = ptr->track;
timeinticks = ptr->tick;
timeinsecs = midifile.getTimeInSeconds(0, i);
attack = ((*ptr)[0] & 0xf0) == 0x90;
if (onsetQ && !attack) {
continue;
}
if (onsetQ && attack) {
if ((*ptr)[2] == 0) {
continue;
}
}
cout << timeinticks << "\t";
cout << timeinsecs << "\t";
cout << track << "\t";
cout << i << "\t";
for (j=0; j<(int)ptr->size(); j++) {
if (j == 0) {
cout << "0x" << hex << (int)(*ptr)[j] << dec << " ";
} else {
cout << (int)(*ptr)[j] << " ";
}
}
cout << endl;
}
}
示例6: processEvent
void processEvent(MidiEvent& event, double& tempo, double& curtime) {
int i;
if (((event[0] & 0xf0) == 0x80) || (((event[0] & 0xf0) == 0x90) &&
(event[2] == 0)) ) {
// note-off MIDI message
if (track >= 0 && track != event.track) { return; }
cout << "NoteOff\t\t=";
cout.width(9);
cout.setf(ios::left);
cout << curtime << "\t" << event.track << "\t"
<< (int)event[1] << "\t" << (int)event[2] << endl;
} else if ((event[0] & 0xf0) == 0x90) {
// note-on MIDI message
if (track >= 0 && track != event.track) { return; }
cout << "NoteOn\t\t=";
cout.width(9);
cout.setf(ios::left);
cout << curtime << "\t" << event.track << "\t"
<< (int)event[1] << "\t" << (int)event[2] << endl;
} else if ((event[0] & 0xf0) == 0xb0) {
// continuous controller MIDI message
if (track >= 0 && track != event.track) { return; }
if (event[1] == 7) {
cout << "Volume\t\t=";
cout.width(9);
cout.setf(ios::left);
cout << curtime << "\t" << event.track << "\t"
<< "\t" << (int)event[2] << endl;
} else {
cout << "ControlChange\t=";
cout.width(9);
cout.setf(ios::left);
cout << curtime << "\t" << event.track << "\t"
<< (int)event[1] << "\t" << (int)event[2] << endl;
}
} else if ((event.size() > 3) && (event[0] == 0xff) &&
(event[1] == 0x51)) {
// Tempo meta event
int microseconds = (unsigned int)event[3];
microseconds = microseconds << 8;
microseconds |= (unsigned int)event[4];
microseconds = microseconds << 8;
microseconds |= (unsigned int)event[5];
tempo = 1000000.0 / microseconds * 60.0;
cout << "// time:=" << curtime << " tempo: " << tempo << endl;
} else if ((event.size() > 3) && (event[0] == 0xff) &&
(event[1] == 0x03)) {
// Track name MIDI meta event
if (track >= 0 && track != event.track) { return; }
cout << "//";
cout << " time:=" << curtime;
cout << " track:" << event.track;
cout << " text: ";
for (i=3; i<(int)event.size(); i++) {
cout << (char)event[i];
}
cout << endl;
} else {
// a MIDI event with an unknown mapping into SKINI, print as comment
if (track >= 0 && track != event.track) { return; }
cout << "//"
<< " time:=" << curtime
<< " track:" << event.track
<< " midi-data: ";
for (i=0; i<(int)event.size(); i++) {
cout << (int)event[i] << " ";
}
cout << endl;
}
}