8 #ifndef __VRV_MIDIFUNCTOR_H__
9 #define __VRV_MIDIFUNCTOR_H__
15 #include "alignfunctor.h"
24 class FeatureExtractor;
54 FunctorCode VisitChordEnd(
Chord *chord)
override;
55 FunctorCode VisitLayer(
Layer *layer)
override;
56 FunctorCode VisitLayerElement(
LayerElement *layerElement)
override;
57 FunctorCode VisitMeasure(
Measure *measure)
override;
58 FunctorCode VisitStaff(
Staff *staff)
override;
59 FunctorCode VisitTabGrpEnd(
TabGrp *tabGrp)
override;
72 double m_currentRealTimeSeconds;
76 data_NOTATIONTYPE m_notationType;
78 double m_currentTempo;
107 void SetCurrentTempo(
double tempo) { m_currentTempo = tempo; }
108 void SetTempoAdjustment(
double adjustment) { m_tempoAdjustment = adjustment; }
115 FunctorCode VisitLayerElement(LayerElement *layerElement)
override;
116 FunctorCode VisitMeasure(Measure *measure)
override;
117 FunctorCode VisitMeasureEnd(Measure *measure)
override;
118 FunctorCode VisitScoreDef(ScoreDef *scoreDef)
override;
119 FunctorCode VisitTempo(Tempo *tempo)
override;
126 double GetAdjustedTempo()
const {
return m_currentTempo * m_tempoAdjustment; }
132 Fraction m_currentScoreTime;
134 double m_currentRealTimeSeconds;
136 double m_currentTempo;
138 double m_tempoAdjustment;
140 int m_multiRestFactor;
169 FunctorCode VisitTie(
Tie *tie)
override;
207 void SetNoCue(
bool noCue) { m_noCue = noCue; }
214 FunctorCode VisitArpeg(Arpeg *arpeg)
override;
215 FunctorCode VisitChord(Chord *chord)
override;
216 FunctorCode VisitGraceGrpEnd(GraceGrp *graceGrp)
override;
217 FunctorCode VisitLayerEnd(Layer *layer)
override;
218 FunctorCode VisitMeasure(Measure *measure)
override;
219 FunctorCode VisitNote(Note *note)
override;
229 std::list<Note *> notes;
230 data_DURATION duration;
237 void SetGraceNotesFor(Note *refNote);
242 void SetNoteOrChordStartStop(Note *note,
const Fraction &startTime,
const Fraction &stopTime = VRV_UNSET);
243 void SetNoteStartStop(Note *note,
const Fraction &startTime,
const Fraction &stopTime = VRV_UNSET);
251 std::list<Grace> m_graces;
253 bool m_accentedGraceNote;
255 double m_currentTempo;
299 void SetCurrentTempo(
double tempo) { m_currentTempo = tempo; }
300 const std::list<OctaveInfo> &GetOctaves()
const {
return m_octaves; }
307 FunctorCode VisitMeasure(
const Measure *measure)
override;
308 FunctorCode VisitOctave(
const Octave *octave)
override;
319 double m_currentTempo;
321 std::list<OctaveInfo> m_octaves;
336 using MIDINoteSequence = std::list<MIDINote>;
343 double m_stopTime = 0;
368 std::set<int> GetTempoEventTicks()
const {
return m_tempoEventTicks; }
375 void SetChannel(
int channel) { m_midiChannel = channel; }
376 void SetControlEvents(
bool controlEvents) { m_controlEvents = controlEvents; }
377 void SetNoCue(
bool noCue) { m_noCue = noCue; }
378 void SetCurrentTempo(
double tempo) { m_currentTempo = tempo; }
379 void SetDeferredNotes(
const std::map<const Note *, double> &deferredNotes) { m_deferredNotes = deferredNotes; }
380 void SetLayerN(
int layerN) { m_layerN = layerN; }
381 void SetOctaves(
const std::list<OctaveInfo> &octaves) { m_octaves = octaves; }
382 void SetStaffN(
int staffN) { m_staffN = staffN; }
383 void SetTempoEventTicks(
const std::set<int> &ticks) { m_tempoEventTicks = ticks; }
384 void SetTrack(
int track) { m_midiTrack = track; }
385 void SetTransSemi(
int transSemi) { m_transSemi = transSemi; }
386 void SetInstrDef(
const InstrDef *instrDef) { m_instrDef = instrDef; }
387 void SetCustomTuning(
const CustomTuning *customTuning) { m_customTuning = customTuning; }
394 FunctorCode VisitBeatRpt(
const BeatRpt *beatRpt)
override;
395 FunctorCode VisitBTrem(
const BTrem *bTrem)
override;
396 FunctorCode VisitChord(
const Chord *chord)
override;
397 FunctorCode VisitFTrem(
const FTrem *fTrem)
override;
398 FunctorCode VisitHalfmRpt(
const HalfmRpt *halfmRpt)
override;
399 FunctorCode VisitLayer(
const Layer *layer)
override;
400 FunctorCode VisitLayerEnd(
const Layer *layer)
override;
401 FunctorCode VisitLayerElement(
const LayerElement *layerElement)
override;
402 FunctorCode VisitMeasure(
const Measure *measure)
override;
403 FunctorCode VisitMRpt(
const MRpt *mRpt)
override;
404 FunctorCode VisitNote(
const Note *note)
override;
405 FunctorCode VisitPedal(
const Pedal *pedal)
override;
406 FunctorCode VisitScoreDef(
const ScoreDef *scoreDef)
override;
407 FunctorCode VisitStaff(
const Staff *staff)
override;
408 FunctorCode VisitStaffDef(
const StaffDef *staffDef)
override;
409 FunctorCode VisitSyl(
const Syl *syl)
override;
410 FunctorCode VisitVerse(
const Verse *verse)
override;
419 void DeferMIDINote(
const Note *refNote,
double shift,
bool includeChordSiblings);
424 void HandleOctave(
const LayerElement *layerElement);
429 int GetMIDIPitch(
const Note *note);
435 smf::MidiFile *m_midiFile;
451 double m_currentTempo;
454 std::set<int> m_tempoEventTicks;
456 const Note *m_lastNote;
458 std::map<const Note *, MIDINoteSequence> m_expandedNotes;
460 std::map<const Note *, double> m_deferredNotes;
462 std::list<OctaveInfo> m_octaves;
466 std::vector<MIDIHeldNote> m_heldNotes;
468 bool m_controlEvents;
470 const InstrDef *m_instrDef;
472 const CustomTuning *m_customTuning;
500 void SetNoCue(
bool noCue) { m_noCue = noCue; }
506 FunctorCode VisitLayerElement(
const LayerElement *layerElement)
override;
507 FunctorCode VisitMeasure(
const Measure *measure)
override;
508 FunctorCode VisitMRest(
const MRest *mRest)
override;
509 FunctorCode VisitMultiRest(
const MultiRest *multiRest)
override;
510 FunctorCode VisitNote(
const Note *note)
override;
511 FunctorCode VisitRest(
const Rest *rest)
override;
512 FunctorCode VisitStaff(
const Staff *staff)
override;
521 void AddTimemapEntry(
const Object *
object);
527 Fraction m_currentScoreTime;
529 double m_currentRealTimeMilliseconds;
531 double m_currentTempo;
564 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:545
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:558
This class performs the export to a MidiFile.
Definition: midifunctor.h:349
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:362
This class exports the object to a JSON timemap file.
Definition: midifunctor.h:482
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:495
This class initializes the MIDI export.
Definition: midifunctor.h:280
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:293
This class calculates the maximum duration of each measure.
Definition: midifunctor.h:88
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:101
This class prepares Note onsets.
Definition: midifunctor.h:35
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:48
This class adjusts note duration for grace notes and arpeggios.
Definition: midifunctor.h:188
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:201
This class adjusts note timings based on ties.
Definition: midifunctor.h:150
bool ImplementsEndInterface() const override
Return true if the functor implements the end interface.
Definition: midifunctor.h:163
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:64
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:110
This class models the MEI <tabGrp> element.
Definition: tabgrp.h:24
This class models the MEI <tie> element.
Definition: tie.h:32
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:341
Helper struct to store note sequences which replace notes in MIDI output due to expanded ornaments an...
Definition: midifunctor.h:331
Helper struct to store octave data.
Definition: midifunctor.h:267