-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scoring up implementation as functor #3800
base: develop
Are you sure you want to change the base?
Changes from all commits
c98e2ed
0464368
d409a55
f141c9a
2114a56
97cf79d
7a0a61a
0ab0bfb
db58bff
f49a9d1
ff44446
ed144a9
6d7e57a
8053f40
8892095
c4c39ed
75c6bb7
b5fcc9d
2d2b3fa
593ae25
758fa11
6621587
64e1cfe
d0e1c7e
ad2868a
9138d98
eab73c0
c789e82
7a49570
87c1aa0
bc34284
34d660f
b84d383
6fd9316
249c0d5
035746e
6182cc6
734a5f5
d950a87
94db5ea
d9f4574
e03bf0d
fbc48bc
f0c29ff
30544fc
26d218f
32e0c16
bf54e3f
c5e3887
3cce967
40a1ac1
fccc32f
6f91e0f
9c053d8
722c233
bb92458
22e491d
6834c9a
ff5dbd6
3a74f03
422a372
596f8f1
d90b059
8abab6e
6f7ce99
d8f6917
7616ee1
0d15646
c78c42f
0246a33
126ee36
41319ca
2bb11a3
09d8f02
e3d9e0c
be9553c
4f3a424
47314b5
585804a
c19e554
ecdc262
b8a08bc
380c405
afac0a8
803c9fb
4f91a6a
3837c00
ebbdcf9
ce06d28
506f949
7cf2803
70b75de
4c99873
55fc195
d845675
1da089f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
///////////////////////////////////////////////////////////////////////////// | ||
// Name: scoringupfunctor.h | ||
// Author: Martha E. M. Thomae Elias | ||
// Created: 2024 | ||
// Copyright (c) Authors and others. All rights reserved. | ||
///////////////////////////////////////////////////////////////////////////// | ||
/// | ||
#ifndef __VRV_SCORINGUPFUNCTOR_H__ | ||
#define __VRV_SCORINGUPFUNCTOR_H__ | ||
|
||
#include "functor.h" | ||
|
||
namespace vrv { | ||
|
||
//---------------------------------------------------------------------------- | ||
// ScoringUpFunctor | ||
//---------------------------------------------------------------------------- | ||
|
||
/** | ||
* This class... | ||
*/ | ||
class ScoringUpFunctor : public Functor { | ||
public: | ||
/** | ||
* @name Constructors, destructors | ||
*/ | ||
///@{ | ||
ScoringUpFunctor(); | ||
virtual ~ScoringUpFunctor() = default; | ||
///@} | ||
|
||
/* | ||
* Abstract base implementation | ||
*/ | ||
bool ImplementsEndInterface() const override { return false; } | ||
|
||
/* | ||
* Methods | ||
*/ | ||
/** | ||
* @name: Divide the notes of a voice into sequences to be processed individualy | ||
*/ | ||
///@{ | ||
void workInMensur(const ArrayOfElementDurPairs &m_dursInVoiceSameMensur, data_DURATION noteLevel); | ||
std::vector<ArrayOfElementDurPairs> SubdivideIntoBoundedSequences( | ||
const ArrayOfElementDurPairs &dursInVoiceSameMensur, data_DURATION boundUnit); | ||
void ProcessBoundedSequences(const std::vector<ArrayOfElementDurPairs> &listOfSequences, data_DURATION boundUnit); | ||
void ProcessBoundedSequences(const ArrayOfElementDurPairs &sequence, data_DURATION boundUnit); | ||
ArrayOfElementDurPairs GetBoundedNotes(const ArrayOfElementDurPairs &sequence, data_DURATION boundUnit); | ||
///@} | ||
|
||
/** | ||
martha-thomae marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @name: Apply the principles of imperfection and alteration (find @dur.quality of notes: perfecta / imperfecta / | ||
* altera) for sequences with or without dots of division | ||
*/ | ||
///@{ | ||
bool EvalDotOfDiv(const ArrayOfElementDurPairs &middleSeq, const ArrayOfElementDurPairs &sequence, int dotInd, | ||
data_DURATION unit); | ||
void FindDurQuals(const ArrayOfElementDurPairs &middleSeq, double valueInUnit, data_DURATION boundUnit); | ||
///@} | ||
|
||
/** | ||
* @name: Find the duration value of the note in minims or another given unit | ||
*/ | ||
///@{ | ||
double GetDurNumberValue( | ||
const std::pair<LayerElement *, data_DURATION> &elementDurPair, bool followedByDot, LayerElement *nextElement); | ||
double GetValueInMinims(const ArrayOfElementDurPairs &middleSeq); | ||
double GetValueInUnit(double valueInMinims, data_DURATION unit); | ||
///@} | ||
|
||
/** | ||
* @name Apply the modifications of imperfection and alteration or leaves the notes with their default perfect value | ||
*/ | ||
///@{ | ||
Note *ImperfectionAPP(const ArrayOfElementDurPairs &sequence, data_DURATION boundUnit); | ||
Note *ImperfectionAPA(const ArrayOfElementDurPairs &sequence, data_DURATION boundUnit); | ||
Note *Alteration(const ArrayOfElementDurPairs &sequence, data_DURATION boundUnit); | ||
bool LeavePerfect(const ArrayOfElementDurPairs &sequence, data_DURATION boundUnit); | ||
void ApplyAugmentationsAndPerfections(); | ||
///@} | ||
|
||
/* | ||
* Functor interface | ||
*/ | ||
///@{ | ||
FunctorCode VisitLayer(Layer *layer) override; | ||
FunctorCode VisitLayerElement(LayerElement *layerElement) override; | ||
///@} | ||
/// | ||
|
||
protected: | ||
// | ||
private: | ||
// | ||
|
||
public: | ||
// | ||
|
||
private: | ||
// The current score time in the measure (incremented by each element) | ||
double m_currentScoreTime; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure where you use this but you might want to change to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, I am going to use this for adding the barlines automatically. Once the implementation of the scoring up is complete and correct, I will do the automatic barring stuff. |
||
// The current notation type | ||
data_NOTATIONTYPE m_notationType; | ||
// The current Mensur | ||
Mensur *m_currentMensur; | ||
int m_modusMaior; | ||
int m_modusMinor; | ||
int m_tempus; | ||
int m_prolatio; | ||
// Vector of pairs of elements (that are notes, rests, or dots) and their durations | ||
ArrayOfElementDurPairs m_dursInVoiceSameMensur; | ||
// Vector of vectors of pairs of elements (that are notes, rests, or dots) and their durations | ||
std::vector<ArrayOfElementDurPairs> m_listOfSequences; | ||
// List of pairs made of the form {note, following_dot} for notes followed by dots of augmentation | ||
std::list<std::pair<Note *, Dot *>> m_listOfAugNotesDotsPairs; | ||
// List of pairs made of the form {note, following_dot} for notes followed by dots of perfection | ||
std::list<std::pair<Note *, Dot *>> m_listOfPerfNotesDotsPairs; | ||
}; | ||
|
||
} // namespace vrv | ||
|
||
#endif /* scoringupfunctor_h */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -526,7 +526,7 @@ Mensur *Layer::GetCurrentMensur() | |
const Mensur *Layer::GetCurrentMensur() const | ||
{ | ||
const Staff *staff = vrv_cast<const Staff *>(this->GetFirstAncestor(STAFF)); | ||
assert(staff && staff->m_drawingStaffDef); | ||
// assert(staff && staff->m_drawingStaffDef); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am curious about this... ;-) This is normally used in drawing code, so it is not available at the stage you are doing the scoring up. We can see if you can set the values before you call the scoring up, but how can this work when removing the assert? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't exactly remember what happened. I get this message on the console when running the program:
The message didn't go away and allow me to run things until I commented that line out. That was a long time ago, so I was still learning a bit about what I was doing. I would appreciate some feedback if you know what is causing this issue. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will look once I have a test file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! I just provided some test files below :) |
||
return staff->m_drawingStaffDef->GetCurrentMensur(); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalize