Verovio
Source code documentation
durationinterface.h
1 // Name: durationinterface.h
3 // Author: Laurent Pugin
4 // Created: 2011
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_DURATION_INTERFACE_H__
9 #define __VRV_DURATION_INTERFACE_H__
10 
11 #include "atts_cmn.h"
12 #include "atts_gestural.h"
13 #include "atts_mensural.h"
14 #include "atts_shared.h"
15 #include "fraction.h"
16 #include "interface.h"
17 
18 namespace vrv {
19 
20 class Mensur;
21 class Object;
22 
23 //----------------------------------------------------------------------------
24 // DurationInterface
25 //----------------------------------------------------------------------------
26 
32  public AttAugmentDots,
33  public AttBeamSecondary,
34  public AttDurationGes,
35  public AttDurationLog,
36  public AttDurationQuality,
37  public AttDurationRatio,
38  public AttFermataPresent,
39  public AttStaffIdent {
40 public:
47  virtual ~DurationInterface();
48  void Reset() override;
49  InterfaceId IsInterface() const override { return INTERFACE_DURATION; }
51 
55  void SetDurDefault(data_DURATION dur) { m_durDefault = dur; }
57  data_DURATION GetDurDefault() const { return m_durDefault; }
59 
66  Fraction GetInterfaceAlignmentDuration(int num, int numBase) const;
67 
73  int num, int numBase, const Mensur *currentMensur, data_DURATION equivalence) const;
74 
78  Fraction DurationWithBrevisEquivalence(
80  int num, int numBase, const Mensur *currentMensur, data_DURATION noteDur) const;
81  Fraction DurationWithSemibrevisEquivalence(
82  int num, int numBase, const Mensur *currentMensur, data_DURATION noteDur) const;
83  Fraction DurationWithMinimaEquivalence(
84  int num, int numBase, const Mensur *currentMensur, data_DURATION noteDur) const;
86 
90  bool IsFirstInBeam(const LayerElement *noteOrRest) const;
91 
95  bool IsLastInBeam(const LayerElement *noteOrRest) const;
96 
102  data_DURATION GetActualDur() const;
104  data_DURATION GetActualDurGes() const;
106 
111  data_DURATION GetNoteOrChordDur(const LayerElement *element) const;
112 
116  bool IsMensuralDur() const;
117 
122  bool HasIdenticalDurationInterface(const DurationInterface *otherDurationInterface) const;
123 
127  void SetScoreTimeOnset(Fraction scoreTime);
129  void SetRealTimeOnsetSeconds(double timeInSeconds);
130  void SetScoreTimeOffset(Fraction scoreTime);
131  void SetRealTimeOffsetSeconds(double timeInSeconds);
132  void SetScoreTimeTiedDuration(Fraction timeInSeconds);
133  Fraction GetScoreTimeOnset() const;
134  double GetRealTimeOnsetMilliseconds() const;
135  Fraction GetScoreTimeOffset() const;
136  Fraction GetScoreTimeTiedDuration() const;
137  double GetRealTimeOffsetMilliseconds() const;
138  Fraction GetScoreTimeDuration() const;
140 
141  //-----------------//
142  // Pseudo functors //
143  //-----------------//
144 
151 private:
155  data_DURATION CalcActualDur(data_DURATION dur) const;
156 
157 public:
158  //
159 private:
164  Fraction m_scoreTimeOnset;
165 
174  Fraction m_scoreTimeOffset;
175 
179  double m_realTimeOnsetMilliseconds;
180 
186  double m_realTimeOffsetMilliseconds;
187 
194  Fraction m_scoreTimeTiedDuration;
195 
199  data_DURATION m_durDefault;
200 };
201 
202 } // namespace vrv
203 
204 #endif
vrv::DurationInterface::IsInterface
InterfaceId IsInterface() const override
Virtual method returning the InterfaceId of the interface.
Definition: durationinterface.h:49
vrv::DurationInterface::GetInterfaceAlignmentDuration
Fraction GetInterfaceAlignmentDuration(int num, int numBase) const
Returns the duration (in Fraction) for the element.
vrv::Interface
This is a base class for regrouping MEI att classes.
Definition: interface.h:32
vrv::DurationInterface::IsFirstInBeam
bool IsFirstInBeam(const LayerElement *noteOrRest) const
Return true if the note or rest is the first of a beam.
vrv::DurationInterface::Reset
void Reset() override
Virtual reset method.
vrv::DurationInterface::IsMensuralDur
bool IsMensuralDur() const
Return true if the value is a mensural (DURATION_longa, brevis, etc.)
vrv::DurationInterface::GetNoteOrChordDur
data_DURATION GetNoteOrChordDur(const LayerElement *element) const
If the element is part of a chord, return the chord actual duration, otherwise the note actual durati...
vrv::DurationInterface::SetScoreTimeOnset
void SetScoreTimeOnset(Fraction scoreTime)
MIDI timing information.
vrv::DurationInterface
This class is an interface for elements with duration, such as notes and rests.
Definition: durationinterface.h:31
vrv::DurationInterface::HasIdenticalDurationInterface
bool HasIdenticalDurationInterface(const DurationInterface *otherDurationInterface) const
Interface comparison operator.
vrv::DurationInterface::IsLastInBeam
bool IsLastInBeam(const LayerElement *noteOrRest) const
Return true if the note or rest is the last of a beam.
vrv::DurationInterface::GetInterfaceAlignmentMensuralDuration
Fraction GetInterfaceAlignmentMensuralDuration(int num, int numBase, const Mensur *currentMensur, data_DURATION equivalence) const
Returns the duration (in Fraction) for the element for mensural notation The level of equality is giv...