本文整理汇总了C++中MidiMessage::is_note_on方法的典型用法代码示例。如果您正苦于以下问题:C++ MidiMessage::is_note_on方法的具体用法?C++ MidiMessage::is_note_on怎么用?C++ MidiMessage::is_note_on使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MidiMessage
的用法示例。
在下文中一共展示了MidiMessage::is_note_on方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mainloopalgorithms
void mainloopalgorithms(void) {
if (synth.getNoteCount() > 0) {
message = synth.extractNote();
oldnote = checkForSquelch(message, memory, mintime, maxtime, t_time);
if (!oldnote || sstate == 0) {
cout << "New note from performer: " << message << endl;
if (message.is_note_on()) {
message.p1() += 7;
outvel = message.p2() + veladd;
if (outvel > 127) { outvel = 127; }
synth.send(message.p0(), message.p1(), outvel);
message.time = t_time;
message.p2() = outvel;
memory.insert(message);
} else if (message.is_note_off()) {
message.p1() += 7;
synth.send(message.p0(), message.p1(), message.p2());
message.time = t_time;
memory.insert(message);
}
} else {
cout << "Feedback note from piano: " << message << endl;
}
}
}
示例2: mainloopalgorithms
void mainloopalgorithms(void) {
eventBuffer.checkPoll();
while (synth.getNoteCount() > 0) {
message = synth.extractNote();
if (message.is_note_on() && message.p1() == A0) {
direction = -direction;
cout << "Direction = " << direction << endl;
} else if (message.is_note_on() && message.p1() == C7) {
// add one to the length of the tumble sequence
length = limit(length+1, 2, 200);
cout << "Sequence length = " << length << endl;
} else if (message.is_note_on() && message.p1() == B6) {
// subtract one from the length of the tumble sequence
length = limit(length-1, 2, 200);
cout << "Sequence length = " << length << endl;
} else {
processNote(message, length, direction);
}
}
}
示例3: processNote
void processNote(MidiMessage message, int seqLength, int direction) {
static Array<char> notes;
static Array<char> velocities;
static Array<int> durations;
static Array<int> iois;
static Array<int> ontimes;
static CircularBuffer<int> attacktimes;
static int init = 0;
static TumbleParameters temparam;
char vel;
if (!init) {
attacktimes.setSize(256);
attacktimes.reset();
notes.setSize(0);
velocities.setSize(0);
durations.setSize(0);
iois.setSize(0);
ontimes.setSize(128);
ontimes.zero();
init = 1;
}
char note;
int deltatime;
int ioi0;
int ioix;
if (message.is_note_on()) {
attacktimes.insert(message.time);
// check to see if the ioi is in the correct range
if (notes.getSize() == 0) {
// no notes yet, so don't know the first ioi
} else {
deltatime = attacktimes[0] - attacktimes[1];
iois.append(deltatime);
}
if (iois.getSize() > 1) {
ioi0 = iois[0];
ioix = iois[iois.getSize()-1];
if ((ioix < ioi0 * tolerance) || (ioix > ioi0 / tolerance)) {
goto resettrigger;
}
}
// at this point the note can be added to the sequence
if (notes.getSize() + 1 >= seqLength) {
// time to trigger an algorithm
if (durations.getSize() < notes.getSize()) {
// if the last note has not yet been turned off, approximate dur.
deltatime = iois[iois.getSize()-1];
durations.append(deltatime);
}
int i;
for (i=0; i<seqLength; i++) {
temparam.v[i] = velocities[i];
temparam.i[i] = iois[i];
temparam.d[i] = durations[i];
temparam.n[i] = notes[i] - notes[0];
}
temparam.n[0] = message.p1() - notes[0];
temparam.current = message.p1();
temparam.pos = 1;
temparam.max = seqLength;
temparam.active = 1;
startAlgorithm(temparam);
goto resettrigger;
} else {
// add the note info to the algorithm pile
note = message.p1();
notes.append(note);
vel = message.p2();
velocities.append(vel);
attacktimes[message.p1()] = message.time;
}
} else if (message.is_note_off()) {
if (notes.getSize() > 0) {
if (notes[notes.getSize()-1] == message.p1()) {
deltatime = message.time - ontimes[message.p1()];
durations.append(deltatime);
} else {
cout << "A funny error ocurred" << endl;
}
}
return;
resettrigger:
attacktimes.setSize(0);
notes.setSize(0);
velocities.setSize(0);
durations.setSize(0);
iois.setSize(0);
if (message.is_note_on()) {
note = message.p1();
notes.append(note);
ontimes[message.p1()] = message.time;
//.........这里部分代码省略.........