8 #ifndef __VRV_MIDIFUNCTOR_H__
9 #define __VRV_MIDIFUNCTOR_H__
15 #include "alignfunctor.h"
23 class FeatureExtractor;
52 FunctorCode VisitChordEnd(
Chord *chord)
override;
53 FunctorCode VisitLayer(
Layer *layer)
override;
54 FunctorCode VisitLayerElement(
LayerElement *layerElement)
override;
55 FunctorCode VisitMeasure(
Measure *measure)
override;
56 FunctorCode VisitStaff(
Staff *staff)
override;
57 FunctorCode VisitTabGrpEnd(
TabGrp *tabGrp)
override;
70 double m_currentRealTimeSeconds;
74 data_NOTATIONTYPE m_notationType;
76 double m_currentTempo;
105 void SetCurrentTempo(
double tempo) { m_currentTempo = tempo; }
106 void SetTempoAdjustment(
double adjustment) { m_tempoAdjustment = adjustment; }
113 FunctorCode VisitLayerElement(LayerElement *layerElement)
override;
114 FunctorCode VisitMeasure(Measure *measure)
override;
115 FunctorCode VisitMeasureEnd(Measure *measure)
override;
116 FunctorCode VisitScoreDef(ScoreDef *scoreDef)
override;
117 FunctorCode VisitTempo(Tempo *tempo)
override;
124 double GetAdjustedTempo()
const {
return m_currentTempo * m_tempoAdjustment; }
130 Fraction m_currentScoreTime;
132 double m_currentRealTimeSeconds;
134 double m_currentTempo;
136 double m_tempoAdjustment;
138 int m_multiRestFactor;
167 FunctorCode VisitTie(
Tie *tie)
override;
205 void SetNoCue(
bool noCue) { m_noCue = noCue; }
212 FunctorCode VisitArpeg(Arpeg *arpeg)
override;
213 FunctorCode VisitChord(Chord *chord)
override;
214 FunctorCode VisitGraceGrpEnd(GraceGrp *graceGrp)
override;
215 FunctorCode VisitLayerEnd(Layer *layer)
override;
216 FunctorCode VisitMeasure(Measure *measure)
override;
217 FunctorCode VisitNote(Note *note)
override;
227 std::list<Note *> notes;
228 data_DURATION duration;
235 void SetGraceNotesFor(Note *refNote);
240 void SetNoteStartStop(Note *note,
const Fraction &startTime,
const Fraction &stopTime);
241 void SetNoteStart(Note *note,
const Fraction &startTime);
249 std::list<Grace> m_graces;
251 bool m_accentedGraceNote;
253 double m_currentTempo;
297 void SetCurrentTempo(
double tempo) { m_currentTempo = tempo; }
298 const std::list<OctaveInfo> &GetOctaves()
const {
return m_octaves; }
305 FunctorCode VisitMeasure(
const Measure *measure)
override;
306 FunctorCode VisitOctave(
const Octave *octave)
override;
317 double m_currentTempo;
319 std::list<OctaveInfo> m_octaves;
334 using MIDINoteSequence = std::list<MIDINote>;
341 double m_stopTime = 0;
366 std::set<int> GetTempoEventTicks()
const {
return m_tempoEventTicks; }
373 void SetChannel(
int channel) { m_midiChannel = channel; }
374 void SetControlEvents(
bool controlEvents) { m_controlEvents = controlEvents; }
375 void SetNoCue(
bool noCue) { m_noCue = noCue; }
376 void SetCurrentTempo(
double tempo) { m_currentTempo = tempo; }
377 void SetDeferredNotes(
const std::map<const Note *, double> &deferredNotes) { m_deferredNotes = deferredNotes; }
378 void SetLayerN(
int layerN) { m_layerN = layerN; }
379 void SetOctaves(
const std::list<OctaveInfo> &octaves) { m_octaves = octaves; }
380 void SetStaffN(
int staffN) { m_staffN = staffN; }
381 void SetTempoEventTicks(
const std::set<int> &ticks) { m_tempoEventTicks = ticks; }
382 void SetTrack(
int track) { m_midiTrack = track; }
383 void SetTransSemi(
int transSemi) { m_transSemi = transSemi; }
390 FunctorCode VisitBeatRpt(
const BeatRpt *beatRpt)
override;
391 FunctorCode VisitBTrem(
const BTrem *bTrem)
override;
392 FunctorCode VisitChord(
const Chord *chord)
override;
393 FunctorCode VisitFTrem(
const FTrem *fTrem)
override;
394 FunctorCode VisitHalfmRpt(
const HalfmRpt *halfmRpt)
override;
395 FunctorCode VisitLayer(
const Layer *layer)
override;
396 FunctorCode VisitLayerEnd(
const Layer *layer)
override;
397 FunctorCode VisitLayerElement(
const LayerElement *layerElement)
override;
398 FunctorCode VisitMeasure(
const Measure *measure)
override;
399 FunctorCode VisitMRpt(
const MRpt *mRpt)
override;
400 FunctorCode VisitNote(
const Note *note)
override;
401 FunctorCode VisitPedal(
const Pedal *pedal)
override;
402 FunctorCode VisitScoreDef(
const ScoreDef *scoreDef)
override;
403 FunctorCode VisitStaff(
const Staff *staff)
override;
404 FunctorCode VisitStaffDef(
const StaffDef *staffDef)
override;
405 FunctorCode VisitSyl(
const Syl *syl)
override;
406 FunctorCode VisitVerse(
const Verse *verse)
override;
415 void DeferMIDINote(
const Note *refNote,
double shift,
bool includeChordSiblings);
420 void HandleOctave(
const LayerElement *layerElement);
425 int GetMIDIPitch(
const Note *note) {
return note->GetMIDIPitch(m_transSemi, m_octaveShift); }
431 smf::MidiFile *m_midiFile;
447 double m_currentTempo;
450 std::set<int> m_tempoEventTicks;
452 const Note *m_lastNote;
454 std::map<const Note *, MIDINoteSequence> m_expandedNotes;
456 std::map<const Note *, double> m_deferredNotes;
458 std::list<OctaveInfo> m_octaves;
462 std::vector<MIDIHeldNote> m_heldNotes;
464 bool m_controlEvents;
492 void SetNoCue(
bool noCue) { m_noCue = noCue; }
498 FunctorCode VisitLayerElement(
const LayerElement *layerElement)
override;
499 FunctorCode VisitMeasure(
const Measure *measure)
override;
500 FunctorCode VisitMRest(
const MRest *mRest)
override;
501 FunctorCode VisitMultiRest(
const MultiRest *multiRest)
override;
502 FunctorCode VisitNote(
const Note *note)
override;
503 FunctorCode VisitRest(
const Rest *rest)
override;
512 void AddTimemapEntry(
const Object *
object);
518 Fraction m_currentScoreTime;
520 double m_currentRealTimeMilliseconds;
522 double m_currentTempo;
555 FunctorCode VisitObject(
const Object *
object)
override;
This class represents a collection of notes in the same layer with the same onset time.
Definition: chord.h:44
This abstract class is the base class for all const functors.
Definition: functor.h:126
This abstract class is the base class for all mutable functors that need access to the document.
Definition: functor.h:151
This class is a hold the data and corresponds to the model of a MVC design pattern.
Definition: doc.h:41
Definition: fraction.h:19
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class exports the object to a JSON feature file.
Definition: midifunctor.h:536
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:549
This class performs the export to a MidiFile.
Definition: midifunctor.h:347
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:360
This class exports the object to a JSON timemap file.
Definition: midifunctor.h:474
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:487
This class initializes the MIDI export.
Definition: midifunctor.h:278
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:291
This class calculates the maximum duration of each measure.
Definition: midifunctor.h:86
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:99
This class prepares Note onsets.
Definition: midifunctor.h:33
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:46
This class adjusts note duration for grace notes and arpeggios.
Definition: midifunctor.h:186
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:199
This class adjusts note timings based on ties.
Definition: midifunctor.h:148
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:161
This class is a base class for the Layer (<layer>) content.
Definition: layerelement.h:51
This class represents a layer in a laid-out score (Doc).
Definition: layer.h:39
This class represents a measure in a page-based score (Doc).
Definition: measure.h:46
This class represents a basic object.
Definition: object.h:61
This class models the MEI <octave> element.
Definition: octave.h:31
This class represents a staff in a laid-out score (Doc).
Definition: staff.h:107
This class models the MEI <tabGrp> element.
Definition: tabgrp.h:23
This class models the MEI <tie> element.
Definition: tie.h:27
This class holds a timemap for exporting onset / offset values.
Definition: timemap.h:52
Regroup pointers to meterSig, mensur and proport objects.
Definition: alignfunctor.h:21
Helper struct for held notes in tablature.
Definition: midifunctor.h:339
Helper struct to store note sequences which replace notes in MIDI output due to expanded ornaments an...
Definition: midifunctor.h:329
Helper struct to store octave data.
Definition: midifunctor.h:265