本文整理汇总了C++中SigTimer::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ SigTimer::reset方法的具体用法?C++ SigTimer::reset怎么用?C++ SigTimer::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SigTimer
的用法示例。
在下文中一共展示了SigTimer::reset方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mainloopalgorithms
void mainloopalgorithms(void) {
if (synth.getNoteCount() > 0) {
processKeyboard();
}
if (offTimer.expired()) {
checkBuffers();
checkOffNotes();
offTimer.reset();
}
if (batonTimer.expired()) {
processBaton();
batonTimer.reset();
}
voicePeriod = (int)(avgDur - avgDurRange);
if (voicePeriod <= 50) {
voicePeriod = 50;
}
voiceTimer.setPeriod(voicePeriod);
if (voiceTimer.expired()) {
generateVoices();
voiceTimer.reset();
}
if (controlDisplayQ && controlDisplayTimer.expired()) {
displayVariables();
controlDisplayTimer.reset();
}
}
示例2: playdata
void playdata(HumdrumFile& data, int& linenum, SigTimer& timer) {
double duration = 0; // duration of the current line;
if (data.getNumLines() == 0) {
// ignore empty files.
return;
}
int type = data[linenum].getType();
while (linenum < data.getNumLines() && duration == 0.0) {
duration = data[linenum].getDuration();
if (type == E_humrec_data) {
processNotes(data[linenum]);
} else if (type == E_humrec_interpretation) {
if (strncmp(data[linenum][0], "*MM", 3) == 0) {
tempo = atoi(&data[linenum][0][3]);
}
}
if (echoTextQ) {
printInputLine(data, linenum);
}
if (duration > 0.0) {
timer.setPeriod(60000 / tempo / tempoScale * duration);
timer.reset();
}
linenum++;
if (linenum < data.getNumLines()) {
type = data[linenum].getType();
}
}
}
示例3: initialization
void initialization(void) {
notetimer.setPeriod(period); // set the period in ms between MIDI events.
notetimer.reset();
sentout.setSize(1024); // store up to 1024 MIDI output bytes
receivedin.setSize(1024); // store up to 1024 MIDI input bytes
description();
synth.makeOrphanBuffer();
start();
}
示例4: mainloopalgorithms
void mainloopalgorithms(void) {
sensor.checkPoll(); // see if it is time to check for new data frame
makeNote(); // check if it is time to play a MIDI note
if (display && displayTimer.expired()) {
displayTimer.reset();
cout << "\r\t\t\t\t\t\t\t\t\t";
cout << "\rkey0= " << (int)(100 * keymin)/100.0
<< " keyx= " << (int)(100 * keymax)/100.0
<< " keyc= " << (int)(100 * sensor[keychan][0])/100.0
<< " \tvel0= " << (int)(100 * velmin)/100.0
<< " velx= " << (int)(100 * velmax)/100.0
<< " velc= " << (int)(100 * sensor[velchan][0])/100.0
<< " " << flush;
}
}
示例5: main
int main(int argc, char** argv) {
Options options(argc, argv);
checkOptions(options);
keyboardTimer.setPeriod(10);
int command = 0;
MidiInput midiin;
midiin.setPort(inport);
midiin.open();
MidiEvent midimessage;
performance.read(options.getArg(1).data());
performance.setPort(outport);
performance.setMaxAmp(maxamp);
performance.open();
performance.setTempoMethod(tempoMethod);
performance.play();
while (command != 'Q') {
while (midiin.getCount() > 0) {
midiin.extract(midimessage);
processMidiCommand(midimessage);
}
performance.xcheck();
eventIdler.sleep();
if (keyboardTimer.expired()) {
keyboardTimer.reset();
command = checkKeyboard();
if (command == 'Q') {
break;
} else {
keyboardCommand(command);
}
}
}
return 0;
}
示例6: initialization
void initialization(void) {
checkOptions();
timer.setPeriod(500);
timer.reset();
eventIdler.setPeriod(0);
eventBuffer.setPollPeriod(10);
eventBuffer.setPort(synth.getOutputPort());
if (colorQ) {
colormessage(cout, COLOR_INIT, colormode, colorQ);
colormessage(cout, COLOR_CLEAR_SCREEN, colormode, colorQ);
//if (!options.getBoolean("Q")) {
// print_commands();
//}
//sleep(1);
}
trackmute.resize(1000); // maximum track in humdrum file assumed to be 1000
// space 1000-10 is used for a special purpose.
std::fill(trackmute.begin(), trackmute.end(), 0);
markers.resize(1001);
std::fill(markers.begin(), markers.end(), 0);
markerindex = 0;
}
示例7: keyboardchar
//.........这里部分代码省略.........
} else {
int tracknum = getKernTrack(number, data);
trackmute[tracknum] = !trackmute[tracknum];
if (trackmute[tracknum]) {
cout << "!! **kern spine " << number << " is muted" << endl;
} else {
cout << "!! **kern spine " << number << " is unmuted" << endl;
}
}
break;
break;
case 'n': // toggle display of note only (supression
// of beam and stem display
// Also, don't display ![!]LO: lines.
noteonlyQ = !noteonlyQ;
if (noteonlyQ) {
cout << "!! Notes only: supressing beams and stems in **kern data"
<< endl;
} else {
cout << "!! Displaying **kern data unmodified" << endl;
}
break;
case 'o': // set the tempo to a particular value
if (number > 20 && number < 601) {
cout << "!! TEMPO SET TO " << number << endl;
tempo = number;
tempoScale = 1.0;
} else if (number == 0) {
cout << "!! Current tempo: " << tempo * tempoScale << endl;
}
break;
case 'p': // toggle music pausing
eventBuffer.off();
timer.reset();
pauseQ = !pauseQ;
if (pauseQ) {
cout << "!! Paused" << endl;
}
break;
case 'q': // toggle display of file while playing
echoTextQ = !echoTextQ;
if (echoTextQ) {
cout << "!! FILE DISPLAY TURNED ON" << endl;
} else {
cout << "!! FILE DISPLAY TURNED OFF" << endl;
}
break;
case 'r': // return to a marker
if (number == 0) {
linenum = markers[0];
cout << "!! Going to line " << linenum << endl;
eventBuffer.off();
timer.reset();
} else if (number < (int)markers.size()) {
linenum = markers[number];
cout << "!! Going to line " << linenum << endl;
eventBuffer.off();
timer.reset();
}
break;
case 'R': // Print a list of all markers
printAllMarkers(cout, markers, data);
break;
case 's': // silence notes
eventBuffer.off();
break;
示例8: stick2trig
void stick2trig(void) {
if (triggerTimer.expired()) {
performance.beat();
triggerTimer.reset();
}
}
示例9: mainloopalgorithms
void mainloopalgorithms(void) {
if (comparestate && notetimer.expired()) {
if (notetimer.expired() > 2) {
notetimer.reset();
} else {
notetimer.update();
}
notestate = !notestate;
if (notestate == 1 || notestate == -1) {
synth.play(0, note, 64);
data = 0x90; sentout.insert(data);
data = note; sentout.insert(data);
data = 64; sentout.insert(data);
} else {
synth.play(0, note, 0);
data = 0x90; sentout.insert(data);
data = note; sentout.insert(data);
data = 0; sentout.insert(data);
note += step * direction;
if (note > highestnote) {
note = lowestnote;
}
if (note < lowestnote) {
note = highestnote;
}
}
}
if (midiinput.getCount() > 0) {
message = midiinput.extract();
receivedin.insert(message.p0());
receivedin.insert(message.p1());
receivedin.insert(message.p2());
// check that the messages are identical
if (receivedin.getCount() < 3) {
cout << "Error: not enough received data" << endl;
} else {
checkin[0] = receivedin.extract();
checkin[1] = receivedin.extract();
checkin[2] = receivedin.extract();
}
if (sentout.getCount() < 3) {
cout << "Error: not enough sent data" << endl;
} else {
checkout[0] = sentout.extract();
checkout[1] = sentout.extract();
checkout[2] = sentout.extract();
}
if ((checkout[0] != checkin[0]) || (checkout[1] != checkin[1]) ||
(checkout[2] != checkin[2])) {
synth.rawsend(0xaa, 0x7f, 0x00);
cout << "Error "
<< "output was = (" << hex << (int)checkout[0] << ") "
<< dec << (int)checkout[1] << " "
<< dec << (int)checkout[2] << "\tbut input is = ("
<< hex << (int)checkin[0] << ") "
<< dec << (int)checkin[1] << " "
<< dec << (int)checkin[2] << " "
<< endl;
// assume that a note message was missed.
if (sentout.getCount() < 3) {
cout << "Error: not enough sent data during error" << endl;
} else {
checkout[0] = sentout.extract();
checkout[1] = sentout.extract();
checkout[2] = sentout.extract();
}
stop();
cout << "Press space to restart testing, "
"or press 'S' to silence synth" << endl;
}
}
}