MuseScore  3.4
Music composition and notation
utils.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2002-2011 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __UTILS_H__
14 #define __UTILS_H__
15 
16 #include "mscore.h"
17 #include "interval.h"
18 
19 namespace Ms {
20 
21 enum class Key;
22 enum class SymId;
23 
24 //---------------------------------------------------------
25 // cycles
26 //---------------------------------------------------------
27 
28 /*static inline unsigned long long cycles()
29  {
30  unsigned long long rv;
31  __asm__ __volatile__("rdtsc" : "=A" (rv));
32  return rv;
33  }*/
34 
35 
36 class Measure;
37 class Segment;
38 class System;
39 class Element;
40 class Note;
41 class Tuplet;
42 class BarLine;
43 class Fraction;
44 
45 enum class ClefType : signed char;
46 
47 extern QRectF handleRect(const QPointF& pos);
48 
49 extern int getStaff(System* system, const QPointF& p);
50 extern int pitchKeyAdjust(int note, Key);
51 extern int line2pitch(int line, ClefType clef, Key);
52 extern int y2pitch(qreal y, ClefType clef, qreal spatium);
53 extern int quantizeLen(int, int);
54 extern QString pitch2string(int v);
55 extern void transposeInterval(int pitch, int tpc, int* rpitch, int* rtpc,
56  Interval, bool useDoubleSharpsFlats);
57 extern int transposeTpc(int tpc, Interval interval, bool useDoubleSharpsFlats);
58 
59 constexpr int intervalListSize = 26;
61 extern int searchInterval(int steps, int semitones);
62 extern int chromatic2diatonic(int val);
63 
64 int diatonicUpDown(Key, int pitch, int steps);
65 
66 extern int version();
67 extern int majorVersion();
68 extern int minorVersion();
69 extern int updateVersion();
70 extern bool compareVersion(QString v1, QString v2);
71 
72 extern Note* nextChordNote(Note* note);
73 extern Note* prevChordNote(Note* note);
74 extern Segment* nextSeg1(Segment* s, int& track);
75 extern Segment* prevSeg1(Segment* seg, int& track);
76 
77 extern Note* searchTieNote(Note* note);
78 extern Note* searchTieNote114(Note* note);
79 
80 extern int absStep(int pitch);
81 extern int absStep(int tpc, int pitch);
82 
83 extern int absStep(int line, ClefType clef);
84 extern int relStep(int line, ClefType clef);
85 extern int relStep(int pitch, int tpc, ClefType clef);
86 extern int pitch2step(int pitch);
87 extern int step2pitch(int step);
88 
89 extern Segment* skipTuplet(Tuplet* tuplet);
90 extern std::vector<SymId> toTimeSigString(const QString&);
91 extern Fraction actualTicks(Fraction duration, Tuplet* tuplet, Fraction timeStretch);
92 
93 } // namespace Ms
94 #endif
95 
Segment * prevSeg1(Segment *seg, int &track)
Definition: utils.cpp:296
int diatonicUpDown(Key k, int pitch, int steps)
Definition: utils.cpp:686
int step2pitch(int step)
Definition: utils.cpp:971
Key
Definition: key.h:28
int pitch2step(int pitch)
Definition: utils.cpp:959
Note * searchTieNote114(Note *note)
Definition: utils.cpp:876
int y2pitch(qreal y, ClefType clef, qreal _spatium)
Definition: utils.cpp:404
Segment * skipTuplet(Tuplet *tuplet)
Definition: utils.cpp:983
QRectF handleRect(const QPointF &pos)
Definition: utils.cpp:38
Segment * nextSeg1(Segment *seg, int &track)
Definition: utils.cpp:276
SymId
Definition: sym.h:30
int absStep(int tpc, int pitch)
Compute absolute step.
Definition: utils.cpp:913
int minorVersion()
Definition: utils.cpp:636
Note * prevChordNote(Note *note)
Definition: utils.cpp:344
int transposeTpc(int tpc, Interval interval, bool useDoubleSharpsFlats)
Definition: transpose.cpp:117
int chromatic2diatonic(int semitones)
Definition: utils.cpp:555
int pitchKeyAdjust(int step, Key key)
Definition: utils.cpp:377
int relStep(int line, ClefType clef)
Compute relative step from absolute step which depends on actual clef.
Definition: utils.cpp:944
Fraction actualTicks(Fraction duration, Tuplet *tuplet, Fraction timeStretch)
Definition: utils.cpp:1049
bool compareVersion(QString v1, QString v2)
Up to 4 digits X.X.X.X Each digit can be double XX.XX.XX.XX return true if v1 < v2.
Definition: utils.cpp:659
constexpr int intervalListSize
Definition: utils.h:59
int line2pitch(int line, ClefType clef, Key key)
Definition: utils.cpp:415
int getStaff(System *system, const QPointF &p)
Definition: utils.cpp:243
void transposeInterval(int pitch, int tpc, int *rpitch, int *rtpc, Interval interval, bool useDoubleSharpsFlats)
Definition: transpose.cpp:90
Definition: interval.h:22
Definition: segment.h:50
Definition: aeolus.cpp:26
int searchInterval(int steps, int semitones)
Definition: utils.cpp:587
int updateVersion()
Definition: utils.cpp:646
Note * searchTieNote(Note *note)
Definition: utils.cpp:772
Graphic representation of a note.
Definition: note.h:212
ClefType
Definition: clef.h:37
Note * nextChordNote(Note *note)
Definition: utils.cpp:321
Definition: fraction.h:46
int majorVersion()
Definition: utils.cpp:626
QString pitch2string(int v)
Definition: utils.cpp:487
Interval intervalList[intervalListSize]
Definition: utils.cpp:505
int quantizeLen(int len, int raster)
Definition: utils.cpp:439
std::vector< SymId > toTimeSigString(const QString &s)
Definition: utils.cpp:998