Finale PDK Framework 0.77
Power Up Your Finale Music Software
Loading...
Searching...
No Matches
ff_timesig.h
1/*
2 * File: ff_timesig.h
3 * Author: Jari Williamsson
4 *
5 * Created on den 9 april 2011, 14:28
6 */
7
8#ifndef FF_TIMESIG_H
9#define FF_TIMESIG_H
10
11#include "ff_basecollection.h"
12/* ff_other.h can NOT be included here! */
13
14
15#ifdef PDK_FRAMEWORK_COMPOSITETIMESIGS
18#endif
19
27{
28#ifndef DOXYGEN_SHOULD_IGNORE_THIS
29#include "pragma_align_begin.h"
30 struct _TIMESIG_DATASTRUCT {
31 twobyte beats;
32 twobyte beatduration;
33 bool compositetop;
34 bool compositebottom;
35 bool abbreviate;
36 } _timesigdata;
37#include "pragma_align_end.h"
38#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
39
40public:
41
44 {
45 _timesigdata.beats = 4;
46 _timesigdata.beatduration = 1024;
47 _timesigdata.compositetop = false;
48 _timesigdata.compositebottom = false;
49 _timesigdata.abbreviate = false;
50 }
51
52 const char* ClassName() const override { return "FCTimeSignature"; }
53 const PDKFRAMEWORK_CLASSID GetClassID() const override { return FCID_TIMESIGNATURE; }
54
63 void SetBeats(twobyte value)
64 {
65 _timesigdata.beats = value;
66 }
67
76 void SetBeatDuration(twobyte value)
77 {
78 _timesigdata.beatduration = value;
79 }
80
82 void SetCompositeTop(bool value) { _timesigdata.compositetop = value; }
83
85 void SetCompositeBottom(bool value) { _timesigdata.compositebottom = value; }
86
87
95 void SetAbbreviate(bool state) { _timesigdata.abbreviate = state; }
96
105 twobyte GetBeats() const
106 {
107 return _timesigdata.beats;
108 }
109
110#ifdef PDK_FRAMEWORK_COMPOSITETIMESIGS
118 twobyte CalcBeats();
119
127 twobyte CalcLargestBeats();
128#endif
129
135 twobyte GetBeatDuration() const
136 {
137 return _timesigdata.beatduration;
138 }
139
140#ifdef PDK_FRAMEWORK_COMPOSITETIMESIGS
148 twobyte CalcSmallestBeatDuration();
149
157 twobyte CalcLargestBeatDuration();
158#endif
159
165 bool GetCompositeTop() const { return _timesigdata.compositetop; }
166
172 bool GetCompositeBottom() const { return _timesigdata.compositebottom; }
173
181 bool GetAbbreviate() const { return _timesigdata.abbreviate; }
182
183#ifdef PDK_FRAMEWORK_COMPOSITETIMESIGS
190 bool IsBeatPosition(TimeEdu32 eduposition);
191
200 int CalcBeatPosition(TimeEdu32 eduposition);
201
208 TimeEdu32 CalcPrevBeatPosition(TimeEdu32 eduposition);
209
219 TimeEdu32 CalcNextBeatPosition(TimeEdu32 eduposition);
220
233 bool IsIdentical(const __FCBase* pCompareObject) const override;
234
245 bool IsCompound();
246
252 {
253 if (GetBeats() != 4) return false;
254 if (GetBeatDuration() != 1024) return false;
255 return true;
256 }
257
266 void RemoveCompositeTop(twobyte newNumBeats);
267
276 void RemoveCompositeBottom(twobyte newBeatDuration);
277#endif
278
286 static bool IsCompoundBeatDuration(TimeEdu32 duration);
287
300 void MakeString(FCString* pString);
301
302#ifdef PDK_FRAMEWORK_COMPOSITETIMESIGS
314
315#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
317 luabridge::RefCountedPtr<FCCompositeTimeSigTop> CreateCompositeTop_GC() const
318 { return makeLuaSharedPtr(CreateCompositeTop()); }
319#endif
320
331 bool SaveNewCompositeTop(FCCompositeTimeSigTop* pCompositeTop);
332
342
343#ifdef PDK_FRAMEWORK_LUAFRIENDLY_CPP
345 luabridge::RefCountedPtr<FCCompositeTimeSigBottom> CreateCompositeBottom_GC() const
346 { return makeLuaSharedPtr(CreateCompositeBottom()); }
347#endif
348
359 bool SaveNewCompositeBottom(FCCompositeTimeSigBottom* pCompositeBottom);
360#endif
361};
362
363
364#endif /* FF_TIMESIG_H */
365
Base class for the Finale Framework classes.
Definition ff_base.h:71
PDKFRAMEWORK_CLASSID
Constants for the GetClassID method.
Definition ff_base.h:84
A collection of __FCCompositeTimeSigBottomElement records.
Definition ff_other.h:920
A collection of __FCCompositeTimeSigTopElement records.
Definition ff_other.h:516
Class that provides storage for text. This is to achieve platform-transparent text handling,...
Definition ff_base.h:1877
Class for time signatures. Instances of this class are auto-created when needed by FCMeasure:GetTimeS...
Definition ff_timesig.h:27
twobyte CalcLargestBeats()
Gets the largest number of beats in the time signature. This method works with time sigs with composi...
Definition finaleframework.cpp:36475
TimeEdu32 CalcPrevBeatPosition(TimeEdu32 eduposition)
Definition finaleframework.cpp:36702
twobyte GetBeatDuration() const
Gets the beat duration. If the time signature has a composite bottom, this represent a composite reco...
Definition ff_timesig.h:135
void SetAbbreviate(bool state)
Sets if the time signature should be abbreviated (to cut and common time).
Definition ff_timesig.h:95
FCCompositeTimeSigTop * CreateCompositeTop() const
Creates, loads and initializes a composite top object.
Definition finaleframework.cpp:36998
bool GetCompositeBottom() const
Returns true if the bottom part of the time signature is marked as composite.
Definition ff_timesig.h:172
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_timesig.h:52
FCTimeSignature()
The constructor. Sets the default time signature to 4/4.
Definition ff_timesig.h:43
twobyte CalcLargestBeatDuration()
Gets the largest beat duration found in the time signature. This method works with time sigs with com...
Definition finaleframework.cpp:36525
bool GetCompositeTop() const
Returns true if the top part of the time signature is marked as composite.
Definition ff_timesig.h:165
bool SaveNewCompositeBottom(FCCompositeTimeSigBottom *pCompositeBottom)
Saves a new composite bottom object and assigns the ID to the time sig.
Definition finaleframework.cpp:37036
void SetBeatDuration(twobyte value)
Sets the beat duration (in EDUs), or the composite bottom ID.
Definition ff_timesig.h:76
void SetCompositeTop(bool value)
Sets the composite "mark" of the top part of the time signature.
Definition ff_timesig.h:82
bool IsCompound()
Returns true if the time signature is a compound meter, such as 3/8, 6/8, etc.
Definition finaleframework.cpp:36550
bool IsIdentical(const __FCBase *pCompareObject) const override
Returns true if the time signature is identical to the compared time signature.
Definition finaleframework.cpp:36811
static bool IsCompoundBeatDuration(TimeEdu32 duration)
Returns true if the time signature duration is a compound meter, such as 3/8, 6/8,...
Definition finaleframework.cpp:36605
TimeEdu32 CalcNextBeatPosition(TimeEdu32 eduposition)
Definition finaleframework.cpp:36750
twobyte CalcSmallestBeatDuration()
Gets the smallest beat duration found in the time signature. This method works with time sigs with co...
Definition finaleframework.cpp:36500
bool SaveNewCompositeTop(FCCompositeTimeSigTop *pCompositeTop)
Saves a new composite top object and assigns the ID to the time sig.
Definition finaleframework.cpp:37009
void SetBeats(twobyte value)
Sets the number of beats, or the composite top ID.
Definition ff_timesig.h:63
const PDKFRAMEWORK_CLASSID GetClassID() const override
Returns the internal class ID for the PDK Framework class. This is implemented mostly because Lua has...
Definition ff_timesig.h:53
void RemoveCompositeTop(twobyte newNumBeats)
Removes any composite top numbers and sets the number of beats to the input value.
Definition finaleframework.cpp:36578
twobyte GetBeats() const
Gets the number of beats. If the time signature has a composite top, this represent a composite recor...
Definition ff_timesig.h:105
bool IsBeatPosition(TimeEdu32 eduposition)
Returns true if the position is a "beat" in the time signature.
Definition finaleframework.cpp:36617
bool IsCommonTime()
Returns true if the time signature is in 4/4.
Definition ff_timesig.h:251
int CalcBeatPosition(TimeEdu32 eduposition)
Definition finaleframework.cpp:36657
void RemoveCompositeBottom(twobyte newBeatDuration)
Removes any composite bottom numbers and and sets the beat duration to the input value.
Definition finaleframework.cpp:36590
void SetCompositeBottom(bool value)
Sets the composite "mark" of the bottom part of the time signature.
Definition ff_timesig.h:85
void MakeString(FCString *pString)
Creates a string representation of the time signature.
Definition finaleframework.cpp:36903
twobyte CalcBeats()
To get the number of beats for both standard or composite time signatures.
Definition finaleframework.cpp:36796
FCCompositeTimeSigBottom * CreateCompositeBottom() const
Creates, loads and initializes a composite bottom object.
Definition finaleframework.cpp:37024
bool GetAbbreviate() const
Returns true if the time signature should be abbreviated (to cut and common time).
Definition ff_timesig.h:181