//________________________________________________________________________ // the visitxxx methods //________________________________________________________________________ void midicontextvisitor::visitStart(S_duration& elt) { long dur = convert2Tick(long(*elt)); if (fInBackup) addDuration(-dur); else if (fInForward) addDuration(dur); else notevisitor::visitStart(elt); }
static void* __thread_worker(void *thread_input) { int my_tid = ((thread_struct*)thread_input)->tid; //connect functionStruct* localFunction = ((thread_struct*)thread_input)->function; void *thread_prepare_out = localFunction->prepare(thread_input,localFunction->prepare_in); printf("this tid = %d\n",my_tid); benchmarkConfig *bc = ((thread_struct*)thread_input)->bc; //use the benchmark; benchmarkInfo *benchmark = initBenchmark(bc->totalCount); benchmark = loadData(benchmark); kvPair *tempPair; char *key,*value; long long total_start = s_time(); int i; for(i=0;i<bc->totalCount;i++) { tempPair = getKvPair(benchmark); long long start = us_time(); localFunction->operation_out = localFunction->operation((void*)tempPair,thread_input,thread_prepare_out); long long end = us_time(); addDuration(benchmark,end-start); } long long total_end = s_time(); localFunction->end_out = localFunction->end(thread_input,thread_prepare_out); char temp[11] = "pip"; sprintf(temp+3,"%d",my_tid); //after benchmark setFileName(benchmark,temp); flushResults(benchmark); return (void*)0; }
//________________________________________________________________________ // TODO: modification ici pour prendre en compte les frets, strings, ... // void midicontextvisitor::playNote (const notevisitor& note) void midicontextvisitor::playNote(const noteextendedvisitor& note) { notevisitor::type t = note.getType(); if (t == notevisitor::kUndefinedType) { cerr << "midicontextvisitor: unexpected kUndefinedType for note " << note << endl; return; } if (note.isCue()) return; // cue notes are ignored long dur = convert2Tick(note.getDuration()); if (fMidiWriter && (t != notevisitor::kRest)) { int chan = fCurrentChan; float pitch = note.getMidiPitch() + fTranspose; if (pitch >= 0) pitch += fTranspose; // check for instrument specification string instr = note.getInstrument(); if (!instr.empty()) { if (fMidiInstruments.count(instr)) { midiInstrument mi = fMidiInstruments[instr]; // to retrieve the midi channel chan = mi.fChan; // get MIDI channel if ((mi.fUnpitched >= 0) || (t == notevisitor::kUnpitched)) pitch = (float)mi.fUnpitched; // and optionaly get unpitched data } } if (pitch < 0) pitch = 60; int vel = note.getDynamics(); if (vel == notevisitor::kUndefinedDynamics) vel = fCurrentDynamics; int tie = note.getTie(); long date = note.inChord() ? fLastPosition : fCurrentDate; if (note.isGrace()) { // grace notes dur = fTPQ / 6; // have no duration - set to an arbitrary value date -= dur; // and play in advance if (date < 0) date = 0; // check for negative dates // TODO: modification ici pour prendre en compte les frets, strings, ... // fMidiWriter->newNote(date, chan, note.getMidiPitch(), vel, dur); fMidiWriter->newNote(date, chan, note.getMidiPitch(), vel, dur, note.getFret(), note.getString(), note.getString_mute()); } else if (tie == StartStop::undefined) { // TODO: modification ici pour prendre en compte les frets, strings, ... // fMidiWriter->newNote(date, chan, note.getMidiPitch(), vel, dur); fMidiWriter->newNote(date, chan, note.getMidiPitch(), vel, dur, note.getFret(), note.getString(), note.getString_mute()); } else if (tie & StartStop::start) { fPendingDuration += dur; return; } else if (tie == StartStop::stop) { dur += fPendingDuration; // TODO: modification ici pour prendre en compte les frets, strings, ... // fMidiWriter->newNote(date, chan, note.getMidiPitch(), vel, dur); fMidiWriter->newNote(date, chan, note.getMidiPitch(), vel, dur, note.getFret(), note.getString(), note.getString_mute()); fPendingDuration = 0; } } // finally adjust the current date if (note.isCue()) return; // cue don't modify the current date if (note.isGrace()) return; // cue don't modify the current date if (note.inChord()) return; // we're in a chord and time has already advanced addDuration(dur); }