fixed conversion warnings
This commit is contained in:
parent
66408a9cb4
commit
edb273ec06
|
@ -5,7 +5,7 @@ if (MSVC)
|
|||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_compile_options(/wd4127) # disabled warning: C4127: conditional expression is constant
|
||||
else()
|
||||
add_compile_options(-Wall -Wextra)
|
||||
add_compile_options(-Wall -Wextra ) #-Wconversion
|
||||
endif()
|
||||
|
||||
# Target
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <QList>
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
|
||||
template<typename T>
|
||||
inline T value(const std::vector<T>& vec, size_t idx)
|
||||
|
@ -50,12 +51,19 @@ int main()
|
|||
{
|
||||
std::cout << "Hello World" << std::endl;
|
||||
|
||||
std::list<int> l1 = { 1, 2, 3 };
|
||||
std::list<int> l2 = { 11, 21, 31 };
|
||||
int v1 = 100004321;
|
||||
float v2 = 100004321.;
|
||||
|
||||
for (auto it1 = l1.begin(), it2 = l2.begin(); it1 != l1.end(); ++it1, ++it2) {
|
||||
std::cout << "a: " << *it1 << ", b: " << *it2 << "\n";
|
||||
}
|
||||
std::cout << "v1: " << static_cast<float>(v1) << "\n";
|
||||
std::cout << "v2: " << v2 << "\n";
|
||||
|
||||
uint64_t vi = std::numeric_limits<uint64_t>::max();
|
||||
std::cout << "vi: " << static_cast<float>(vi - 10) << "\n";
|
||||
|
||||
std::cout << "float: " << std::numeric_limits<float>::max() << "\n";
|
||||
std::cout << "int: " << std::numeric_limits<int>::max() << "\n";
|
||||
std::cout << "double: " << std::numeric_limits<double>::max() << "\n";
|
||||
std::cout << "uint64_t: " << std::numeric_limits<uint64_t>::max() << "\n";
|
||||
|
||||
std::cout << " Goodbye!" << std::endl;
|
||||
|
||||
|
|
|
@ -226,3 +226,6 @@ if (MSVC)
|
|||
# temporarily disabled some warnings (int vs size_t)
|
||||
target_compile_options(${MODULE} PUBLIC /wd4267)
|
||||
endif()
|
||||
|
||||
#target_compile_options(${MODULE} PUBLIC -Wconversion)
|
||||
#target_compile_options(${MODULE} PUBLIC -Wno-float-conversion)
|
||||
|
|
|
@ -187,20 +187,20 @@ public:
|
|||
int pitch() const { return _a; }
|
||||
int controller() const { return _a; }
|
||||
|
||||
void setDataA(int v) { _a = v; }
|
||||
void setPitch(int v) { _a = v; }
|
||||
void setController(int v) { _a = v; }
|
||||
void setDataA(int v) { _a = static_cast<uchar>(v); }
|
||||
void setPitch(int v) { _a = static_cast<uchar>(v); }
|
||||
void setController(int v) { _a = static_cast<uchar>(v); }
|
||||
|
||||
int dataB() const { return _b; }
|
||||
int velo() const { return _b; }
|
||||
int value() const { return _b; }
|
||||
|
||||
void setDataB(int v) { _b = v; }
|
||||
void setVelo(int v) { _b = v; }
|
||||
void setValue(int v) { _b = v; }
|
||||
void setDataB(int v) { _b = static_cast<uchar>(v); }
|
||||
void setVelo(int v) { _b = static_cast<uchar>(v); }
|
||||
void setValue(int v) { _b = static_cast<uchar>(v); }
|
||||
|
||||
void setData(int a, int b) { _a = a; _b = b; }
|
||||
void setData(int t, int a, int b) { _type = t; _a = a; _b = b; }
|
||||
void setData(int a, int b) { _a = static_cast<uchar>(a); _b = static_cast<uchar>(b); }
|
||||
void setData(int t, int a, int b) { _type = static_cast<uchar>(t); _a = static_cast<uchar>(a); _b = static_cast<uchar>(b); }
|
||||
|
||||
bool isChannelEvent() const;
|
||||
bool operator==(const MidiCoreEvent& e) const
|
||||
|
@ -218,28 +218,28 @@ public:
|
|||
switch (type()) {
|
||||
case EventType::ME_NOTEOFF:
|
||||
u.data_as_bytes[0] = 0x80 | channel();
|
||||
u.data_as_bytes[1] = pitch();
|
||||
u.data_as_bytes[1] = static_cast<unsigned char>(pitch());
|
||||
u.data_as_bytes[2] = 0;
|
||||
u.data_as_bytes[3] = 0;
|
||||
break;
|
||||
|
||||
case EventType::ME_NOTEON:
|
||||
u.data_as_bytes[0] = 0x90 | channel();
|
||||
u.data_as_bytes[1] = pitch();
|
||||
u.data_as_bytes[2] = velo();
|
||||
u.data_as_bytes[1] = static_cast<unsigned char>(pitch());
|
||||
u.data_as_bytes[2] = static_cast<unsigned char>(velo());
|
||||
u.data_as_bytes[3] = 0;
|
||||
break;
|
||||
|
||||
case EventType::ME_CONTROLLER:
|
||||
u.data_as_bytes[0] = 0xB0 | channel();
|
||||
u.data_as_bytes[1] = controller();
|
||||
u.data_as_bytes[2] = value();
|
||||
u.data_as_bytes[1] = static_cast<unsigned char>(controller());
|
||||
u.data_as_bytes[2] = static_cast<unsigned char>(value());
|
||||
u.data_as_bytes[3] = 0;
|
||||
break;
|
||||
|
||||
case EventType::ME_PROGRAM:
|
||||
u.data_as_bytes[0] = 0xC0 | channel();
|
||||
u.data_as_bytes[1] = value();
|
||||
u.data_as_bytes[1] = static_cast<unsigned char>(value());
|
||||
u.data_as_bytes[2] = 0;
|
||||
u.data_as_bytes[3] = 0;
|
||||
break;
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
case EventType::ME_PITCHBEND:
|
||||
u.data_as_bytes[0] = 0xE0 | channel();
|
||||
u.data_as_bytes[1] = pitch() & 0x7F;
|
||||
u.data_as_bytes[2] = pitch() >> 7;
|
||||
u.data_as_bytes[2] = static_cast<unsigned char>(pitch() >> 7);
|
||||
u.data_as_bytes[3] = 0;
|
||||
break;
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ public:
|
|||
inline Rect(const QRect& r)
|
||||
: RectX<int>(r.x(), r.y(), r.width(), r.height()) {}
|
||||
#endif
|
||||
inline Rect(qreal x, qreal y, qreal w, qreal h)
|
||||
inline Rect(int x, int y, int w, int h)
|
||||
: RectX<int>(x, y, w, h) {}
|
||||
|
||||
inline RectF toRectF() const { return RectF(x(), y(), width(), height()); }
|
||||
|
|
|
@ -39,9 +39,9 @@ using namespace Ms;
|
|||
// layoutSegmentElements
|
||||
//---------------------------------------------------------
|
||||
|
||||
static void layoutSegmentElements(Segment* segment, int startTrack, int endTrack)
|
||||
static void layoutSegmentElements(Segment* segment, track_idx_t startTrack, track_idx_t endTrack)
|
||||
{
|
||||
for (int track = startTrack; track < endTrack; ++track) {
|
||||
for (track_idx_t track = startTrack; track < endTrack; ++track) {
|
||||
if (EngravingItem* e = segment->element(track)) {
|
||||
e->layout();
|
||||
}
|
||||
|
@ -54,11 +54,11 @@ static void layoutSegmentElements(Segment* segment, int startTrack, int endTrack
|
|||
// - offset as necessary to avoid conflict
|
||||
//---------------------------------------------------------
|
||||
|
||||
void LayoutChords::layoutChords1(Score* score, Segment* segment, int staffIdx)
|
||||
void LayoutChords::layoutChords1(Score* score, Segment* segment, staff_idx_t staffIdx)
|
||||
{
|
||||
const Staff* staff = score->Score::staff(staffIdx);
|
||||
const int startTrack = staffIdx * VOICES;
|
||||
const int endTrack = startTrack + VOICES;
|
||||
const track_idx_t startTrack = staffIdx * VOICES;
|
||||
const track_idx_t endTrack = startTrack + VOICES;
|
||||
const Fraction tick = segment->tick();
|
||||
|
||||
if (staff->isTabStaff(tick)) {
|
||||
|
@ -87,7 +87,7 @@ void LayoutChords::layoutChords1(Score* score, Segment* segment, int staffIdx)
|
|||
bool upGrace = false;
|
||||
bool downGrace = false;
|
||||
|
||||
for (int track = startTrack; track < endTrack; ++track) {
|
||||
for (track_idx_t track = startTrack; track < endTrack; ++track) {
|
||||
EngravingItem* e = segment->element(track);
|
||||
if (e && e->isChord()) {
|
||||
Chord* chord = toChord(e);
|
||||
|
@ -456,7 +456,7 @@ void LayoutChords::layoutChords1(Score* score, Segment* segment, int staffIdx)
|
|||
}
|
||||
|
||||
// apply chord offsets
|
||||
for (int track = startTrack; track < endTrack; ++track) {
|
||||
for (track_idx_t track = startTrack; track < endTrack; ++track) {
|
||||
EngravingItem* e = segment->element(track);
|
||||
if (e && e->isChord()) {
|
||||
Chord* chord = toChord(e);
|
||||
|
|
|
@ -40,7 +40,7 @@ class LayoutChords
|
|||
{
|
||||
public:
|
||||
|
||||
static void layoutChords1(Ms::Score* score, Ms::Segment* segment, int staffIdx);
|
||||
static void layoutChords1(Ms::Score* score, Ms::Segment* segment, staff_idx_t staffIdx);
|
||||
static qreal layoutChords2(std::vector<Ms::Note*>& notes, bool up);
|
||||
static void layoutChords3(const Ms::MStyle& style, std::vector<Ms::Note*>&, const Ms::Staff*, Ms::Segment*);
|
||||
};
|
||||
|
|
|
@ -191,7 +191,7 @@ void LayoutHarmonies::alignHarmonies(const System* system, const std::vector<Seg
|
|||
|
||||
// Collect all fret diagrams and chord symbol and store them per staff.
|
||||
// In the same pass, the maximum height is collected.
|
||||
std::map<int, HarmonyList> staves;
|
||||
std::map<staff_idx_t, HarmonyList> staves;
|
||||
for (const Segment* s : sl) {
|
||||
for (EngravingItem* e : s->annotations()) {
|
||||
if ((harmony && e->isHarmony()) || (!harmony && e->isFretDiagram())) {
|
||||
|
@ -200,7 +200,7 @@ void LayoutHarmonies::alignHarmonies(const System* system, const std::vector<Seg
|
|||
}
|
||||
}
|
||||
|
||||
for (int idx : mu::keys(staves)) {
|
||||
for (staff_idx_t idx : mu::keys(staves)) {
|
||||
// Align the objects.
|
||||
// Algorithm:
|
||||
// - Find highest placed harmony/fretdiagram.
|
||||
|
|
|
@ -37,7 +37,7 @@ using namespace Ms;
|
|||
// findLyricsMaxY
|
||||
//---------------------------------------------------------
|
||||
|
||||
static qreal findLyricsMaxY(const MStyle& style, Segment& s, int staffIdx)
|
||||
static qreal findLyricsMaxY(const MStyle& style, Segment& s, staff_idx_t staffIdx)
|
||||
{
|
||||
qreal yMax = 0.0;
|
||||
if (!s.isChordRestType()) {
|
||||
|
@ -78,7 +78,7 @@ static qreal findLyricsMaxY(const MStyle& style, Segment& s, int staffIdx)
|
|||
// findLyricsMinY
|
||||
//---------------------------------------------------------
|
||||
|
||||
static qreal findLyricsMinY(const MStyle& style, Segment& s, int staffIdx)
|
||||
static qreal findLyricsMinY(const MStyle& style, Segment& s, staff_idx_t staffIdx)
|
||||
{
|
||||
qreal yMin = 0.0;
|
||||
if (!s.isChordRestType()) {
|
||||
|
@ -157,7 +157,7 @@ static void applyLyricsMax(const MStyle& style, Segment& s, staff_idx_t staffIdx
|
|||
}
|
||||
}
|
||||
|
||||
static void applyLyricsMax(const MStyle& style, Measure* m, int staffIdx, qreal yMax)
|
||||
static void applyLyricsMax(const MStyle& style, Measure* m, staff_idx_t staffIdx, qreal yMax)
|
||||
{
|
||||
for (Segment& s : m->segments()) {
|
||||
applyLyricsMax(style, s, staffIdx, yMax);
|
||||
|
|
|
@ -766,7 +766,7 @@ void LayoutMeasure::getNextMeasure(const LayoutOptions& options, LayoutContext&
|
|||
}
|
||||
}
|
||||
|
||||
for (size_t staffIdx = 0; staffIdx < score->nstaves(); ++staffIdx) {
|
||||
for (staff_idx_t staffIdx = 0; staffIdx < score->nstaves(); ++staffIdx) {
|
||||
for (Segment& segment : measure->segments()) {
|
||||
if (segment.isChordRestType()) {
|
||||
LayoutChords::layoutChords1(score, &segment, staffIdx);
|
||||
|
|
|
@ -534,9 +534,9 @@ void LayoutSystem::hideEmptyStaves(Score* score, System* system, bool isFirstSys
|
|||
Part* part = staff->part();
|
||||
size_t n = part->nstaves();
|
||||
if (hideStaff && (n > 1)) {
|
||||
int idx = part->staves()->front()->idx();
|
||||
staff_idx_t idx = part->staves()->front()->idx();
|
||||
for (staff_idx_t i = 0; i < part->nstaves(); ++i) {
|
||||
int st = idx + i;
|
||||
staff_idx_t st = idx + i;
|
||||
|
||||
for (MeasureBase* mb : system->measures()) {
|
||||
if (!mb->isMeasure()) {
|
||||
|
@ -765,7 +765,7 @@ void LayoutSystem::layoutSystemElements(const LayoutOptions& options, LayoutCont
|
|||
//-------------------------------------------------------------
|
||||
|
||||
for (Segment* s : sl) {
|
||||
std::set<int> recreateShapes;
|
||||
std::set<staff_idx_t> recreateShapes;
|
||||
for (EngravingItem* e : s->elist()) {
|
||||
if (!e || !e->isChordRest() || !score->staff(e->staffIdx())->show()) {
|
||||
continue;
|
||||
|
@ -816,7 +816,7 @@ void LayoutSystem::layoutSystemElements(const LayoutOptions& options, LayoutCont
|
|||
}
|
||||
}
|
||||
}
|
||||
for (auto staffIdx : recreateShapes) {
|
||||
for (staff_idx_t staffIdx : recreateShapes) {
|
||||
s->createShape(staffIdx);
|
||||
}
|
||||
}
|
||||
|
@ -844,7 +844,7 @@ void LayoutSystem::layoutSystemElements(const LayoutOptions& options, LayoutCont
|
|||
// layout tuplets
|
||||
//-------------------------------------------------------------
|
||||
|
||||
std::map<int, Fraction> skipTo;
|
||||
std::map<track_idx_t, Fraction> skipTo;
|
||||
for (Segment* s : sl) {
|
||||
for (EngravingItem* e : s->elist()) {
|
||||
if (!e || !e->isChordRest() || !score->staff(e->staffIdx())->show()) {
|
||||
|
|
|
@ -546,7 +546,7 @@ void Score::cmdAddSpanner(Spanner* spanner, staff_idx_t staffIdx, Segment* start
|
|||
// from previous cr (or beginning of measure) to next cr (or end of measure)
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Score::expandVoice(Segment* s, int track)
|
||||
void Score::expandVoice(Segment* s, track_idx_t track)
|
||||
{
|
||||
if (!s) {
|
||||
qDebug("expand voice: no segment");
|
||||
|
@ -799,7 +799,7 @@ void Score::createCRSequence(const Fraction& f, ChordRest* cr, const Fraction& t
|
|||
// return segment of last created note/rest
|
||||
//---------------------------------------------------------
|
||||
|
||||
Segment* Score::setNoteRest(Segment* segment, int track, NoteVal nval, Fraction sd, DirectionV stemDirection,
|
||||
Segment* Score::setNoteRest(Segment* segment, track_idx_t track, NoteVal nval, Fraction sd, DirectionV stemDirection,
|
||||
bool forceAccidental, const std::set<SymId>& articulationIds, bool rhythmic, InputState* externalInputState)
|
||||
{
|
||||
Q_ASSERT(segment->segmentType() == SegmentType::ChordRest);
|
||||
|
@ -984,7 +984,7 @@ Segment* Score::setNoteRest(Segment* segment, int track, NoteVal nval, Fraction
|
|||
// return size of actual gap
|
||||
//---------------------------------------------------------
|
||||
|
||||
Fraction Score::makeGap(Segment* segment, int track, const Fraction& _sd, Tuplet* tuplet, bool keepChord)
|
||||
Fraction Score::makeGap(Segment* segment, track_idx_t track, const Fraction& _sd, Tuplet* tuplet, bool keepChord)
|
||||
{
|
||||
Q_ASSERT(_sd.numerator());
|
||||
|
||||
|
@ -1205,7 +1205,7 @@ bool Score::makeGap1(const Fraction& baseTick, staff_idx_t staffIdx, const Fract
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Score::makeGapVoice(Segment* seg, int track, Fraction len, const Fraction& tick)
|
||||
bool Score::makeGapVoice(Segment* seg, track_idx_t track, Fraction len, const Fraction& tick)
|
||||
{
|
||||
ChordRest* cr = 0;
|
||||
cr = toChordRest(seg->element(track));
|
||||
|
|
|
@ -293,7 +293,7 @@ Tuplet* Score::addTuplet(ChordRest* destinationChordRest, Fraction ratio, Tuplet
|
|||
// create segment if necessary
|
||||
//---------------------------------------------------------
|
||||
|
||||
Rest* Score::addRest(const Fraction& tick, int track, TDuration d, Tuplet* tuplet)
|
||||
Rest* Score::addRest(const Fraction& tick, track_idx_t track, TDuration d, Tuplet* tuplet)
|
||||
{
|
||||
Measure* measure = tick2measure(tick);
|
||||
Rest* rest = Factory::createRest(this->dummy()->segment(), d);
|
||||
|
@ -312,7 +312,7 @@ Rest* Score::addRest(const Fraction& tick, int track, TDuration d, Tuplet* tuple
|
|||
// addRest
|
||||
//---------------------------------------------------------
|
||||
|
||||
Rest* Score::addRest(Segment* s, int track, TDuration d, Tuplet* tuplet)
|
||||
Rest* Score::addRest(Segment* s, track_idx_t track, TDuration d, Tuplet* tuplet)
|
||||
{
|
||||
Rest* rest = Factory::createRest(s, d);
|
||||
if (d.type() == DurationType::V_MEASURE) {
|
||||
|
@ -408,7 +408,7 @@ ChordRest* Score::addClone(ChordRest* cr, const Fraction& tick, const TDuration&
|
|||
// create one or more rests to fill "l"
|
||||
//---------------------------------------------------------
|
||||
|
||||
Rest* Score::setRest(const Fraction& _tick, int track, const Fraction& _l, bool useDots, Tuplet* tuplet, bool useFullMeasureRest)
|
||||
Rest* Score::setRest(const Fraction& _tick, track_idx_t track, const Fraction& _l, bool useDots, Tuplet* tuplet, bool useFullMeasureRest)
|
||||
{
|
||||
Fraction l = _l;
|
||||
Fraction tick = _tick;
|
||||
|
@ -1466,7 +1466,7 @@ Note* Score::addMidiPitch(int pitch, bool addFlag)
|
|||
// in staff
|
||||
//---------------------------------------------------------
|
||||
|
||||
ChordRest* Score::searchNote(const Fraction& tick, int track) const
|
||||
ChordRest* Score::searchNote(const Fraction& tick, track_idx_t track) const
|
||||
{
|
||||
ChordRest* ipe = 0;
|
||||
SegmentType st = SegmentType::ChordRest;
|
||||
|
|
|
@ -314,10 +314,10 @@ class Instrument
|
|||
QString _trackName;
|
||||
QString _id;
|
||||
|
||||
char _minPitchA = 0;
|
||||
char _maxPitchA = 0;
|
||||
char _minPitchP = 0;
|
||||
char _maxPitchP = 0;
|
||||
int _minPitchA = 0;
|
||||
int _maxPitchA = 0;
|
||||
int _minPitchP = 0;
|
||||
int _maxPitchP = 0;
|
||||
Interval _transpose;
|
||||
QString _instrumentId;
|
||||
|
||||
|
|
|
@ -23,14 +23,16 @@
|
|||
#ifndef __INTERVAL_H__
|
||||
#define __INTERVAL_H__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Ms {
|
||||
//---------------------------------------------------------
|
||||
// Interval
|
||||
//---------------------------------------------------------
|
||||
|
||||
struct Interval {
|
||||
signed char diatonic;
|
||||
signed char chromatic;
|
||||
int8_t diatonic;
|
||||
int8_t chromatic;
|
||||
|
||||
Interval();
|
||||
Interval(int a, int b);
|
||||
|
|
|
@ -209,7 +209,7 @@ Location Location::positionForElement(const EngravingItem* e, bool absfrac)
|
|||
|
||||
int Location::track(const EngravingItem* e)
|
||||
{
|
||||
int track = e->track();
|
||||
int track = static_cast<int>(e->track());
|
||||
if (track < 0) {
|
||||
const MeasureBase* mb = e->findMeasureBase();
|
||||
if (mb && !mb->isMeasure()) {
|
||||
|
|
|
@ -552,15 +552,15 @@ void MasterScore::setUpdateAll()
|
|||
// setLayoutAll
|
||||
//---------------------------------------------------------
|
||||
|
||||
void MasterScore::setLayoutAll(int staff, const EngravingItem* e)
|
||||
void MasterScore::setLayoutAll(staff_idx_t staff, const EngravingItem* e)
|
||||
{
|
||||
_cmdState.setTick(Fraction(0, 1));
|
||||
_cmdState.setTick(measures()->last() ? measures()->last()->endTick() : Fraction(0, 1));
|
||||
|
||||
if (e && e->score() == this) {
|
||||
// TODO: map staff number properly
|
||||
const int startStaff = staff == -1 ? 0 : staff;
|
||||
const int endStaff = staff == -1 ? (nstaves() - 1) : staff;
|
||||
const staff_idx_t startStaff = staff == mu::nidx ? 0 : staff;
|
||||
const staff_idx_t endStaff = staff == mu::nidx ? (nstaves() - 1) : staff;
|
||||
_cmdState.setStaff(startStaff);
|
||||
_cmdState.setStaff(endStaff);
|
||||
|
||||
|
@ -572,7 +572,7 @@ void MasterScore::setLayoutAll(int staff, const EngravingItem* e)
|
|||
// setLayout
|
||||
//---------------------------------------------------------
|
||||
|
||||
void MasterScore::setLayout(const Fraction& t, int staff, const EngravingItem* e)
|
||||
void MasterScore::setLayout(const Fraction& t, staff_idx_t staff, const EngravingItem* e)
|
||||
{
|
||||
if (t >= Fraction(0, 1)) {
|
||||
_cmdState.setTick(t);
|
||||
|
@ -585,7 +585,7 @@ void MasterScore::setLayout(const Fraction& t, int staff, const EngravingItem* e
|
|||
}
|
||||
}
|
||||
|
||||
void MasterScore::setLayout(const Fraction& tick1, const Fraction& tick2, int staff1, int staff2, const EngravingItem* e)
|
||||
void MasterScore::setLayout(const Fraction& tick1, const Fraction& tick2, staff_idx_t staff1, staff_idx_t staff2, const EngravingItem* e)
|
||||
{
|
||||
if (tick1 >= Fraction(0, 1)) {
|
||||
_cmdState.setTick(tick1);
|
||||
|
|
|
@ -168,9 +168,9 @@ public:
|
|||
|
||||
void setUpdateAll() override;
|
||||
|
||||
void setLayoutAll(int staff = -1, const EngravingItem* e = nullptr);
|
||||
void setLayout(const Fraction& tick, int staff, const EngravingItem* e = nullptr);
|
||||
void setLayout(const Fraction& tick1, const Fraction& tick2, int staff1, int staff2, const EngravingItem* e = nullptr);
|
||||
void setLayoutAll(staff_idx_t staff = mu::nidx, const EngravingItem* e = nullptr);
|
||||
void setLayout(const Fraction& tick, staff_idx_t staff, const EngravingItem* e = nullptr);
|
||||
void setLayout(const Fraction& tick1, const Fraction& tick2, staff_idx_t staff1, staff_idx_t staff2, const EngravingItem* e = nullptr);
|
||||
|
||||
CmdState& cmdState() override { return _cmdState; }
|
||||
const CmdState& cmdState() const override { return _cmdState; }
|
||||
|
|
|
@ -770,7 +770,7 @@ void Measure::layout2()
|
|||
/// Search for chord at position \a tick in \a track
|
||||
//---------------------------------------------------------
|
||||
|
||||
Chord* Measure::findChord(Fraction t, int track)
|
||||
Chord* Measure::findChord(Fraction t, track_idx_t track)
|
||||
{
|
||||
t -= tick();
|
||||
for (Segment* seg = last(); seg; seg = seg->prev()) {
|
||||
|
@ -792,7 +792,7 @@ Chord* Measure::findChord(Fraction t, int track)
|
|||
/// Search for chord or rest at position \a tick at \a staff in \a voice.
|
||||
//---------------------------------------------------------
|
||||
|
||||
ChordRest* Measure::findChordRest(Fraction t, int track)
|
||||
ChordRest* Measure::findChordRest(Fraction t, track_idx_t track)
|
||||
{
|
||||
t -= tick();
|
||||
for (const Segment& seg : m_segments) {
|
||||
|
|
|
@ -224,8 +224,8 @@ public:
|
|||
void layoutMeasureNumber();
|
||||
void layoutMMRestRange();
|
||||
|
||||
Chord* findChord(Fraction tick, int track);
|
||||
ChordRest* findChordRest(Fraction tick, int track);
|
||||
Chord* findChord(Fraction tick, track_idx_t track);
|
||||
ChordRest* findChordRest(Fraction tick, track_idx_t track);
|
||||
Fraction snap(const Fraction& tick, const mu::PointF p) const;
|
||||
Fraction snapNote(const Fraction& tick, const mu::PointF p, int staff) const;
|
||||
|
||||
|
@ -313,9 +313,9 @@ public:
|
|||
Measure* mmRestFirst() const;
|
||||
Measure* mmRestLast() const;
|
||||
|
||||
int measureRepeatCount(int staffIdx) const { return m_mstaves[staffIdx]->measureRepeatCount(); }
|
||||
int measureRepeatCount(staff_idx_t staffIdx) const { return m_mstaves[staffIdx]->measureRepeatCount(); }
|
||||
void setMeasureRepeatCount(int n, int staffIdx) { m_mstaves[staffIdx]->setMeasureRepeatCount(n); }
|
||||
bool isMeasureRepeatGroup(int staffIdx) const { return measureRepeatCount(staffIdx); } // alias for convenience
|
||||
bool isMeasureRepeatGroup(staff_idx_t staffIdx) const { return measureRepeatCount(staffIdx); } // alias for convenience
|
||||
bool isMeasureRepeatGroupWithNextM(int staffIdx) const;
|
||||
bool isMeasureRepeatGroupWithPrevM(int staffIdx) const;
|
||||
Measure* firstOfMeasureRepeatGroup(int staffIdx) const; // used to find beginning of group
|
||||
|
|
|
@ -181,8 +181,8 @@ private:
|
|||
|
||||
VeloType _veloType { VeloType::OFFSET_VAL };
|
||||
|
||||
char _offTimeType { 0 }; // compatibility only 1 - user(absolute), 2 - offset (%)
|
||||
char _onTimeType { 0 }; // compatibility only 1 - user, 2 - offset
|
||||
int _offTimeType { 0 }; // compatibility only 1 - user(absolute), 2 - offset (%)
|
||||
int _onTimeType { 0 }; // compatibility only 1 - user, 2 - offset
|
||||
|
||||
int _subchannel { 0 }; ///< articulation
|
||||
int _line { INVALID_LINE }; ///< y-Position; 0 - top line.
|
||||
|
|
|
@ -50,7 +50,7 @@ class MeasureBase;
|
|||
class Page final : public EngravingItem
|
||||
{
|
||||
std::vector<System*> _systems;
|
||||
int _no; // page number
|
||||
page_idx_t _no; // page number
|
||||
|
||||
BspTree bspTree;
|
||||
bool bspTreeValid;
|
||||
|
@ -81,8 +81,8 @@ public:
|
|||
|
||||
void appendSystem(System* s);
|
||||
|
||||
int no() const { return _no; }
|
||||
void setNo(int n) { _no = n; }
|
||||
page_idx_t no() const { return _no; }
|
||||
void setNo(page_idx_t n) { _no = n; }
|
||||
bool isOdd() const;
|
||||
qreal tm() const; // margins in pixel
|
||||
qreal bm() const;
|
||||
|
|
|
@ -5566,9 +5566,9 @@ std::list<MidiInputEvent>* Score::activeMidiPitches() { return _masterScore->act
|
|||
|
||||
void Score::setUpdateAll() { _masterScore->setUpdateAll(); }
|
||||
|
||||
void Score::setLayoutAll(int staff, const EngravingItem* e) { _masterScore->setLayoutAll(staff, e); }
|
||||
void Score::setLayout(const Fraction& tick, int staff, const EngravingItem* e) { _masterScore->setLayout(tick, staff, e); }
|
||||
void Score::setLayout(const Fraction& tick1, const Fraction& tick2, int staff1, int staff2, const EngravingItem* e)
|
||||
void Score::setLayoutAll(staff_idx_t staff, const EngravingItem* e) { _masterScore->setLayoutAll(staff, e); }
|
||||
void Score::setLayout(const Fraction& tick, staff_idx_t staff, const EngravingItem* e) { _masterScore->setLayout(tick, staff, e); }
|
||||
void Score::setLayout(const Fraction& tick1, const Fraction& tick2, staff_idx_t staff1, staff_idx_t staff2, const EngravingItem* e)
|
||||
{
|
||||
_masterScore->setLayout(tick1, tick2, staff1, staff2, e);
|
||||
}
|
||||
|
|
|
@ -704,7 +704,7 @@ public:
|
|||
|
||||
Note* setGraceNote(Chord*, int pitch, NoteType type, int len);
|
||||
|
||||
Segment* setNoteRest(Segment*, int track, NoteVal nval, Fraction, DirectionV stemDirection = DirectionV::AUTO,
|
||||
Segment* setNoteRest(Segment*, track_idx_t track, NoteVal nval, Fraction, DirectionV stemDirection = DirectionV::AUTO,
|
||||
bool forceAccidental = false, const std::set<SymId>& articulationIds = {}, bool rhythmic = false,
|
||||
InputState* externalInputState = nullptr);
|
||||
Segment* setChord(Segment*, int track, Chord* chord, Fraction, DirectionV stemDirection = DirectionV::AUTO);
|
||||
|
@ -712,23 +712,23 @@ public:
|
|||
void changeCRlen(ChordRest* cr, const Fraction&, bool fillWithRest=true);
|
||||
void createCRSequence(const Fraction& f, ChordRest* cr, const Fraction& tick);
|
||||
|
||||
Fraction makeGap(Segment*, int track, const Fraction&, Tuplet*, bool keepChord = false);
|
||||
Fraction makeGap(Segment*, track_idx_t track, const Fraction&, Tuplet*, bool keepChord = false);
|
||||
bool makeGap1(const Fraction& baseTick, staff_idx_t staffIdx, const Fraction& len, int voiceOffset[VOICES]);
|
||||
bool makeGapVoice(Segment* seg, int track, Fraction len, const Fraction& tick);
|
||||
bool makeGapVoice(Segment* seg, track_idx_t track, Fraction len, const Fraction& tick);
|
||||
|
||||
Rest* addRest(const Fraction& tick, int track, TDuration, Tuplet*);
|
||||
Rest* addRest(Segment* seg, int track, TDuration d, Tuplet*);
|
||||
Rest* addRest(const Fraction& tick, track_idx_t track, TDuration, Tuplet*);
|
||||
Rest* addRest(Segment* seg, track_idx_t track, TDuration d, Tuplet*);
|
||||
Chord* addChord(const Fraction& tick, TDuration d, Chord* oc, bool genTie, Tuplet* tuplet);
|
||||
MeasureRepeat* addMeasureRepeat(const Fraction& tick, int track, int numMeasures);
|
||||
|
||||
Tuplet* addTuplet(ChordRest* destinationChordRest, Fraction ratio, TupletNumberType numberType, TupletBracketType bracketType);
|
||||
|
||||
ChordRest* addClone(ChordRest* cr, const Fraction& tick, const TDuration& d);
|
||||
Rest* setRest(const Fraction& tick, int track, const Fraction&, bool useDots, Tuplet* tuplet, bool useFullMeasureRest = true);
|
||||
Rest* setRest(const Fraction& tick, track_idx_t track, const Fraction&, bool useDots, Tuplet* tuplet, bool useFullMeasureRest = true);
|
||||
|
||||
void upDown(bool up, UpDownMode);
|
||||
void upDownDelta(int pitchDelta);
|
||||
ChordRest* searchNote(const Fraction& tick, int track) const;
|
||||
ChordRest* searchNote(const Fraction& tick, track_idx_t track) const;
|
||||
|
||||
// undo/redo ops
|
||||
void toggleArticulation(SymId);
|
||||
|
@ -780,9 +780,9 @@ public:
|
|||
void cmdAddTimeSig(Measure*, int staffIdx, TimeSig*, bool local);
|
||||
|
||||
virtual void setUpdateAll();
|
||||
void setLayoutAll(int staff = -1, const EngravingItem* e = nullptr);
|
||||
void setLayout(const Fraction& tick, int staff, const EngravingItem* e = nullptr);
|
||||
void setLayout(const Fraction& tick1, const Fraction& tick2, int staff1, int staff2, const EngravingItem* e = nullptr);
|
||||
void setLayoutAll(staff_idx_t staff = mu::nidx, const EngravingItem* e = nullptr);
|
||||
void setLayout(const Fraction& tick, staff_idx_t staff, const EngravingItem* e = nullptr);
|
||||
void setLayout(const Fraction& tick1, const Fraction& tick2, staff_idx_t staff1, staff_idx_t staff2, const EngravingItem* e = nullptr);
|
||||
virtual CmdState& cmdState();
|
||||
virtual const CmdState& cmdState() const;
|
||||
virtual void addLayoutFlags(LayoutFlags);
|
||||
|
@ -866,7 +866,7 @@ public:
|
|||
MeasureBase* getNextPrevSectionBreak(MeasureBase*, bool) const;
|
||||
EngravingItem* getScoreElementOfMeasureBase(MeasureBase*) const;
|
||||
|
||||
int fileDivision(int t) const { return ((qint64)t * Constant::division + _fileDivision / 2) / _fileDivision; }
|
||||
int fileDivision(int t) const { return static_cast<int>(((qint64)t * Constant::division + _fileDivision / 2) / _fileDivision); }
|
||||
void setFileDivision(int t) { _fileDivision = t; }
|
||||
|
||||
bool dirty() const;
|
||||
|
@ -1050,7 +1050,7 @@ public:
|
|||
void splitStaff(staff_idx_t staffIdx, int splitPoint);
|
||||
Lyrics* addLyrics();
|
||||
FiguredBass* addFiguredBass();
|
||||
void expandVoice(Segment* s, int track);
|
||||
void expandVoice(Segment* s, track_idx_t track);
|
||||
void expandVoice();
|
||||
|
||||
EngravingItem* selectMove(const QString& cmd);
|
||||
|
|
|
@ -919,7 +919,7 @@ void Segment::checkEmpty() const
|
|||
// swapElements
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Segment::swapElements(int i1, int i2)
|
||||
void Segment::swapElements(track_idx_t i1, track_idx_t i2)
|
||||
{
|
||||
std::iter_swap(_elist.begin() + i1, _elist.begin() + i2);
|
||||
if (_elist[i1]) {
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
|
||||
void add(EngravingItem*) override;
|
||||
void remove(EngravingItem*) override;
|
||||
void swapElements(int i1, int i2);
|
||||
void swapElements(track_idx_t i1, track_idx_t i2);
|
||||
|
||||
void sortStaves(std::vector<staff_idx_t>& dst);
|
||||
const char* subTypeName() const;
|
||||
|
@ -204,8 +204,8 @@ public:
|
|||
bool hasElements(track_idx_t minTrack, track_idx_t maxTrack) const;
|
||||
bool allElementsInvisible() const;
|
||||
|
||||
qreal dotPosX(int staffIdx) const { return _dotPosX[staffIdx]; }
|
||||
void setDotPosX(int staffIdx, qreal val) { _dotPosX[staffIdx] = val; }
|
||||
qreal dotPosX(staff_idx_t staffIdx) const { return _dotPosX[staffIdx]; }
|
||||
void setDotPosX(staff_idx_t staffIdx, qreal val) { _dotPosX[staffIdx] = val; }
|
||||
|
||||
Spatium extraLeadingSpace() const { return _extraLeadingSpace; }
|
||||
void setExtraLeadingSpace(Spatium v) { _extraLeadingSpace = v; }
|
||||
|
@ -272,7 +272,7 @@ public:
|
|||
qreal spacing() const;
|
||||
|
||||
// some helper function
|
||||
ChordRest* cr(int track) const { return toChordRest(_elist[track]); }
|
||||
ChordRest* cr(track_idx_t track) const { return toChordRest(_elist[track]); }
|
||||
bool isType(const SegmentType t) const { return int(_segmentType) & int(t); }
|
||||
bool isBeginBarLineType() const { return _segmentType == SegmentType::BeginBarLine; }
|
||||
bool isClefType() const { return _segmentType == SegmentType::Clef; }
|
||||
|
|
|
@ -166,7 +166,7 @@ class Selection
|
|||
// structure (e.g. MMRests reconstruction).
|
||||
|
||||
Segment* _activeSegment = nullptr;
|
||||
int _activeTrack = 0;
|
||||
track_idx_t _activeTrack = 0;
|
||||
|
||||
Fraction _currentTick; // tracks the most recent selection
|
||||
int _currentTrack = 0;
|
||||
|
@ -240,7 +240,7 @@ public:
|
|||
int activeTrack() const { return _activeTrack; }
|
||||
void setStaffStart(int v) { _staffStart = v; }
|
||||
void setStaffEnd(int v) { _staffEnd = v; }
|
||||
void setActiveTrack(int v) { _activeTrack = v; }
|
||||
void setActiveTrack(track_idx_t v) { _activeTrack = v; }
|
||||
bool canCopy() const;
|
||||
void updateSelectedElements();
|
||||
bool measureRange(Measure** m1, Measure** m2) const;
|
||||
|
|
|
@ -109,18 +109,18 @@ void SlurSegment::draw(mu::draw::Painter* painter) const
|
|||
// searchCR
|
||||
//---------------------------------------------------------
|
||||
|
||||
static ChordRest* searchCR(Segment* segment, int startTrack, int endTrack)
|
||||
static ChordRest* searchCR(Segment* segment, track_idx_t startTrack, track_idx_t endTrack)
|
||||
{
|
||||
// for (Segment* s = segment; s; s = s->next1MM(SegmentType::ChordRest)) {
|
||||
for (Segment* s = segment; s; s = s->next(SegmentType::ChordRest)) { // restrict search to measure
|
||||
if (startTrack > endTrack) {
|
||||
for (int t = startTrack - 1; t >= endTrack; --t) {
|
||||
for (int t = static_cast<int>(startTrack) - 1; t >= static_cast<int>(endTrack); --t) {
|
||||
if (s->element(t)) {
|
||||
return toChordRest(s->element(t));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int t = startTrack; t < endTrack; ++t) {
|
||||
for (track_idx_t t = startTrack; t < endTrack; ++t) {
|
||||
if (s->element(t)) {
|
||||
return toChordRest(s->element(t));
|
||||
}
|
||||
|
|
|
@ -242,9 +242,9 @@ void System::removeStaff(int idx)
|
|||
// adjustStavesNumber
|
||||
//---------------------------------------------------------
|
||||
|
||||
void System::adjustStavesNumber(int nstaves)
|
||||
void System::adjustStavesNumber(size_t nstaves)
|
||||
{
|
||||
for (size_t i = _staves.size(); static_cast<int>(i) < nstaves; ++i) {
|
||||
for (size_t i = _staves.size(); i < nstaves; ++i) {
|
||||
insertStaff(static_cast<int>(i));
|
||||
}
|
||||
const size_t dn = _staves.size() - nstaves;
|
||||
|
@ -801,7 +801,7 @@ void System::layout2(const LayoutContext& ctx)
|
|||
|
||||
for (auto i = visibleStaves.begin();; ++i) {
|
||||
SysStaff* ss = i->second;
|
||||
int si1 = i->first;
|
||||
staff_idx_t si1 = i->first;
|
||||
Staff* staff = score()->staff(si1);
|
||||
auto ni = std::next(i);
|
||||
|
||||
|
@ -1671,9 +1671,9 @@ qreal System::spacerDistance(bool up) const
|
|||
// be a downSpacer of the previous system.
|
||||
//---------------------------------------------------------
|
||||
|
||||
Spacer* System::upSpacer(int staffIdx, Spacer* prevDownSpacer) const
|
||||
Spacer* System::upSpacer(staff_idx_t staffIdx, Spacer* prevDownSpacer) const
|
||||
{
|
||||
if (staffIdx < 0) {
|
||||
if (staffIdx == mu::nidx) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1702,9 +1702,9 @@ Spacer* System::upSpacer(int staffIdx, Spacer* prevDownSpacer) const
|
|||
// Return the largest downSpacer for this system.
|
||||
//---------------------------------------------------------
|
||||
|
||||
Spacer* System::downSpacer(int staffIdx) const
|
||||
Spacer* System::downSpacer(staff_idx_t staffIdx) const
|
||||
{
|
||||
if (staffIdx < 0) {
|
||||
if (staffIdx == mu::nidx) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1821,7 +1821,7 @@ qreal System::lastNoteRestSegmentX(bool trailing)
|
|||
// returns the last chordrest of a system for a particular track
|
||||
//---------------------------------------------------------
|
||||
|
||||
ChordRest* System::lastChordRest(int track)
|
||||
ChordRest* System::lastChordRest(track_idx_t track)
|
||||
{
|
||||
for (auto measureBaseIter = measures().rbegin(); measureBaseIter != measures().rend(); measureBaseIter++) {
|
||||
if ((*measureBaseIter)->isMeasure()) {
|
||||
|
@ -1844,7 +1844,7 @@ ChordRest* System::lastChordRest(int track)
|
|||
// returns the last chordrest of a system for a particular track
|
||||
//---------------------------------------------------------
|
||||
|
||||
ChordRest* System::firstChordRest(int track)
|
||||
ChordRest* System::firstChordRest(track_idx_t track)
|
||||
{
|
||||
for (const MeasureBase* mb : measures()) {
|
||||
if (!mb->isMeasure()) {
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
|
||||
SysStaff* insertStaff(int);
|
||||
void removeStaff(int);
|
||||
void adjustStavesNumber(int);
|
||||
void adjustStavesNumber(size_t nstaves);
|
||||
|
||||
int y2staff(qreal y) const;
|
||||
staff_idx_t searchStaff(qreal y, staff_idx_t preferredStaff = mu::nidx, qreal spacingFactor = 0.5) const;
|
||||
|
@ -219,13 +219,13 @@ public:
|
|||
qreal minTop() const;
|
||||
qreal minBottom() const;
|
||||
qreal spacerDistance(bool up) const;
|
||||
Spacer* upSpacer(int staffIdx, Spacer* prevDownSpacer) const;
|
||||
Spacer* downSpacer(int staffIdx) const;
|
||||
Spacer* upSpacer(staff_idx_t staffIdx, Spacer* prevDownSpacer) const;
|
||||
Spacer* downSpacer(staff_idx_t staffIdx) const;
|
||||
|
||||
qreal firstNoteRestSegmentX(bool leading = false);
|
||||
qreal lastNoteRestSegmentX(bool trailing = false);
|
||||
ChordRest* lastChordRest(int track);
|
||||
ChordRest* firstChordRest(int track);
|
||||
ChordRest* lastChordRest(track_idx_t track);
|
||||
ChordRest* firstChordRest(track_idx_t track);
|
||||
|
||||
bool hasFixedDownDistance() const { return fixedDownDistance; }
|
||||
staff_idx_t firstVisibleStaff() const;
|
||||
|
|
|
@ -2373,7 +2373,7 @@ void SwapCR::flip(EditData*)
|
|||
{
|
||||
Segment* s1 = cr1->segment();
|
||||
Segment* s2 = cr2->segment();
|
||||
int track = cr1->track();
|
||||
track_idx_t track = cr1->track();
|
||||
|
||||
if (cr1->isChord() && cr2->isChord() && toChord(cr1)->tremolo()
|
||||
&& (toChord(cr1)->tremolo() == toChord(cr2)->tremolo())) {
|
||||
|
|
|
@ -356,9 +356,9 @@ Segment* prevSeg1(Segment* seg, int& track)
|
|||
|
||||
Note* nextChordNote(Note* note)
|
||||
{
|
||||
int track = note->track();
|
||||
int fromTrack = (track / VOICES) * VOICES;
|
||||
int toTrack = fromTrack + VOICES;
|
||||
track_idx_t track = note->track();
|
||||
track_idx_t fromTrack = (track / VOICES) * VOICES;
|
||||
track_idx_t toTrack = fromTrack + VOICES;
|
||||
// TODO : limit to same instrument, not simply to same staff!
|
||||
Segment* seg = note->chord()->segment()->nextCR(track, true);
|
||||
while (seg) {
|
||||
|
@ -368,7 +368,7 @@ Note* nextChordNote(Note* note)
|
|||
return toChord(targetElement)->upNote();
|
||||
}
|
||||
// if not, return topmost chord in track range
|
||||
for (int i = fromTrack; i < toTrack; i++) {
|
||||
for (track_idx_t i = fromTrack; i < toTrack; i++) {
|
||||
targetElement = seg->elementAt(i);
|
||||
if (targetElement && targetElement->isChord()) {
|
||||
return toChord(targetElement)->upNote();
|
||||
|
@ -381,9 +381,9 @@ Note* nextChordNote(Note* note)
|
|||
|
||||
Note* prevChordNote(Note* note)
|
||||
{
|
||||
int track = note->track();
|
||||
int fromTrack = (track / VOICES) * VOICES;
|
||||
int toTrack = fromTrack + VOICES;
|
||||
track_idx_t track = note->track();
|
||||
track_idx_t fromTrack = (track / VOICES) * VOICES;
|
||||
track_idx_t toTrack = fromTrack + VOICES;
|
||||
// TODO : limit to same instrument, not simply to same staff!
|
||||
Segment* seg = note->chord()->segment()->prev1();
|
||||
while (seg) {
|
||||
|
@ -394,7 +394,7 @@ Note* prevChordNote(Note* note)
|
|||
return toChord(targetElement)->upNote();
|
||||
}
|
||||
// if not, return topmost chord in track range
|
||||
for (int i = fromTrack; i < toTrack; i++) {
|
||||
for (track_idx_t i = fromTrack; i < toTrack; i++) {
|
||||
targetElement = seg->elementAt(i);
|
||||
if (targetElement && targetElement->isChord()) {
|
||||
return toChord(targetElement)->upNote();
|
||||
|
|
|
@ -85,8 +85,8 @@ private:
|
|||
|
||||
struct TrackBoundaries
|
||||
{
|
||||
int trackFrom = -1;
|
||||
int trackTo = -1;
|
||||
track_idx_t trackFrom = mu::nidx;
|
||||
track_idx_t trackTo = mu::nidx;
|
||||
};
|
||||
|
||||
InstrumentTrackId idKey(const Ms::EngravingItem* item) const;
|
||||
|
|
|
@ -155,7 +155,7 @@ inline mpe::NoteEvent buildNoteEvent(NominalNoteCtx&& ctx, const mpe::duration_t
|
|||
{
|
||||
return mpe::NoteEvent(ctx.timestamp + timestampOffset,
|
||||
eventDuration,
|
||||
ctx.voiceIdx,
|
||||
static_cast<mpe::voice_layer_idx_t>(ctx.voiceIdx),
|
||||
ctx.pitchLevel + pitchLevelOffset,
|
||||
ctx.chordCtx.nominalDynamicLevel,
|
||||
ctx.chordCtx.commonArticulations);
|
||||
|
|
|
@ -38,7 +38,7 @@ inline mpe::timestamp_t timestampFromTicks(const Ms::Score* score, const int tic
|
|||
|
||||
inline mpe::duration_t durationFromTicks(const qreal beatsPerSecond, const int durationTicks, const int ticksPerBeat = Constants::division)
|
||||
{
|
||||
float beatsNumber = durationTicks / static_cast<float>(ticksPerBeat);
|
||||
float beatsNumber = static_cast<float>(durationTicks) / static_cast<float>(ticksPerBeat);
|
||||
|
||||
return (beatsNumber / beatsPerSecond) * 1000;
|
||||
}
|
||||
|
|
|
@ -119,14 +119,14 @@ inline mpe::octave_t actualOctave(const int nominalOctave, const mpe::PitchClass
|
|||
constexpr int upperBound = static_cast<int>(mpe::PitchClass::Last) - 1;
|
||||
|
||||
if (shift < lowerBound) {
|
||||
return nominalOctave + 1;
|
||||
return static_cast<mpe::octave_t>(nominalOctave + 1);
|
||||
}
|
||||
|
||||
if (shift > upperBound) {
|
||||
return nominalOctave - 1;
|
||||
return static_cast<mpe::octave_t>(nominalOctave - 1);
|
||||
}
|
||||
|
||||
return nominalOctave;
|
||||
return static_cast<mpe::octave_t>(nominalOctave);
|
||||
}
|
||||
|
||||
inline mpe::pitch_level_t notePitchLevel(const int noteTpc, const int noteOctave)
|
||||
|
|
|
@ -1644,7 +1644,7 @@ static void readMeasure(Measure* m, int staffIdx, XmlReader& e, ReadContext& ctx
|
|||
if (chord->tremolo()) {
|
||||
Tremolo* tremolo = chord->tremolo();
|
||||
if (tremolo->twoNotes()) {
|
||||
int track = chord->track();
|
||||
track_idx_t track = chord->track();
|
||||
Segment* ss = 0;
|
||||
for (Segment* ps = m->first(SegmentType::ChordRest); ps; ps = ps->next(SegmentType::ChordRest)) {
|
||||
if (ps->tick() >= e.tick()) {
|
||||
|
|
|
@ -656,10 +656,10 @@ static void readDrumset206(Drumset* ds, XmlReader& e)
|
|||
static void readInstrument206(Instrument* i, Part* p, XmlReader& e)
|
||||
{
|
||||
int bank = 0;
|
||||
int volume = 100;
|
||||
int pan = 60;
|
||||
int chorus = 30;
|
||||
int reverb = 30;
|
||||
char volume = 100;
|
||||
char pan = 60;
|
||||
char chorus = 30;
|
||||
char reverb = 30;
|
||||
bool customDrumset = false;
|
||||
i->clearChannels(); // remove default channel
|
||||
while (e.readNextStartElement()) {
|
||||
|
@ -2196,7 +2196,7 @@ EngravingItem* Read206::readArticulation(EngravingItem* parent, XmlReader& e, co
|
|||
SymId sym = SymId::fermataAbove; // default -- backward compatibility (no type = ufermata in 1.2)
|
||||
ArticulationAnchor anchor = ArticulationAnchor::TOP_STAFF;
|
||||
DirectionV direction = DirectionV::AUTO;
|
||||
int track = parent->track();
|
||||
track_idx_t track = parent->track();
|
||||
double timeStretch = 0.0;
|
||||
bool useDefaultPlacement = true;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class LinkedObjects;
|
|||
struct SpannerValues {
|
||||
int spannerId;
|
||||
Fraction tick2;
|
||||
int track2;
|
||||
track_idx_t track2;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -82,7 +82,7 @@ class XmlReader : public QXmlStreamReader
|
|||
Fraction _tick { Fraction(0, 1) };
|
||||
Fraction _tickOffset { Fraction(0, 1) };
|
||||
int _intTick { 0 };
|
||||
int _track { 0 };
|
||||
track_idx_t _track = 0;
|
||||
int _trackOffset { 0 };
|
||||
bool _pasteMode { false }; // modifies read behaviour on paste operation
|
||||
Measure* _lastMeasure { 0 };
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
int track() const { return _track + _trackOffset; }
|
||||
void setTrackOffset(int val) { _trackOffset = val; }
|
||||
int trackOffset() const { return _trackOffset; }
|
||||
void setTrack(int val) { _track = val; }
|
||||
void setTrack(track_idx_t val) { _track = val; }
|
||||
bool pasteMode() const { return _pasteMode; }
|
||||
void setPasteMode(bool v) { _pasteMode = v; }
|
||||
|
||||
|
@ -206,8 +206,8 @@ public:
|
|||
void reconnectBrokenConnectors();
|
||||
|
||||
Interval transpose() const { return _transpose; }
|
||||
void setTransposeChromatic(int v) { _transpose.chromatic = v; }
|
||||
void setTransposeDiatonic(int v) { _transpose.diatonic = v; }
|
||||
void setTransposeChromatic(int8_t v) { _transpose.chromatic = v; }
|
||||
void setTransposeDiatonic(int8_t v) { _transpose.diatonic = v; }
|
||||
|
||||
std::map<int, LinkedObjects*>& linkIds() { return _elinks; }
|
||||
TracksMap& tracks() { return _tracks; }
|
||||
|
|
|
@ -39,9 +39,9 @@ namespace mu::engraving {
|
|||
// return int to avoid accidental implicit unsigned cast
|
||||
//---------------------------------------------------------
|
||||
|
||||
inline int_least64_t gcd(int_least64_t a, int_least64_t b)
|
||||
inline int64_t gcd(int64_t a, int64_t b)
|
||||
{
|
||||
int bp;
|
||||
int64_t bp;
|
||||
if (b > a) {
|
||||
bp = b;
|
||||
b = a;
|
||||
|
@ -59,8 +59,8 @@ inline int_least64_t gcd(int_least64_t a, int_least64_t b)
|
|||
class Fraction
|
||||
{
|
||||
// ensure 64 bit to avoid overflows in comparisons
|
||||
int_least64_t m_numerator = 0;
|
||||
int_least64_t m_denominator = 1;
|
||||
int64_t m_numerator = 0;
|
||||
int64_t m_denominator = 1;
|
||||
|
||||
public:
|
||||
// no implicit conversion from int to Fraction:
|
||||
|
@ -68,8 +68,8 @@ public:
|
|||
constexpr Fraction(int z, int n)
|
||||
: m_numerator{n < 0 ? -z : z}, m_denominator{n < 0 ? -n : n} {}
|
||||
|
||||
int numerator() const { return m_numerator; }
|
||||
int denominator() const { return m_denominator; }
|
||||
int numerator() const { return static_cast<int>(m_numerator); }
|
||||
int denominator() const { return static_cast<int>(m_denominator); }
|
||||
|
||||
static constexpr Fraction max() { return Fraction(10000, 1); }
|
||||
// Use this when you need to initialize a Fraction to an arbitrary high value
|
||||
|
@ -112,27 +112,27 @@ public:
|
|||
|
||||
Fraction absValue() const
|
||||
{
|
||||
return Fraction(qAbs(m_numerator), m_denominator);
|
||||
return Fraction(static_cast<int>(qAbs(m_numerator)), static_cast<int>(m_denominator));
|
||||
}
|
||||
|
||||
Fraction inverse() const
|
||||
{
|
||||
return Fraction(m_denominator, m_numerator);
|
||||
return Fraction(static_cast<int>(m_denominator), static_cast<int>(m_numerator));
|
||||
}
|
||||
|
||||
// reduction
|
||||
|
||||
void reduce()
|
||||
{
|
||||
const int g = gcd(m_numerator, m_denominator);
|
||||
const int64_t g = gcd(m_numerator, m_denominator);
|
||||
m_numerator /= g;
|
||||
m_denominator /= g;
|
||||
}
|
||||
|
||||
Fraction reduced() const
|
||||
{
|
||||
const int g = gcd(m_numerator, m_denominator);
|
||||
return Fraction(m_numerator / g, m_denominator / g);
|
||||
const int64_t g = gcd(m_numerator, m_denominator);
|
||||
return Fraction(static_cast<int>(m_numerator / g), static_cast<int>(m_denominator / g));
|
||||
}
|
||||
|
||||
// comparison
|
||||
|
@ -174,8 +174,8 @@ public:
|
|||
if (m_denominator == val.m_denominator) {
|
||||
m_numerator += val.m_numerator; // Common enough use case to be handled separately for efficiency
|
||||
} else {
|
||||
const int g = gcd(m_denominator, val.m_denominator);
|
||||
const int m1 = val.m_denominator / g; // This saves one division over straight lcm
|
||||
const int64_t g = gcd(m_denominator, val.m_denominator);
|
||||
const int64_t m1 = val.m_denominator / g; // This saves one division over straight lcm
|
||||
m_numerator = m_numerator * m1 + val.m_numerator * (m_denominator / g);
|
||||
m_denominator = m1 * m_denominator;
|
||||
}
|
||||
|
@ -187,8 +187,8 @@ public:
|
|||
if (m_denominator == val.m_denominator) {
|
||||
m_numerator -= val.m_numerator; // Common enough use case to be handled separately for efficiency
|
||||
} else {
|
||||
const int g = gcd(m_denominator, val.m_denominator);
|
||||
const int m1 = val.m_denominator / g; // This saves one division over straight lcm
|
||||
const int64_t g = gcd(m_denominator, val.m_denominator);
|
||||
const int64_t m1 = val.m_denominator / g; // This saves one division over straight lcm
|
||||
m_numerator = m_numerator * m1 - val.m_numerator * (m_denominator / g);
|
||||
m_denominator = m1 * m_denominator;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ public:
|
|||
|
||||
Fraction operator+(const Fraction& v) const { return Fraction(*this) += v; }
|
||||
Fraction operator-(const Fraction& v) const { return Fraction(*this) -= v; }
|
||||
Fraction operator-() const { return Fraction(-m_numerator, m_denominator); }
|
||||
Fraction operator-() const { return Fraction(static_cast<int>(-m_numerator), static_cast<int>(m_denominator)); }
|
||||
Fraction operator*(const Fraction& v) const { return Fraction(*this) *= v; }
|
||||
Fraction operator/(const Fraction& v) const { return Fraction(*this) /= v; }
|
||||
Fraction operator/(int v) const { return Fraction(*this) /= v; }
|
||||
|
|
|
@ -625,7 +625,7 @@ struct std::hash<mu::engraving::InstrumentTrackId>
|
|||
{
|
||||
std::size_t operator()(const mu::engraving::InstrumentTrackId& s) const noexcept
|
||||
{
|
||||
std::size_t h1 = std::hash<int> {}(s.partId.toUint64());
|
||||
std::size_t h1 = std::hash<int> {}(static_cast<int>(s.partId.toUint64()));
|
||||
std::size_t h2 = std::hash<std::string> {}(s.instrumentId);
|
||||
return h1 ^ (h2 << 1);
|
||||
}
|
||||
|
|
|
@ -865,7 +865,7 @@ static std::map<int /*tickPosition*/, T> buildEasedValueCurve(const int ticksDur
|
|||
|
||||
std::map<int, T> result;
|
||||
|
||||
float durationStep = ticksDuration / static_cast<float>(stepsCount);
|
||||
float durationStep = static_cast<float>(ticksDuration) / static_cast<float>(stepsCount);
|
||||
|
||||
for (int i = 0; i <= stepsCount; ++i) {
|
||||
result.emplace(i * durationStep, easingFactor(i / static_cast<float>(stepsCount), method) * amplitude);
|
||||
|
|
|
@ -279,7 +279,7 @@ struct Event {
|
|||
{
|
||||
assertOpcode({ Opcode::NoteOn, Opcode::NoteOff });
|
||||
if (attributeType() == AttributeType::Pitch) {
|
||||
return attribute() >> 9;
|
||||
return static_cast<uint8_t>(attribute() >> 9);
|
||||
}
|
||||
return note();
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ struct Event {
|
|||
{
|
||||
assertOpcode({ Opcode::NoteOn, Opcode::NoteOff });
|
||||
if (attributeType() == AttributeType::Pitch) {
|
||||
return (attribute() & 0x1FF) / static_cast<float>(0x200);
|
||||
return static_cast<float>((attribute() & 0x1FF) / static_cast<float>(0x200));
|
||||
}
|
||||
return 0.f;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ struct Event {
|
|||
{
|
||||
assertOpcode({ Opcode::NoteOn, Opcode::NoteOff });
|
||||
if (messageType() == MessageType::ChannelVoice20) {
|
||||
return m_data[1] >> 16;
|
||||
return static_cast<uint16_t>(m_data[1] >> 16);
|
||||
}
|
||||
return m_data[0] & 0x7F;
|
||||
}
|
||||
|
|
|
@ -138,6 +138,13 @@ struct NoteEvent
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
template<typename T>
|
||||
inline T mult(T v, float f)
|
||||
{
|
||||
return static_cast<T>(static_cast<float>(v) * f);
|
||||
}
|
||||
|
||||
void setUp()
|
||||
{
|
||||
calculateActualDuration(m_expressionCtx.articulations);
|
||||
|
@ -156,7 +163,9 @@ private:
|
|||
return;
|
||||
}
|
||||
|
||||
int timestampOffsetValue = m_arrangementCtx.nominalDuration * percentageToFactor(articulationsApplied.averageTimestampOffset());
|
||||
timestamp_t timestampOffsetValue = mult(m_arrangementCtx.nominalDuration,
|
||||
percentageToFactor(articulationsApplied.averageTimestampOffset()));
|
||||
|
||||
m_arrangementCtx.actualTimestamp += timestampOffsetValue;
|
||||
}
|
||||
|
||||
|
@ -168,7 +177,8 @@ private:
|
|||
return;
|
||||
}
|
||||
|
||||
m_arrangementCtx.actualDuration *= percentageToFactor(articulationsApplied.averageDurationFactor());
|
||||
m_arrangementCtx.actualDuration = mult(m_arrangementCtx.actualDuration,
|
||||
percentageToFactor(articulationsApplied.averageDurationFactor()));
|
||||
}
|
||||
|
||||
void calculatePitchCurve(const ArticulationMap& articulationsApplied)
|
||||
|
@ -181,11 +191,11 @@ private:
|
|||
return;
|
||||
}
|
||||
|
||||
float ratio = articulationsApplied.averagePitchRange() / static_cast<float>(PITCH_LEVEL_STEP);
|
||||
float ratio = static_cast<float>(articulationsApplied.averagePitchRange()) / static_cast<float>(PITCH_LEVEL_STEP);
|
||||
float patternUnitRatio = PITCH_LEVEL_STEP / static_cast<float>(ONE_PERCENT);
|
||||
|
||||
for (auto& pair : m_pitchCtx.pitchCurve) {
|
||||
pair.second = RealRound(pair.second * ratio * patternUnitRatio, 0);
|
||||
pair.second = RealRound(static_cast<float>(pair.second) * ratio * patternUnitRatio, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,17 +212,19 @@ private:
|
|||
|
||||
float dynamicAmplifyFactor = static_cast<float>(articulationDynamicLevel - naturalDynamicLevel) / DYNAMIC_LEVEL_STEP;
|
||||
|
||||
dynamic_level_t amplificationDiff = dynamicAmplifyFactor * std::max(articulationsApplied.averageDynamicRange(), DYNAMIC_LEVEL_STEP);
|
||||
dynamic_level_t amplificationDiff = mult(std::max(articulationsApplied.averageDynamicRange(), DYNAMIC_LEVEL_STEP),
|
||||
dynamicAmplifyFactor);
|
||||
|
||||
dynamic_level_t actualDynamicLevel = nominalDynamicLevel + amplificationDiff;
|
||||
|
||||
if (actualDynamicLevel == articulationDynamicLevel) {
|
||||
return;
|
||||
}
|
||||
|
||||
float ratio = actualDynamicLevel / static_cast<float>(articulationDynamicLevel);
|
||||
float ratio = static_cast<float>(actualDynamicLevel) / static_cast<float>(articulationDynamicLevel);
|
||||
|
||||
for (auto& pair : m_expressionCtx.expressionCurve) {
|
||||
pair.second = RealRound(pair.second * ratio, 0);
|
||||
pair.second = RealRound(static_cast<float>(pair.second) * ratio, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,12 +53,12 @@ constexpr percentage_t TEN_PERCENT = ONE_PERCENT * 10;
|
|||
|
||||
constexpr inline float percentageToFactor(const percentage_t percents)
|
||||
{
|
||||
return percents / static_cast<float>(HUNDRED_PERCENT);
|
||||
return static_cast<float>(percents) / static_cast<float>(HUNDRED_PERCENT);
|
||||
}
|
||||
|
||||
constexpr inline percentage_t percentageFromFactor(const float factor)
|
||||
{
|
||||
return factor * HUNDRED_PERCENT;
|
||||
return static_cast<percentage_t>(factor * HUNDRED_PERCENT);
|
||||
}
|
||||
|
||||
// Arrangement
|
||||
|
@ -70,7 +70,7 @@ using voice_layer_idx_t = uint_fast8_t;
|
|||
constexpr inline duration_percentage_t occupiedPercentage(const timestamp_t timestamp,
|
||||
const duration_t overallDuration)
|
||||
{
|
||||
return percentageFromFactor(timestamp / static_cast<float>(overallDuration));
|
||||
return percentageFromFactor(static_cast<float>(timestamp) / static_cast<float>(overallDuration));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -148,7 +148,7 @@ constexpr inline pitch_level_t pitchLevelDiff(const PitchClass fClass, const oct
|
|||
|
||||
constexpr inline int pitchStepsCount(const pitch_level_t pitchRange)
|
||||
{
|
||||
return (pitchRange / PITCH_LEVEL_STEP) + 1;
|
||||
return static_cast<int>(pitchRange / PITCH_LEVEL_STEP) + 1;
|
||||
}
|
||||
|
||||
// Expression
|
||||
|
|
|
@ -251,6 +251,7 @@ if (NOT MSVC)
|
|||
set_target_properties(gcrashpad PROPERTIES COMPILE_FLAGS "-fPIC")
|
||||
endif (NOT MSVC)
|
||||
|
||||
target_no_warning(gcrashpad -Wno-conversion)
|
||||
target_no_warning(gcrashpad -Wno-multichar)
|
||||
target_no_warning(gcrashpad -Wno-unused-parameter)
|
||||
target_no_warning(gcrashpad -Wno-deprecated)
|
||||
|
|
|
@ -212,3 +212,6 @@ if (gmock_build_tests)
|
|||
cxx_executable(gmock_output_test_ test gmock)
|
||||
py_test(gmock_output_test)
|
||||
endif()
|
||||
|
||||
|
||||
target_no_warning(gmock -Wno-conversion)
|
||||
|
|
|
@ -316,3 +316,5 @@ if (gtest_build_tests)
|
|||
py_test(gtest_xml_output_unittest --no_stacktrace_support)
|
||||
py_test(googletest-json-output-unittest --no_stacktrace_support)
|
||||
endif()
|
||||
|
||||
target_no_warning(gtest -Wno-conversion)
|
||||
|
|
|
@ -409,8 +409,9 @@ if(BUILD_TESTING)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
target_no_warning(opus -Wno-conversion)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(opus PUBLIC /wd4244)
|
||||
target_compile_options(opus PUBLIC /wd4310)
|
||||
target_compile_options(opus PUBLIC /wd4701)
|
||||
endif()
|
||||
|
|
|
@ -44,3 +44,4 @@ set(MODULE_NOT_LINK_GLOBAL ON)
|
|||
include(SetupModule)
|
||||
|
||||
target_no_warning(${MODULE} -Wimplicit-fallthrough=0)
|
||||
target_no_warning(${MODULE} -Wno-conversion)
|
||||
|
|
Loading…
Reference in New Issue