comparison base/Pitch.h @ 1429:48e9f538e6e9

Untabify
author Chris Cannam
date Thu, 01 Mar 2018 18:02:22 +0000
parents 88b54a185a0a
children ad5f892c0c4d
comparison
equal deleted inserted replaced
1428:87ae75da6527 1429:48e9f538e6e9
29 * If concertA is non-zero, use that as the reference frequency 29 * If concertA is non-zero, use that as the reference frequency
30 * for the A at MIDI pitch 69; otherwise use the tuning frequency 30 * for the A at MIDI pitch 69; otherwise use the tuning frequency
31 * specified in the application preferences (default 440Hz). 31 * specified in the application preferences (default 440Hz).
32 */ 32 */
33 static double getFrequencyForPitch(int midiPitch, 33 static double getFrequencyForPitch(int midiPitch,
34 double centsOffset = 0, 34 double centsOffset = 0,
35 double concertA = 0.0); 35 double concertA = 0.0);
36 36
37 /** 37 /**
38 * Return the nearest MIDI pitch to the given frequency. 38 * Return the nearest MIDI pitch to the given frequency.
39 * 39 *
40 * If centsOffsetReturn is non-NULL, return in *centsOffsetReturn 40 * If centsOffsetReturn is non-NULL, return in *centsOffsetReturn
45 * If concertA is non-zero, use that as the reference frequency 45 * If concertA is non-zero, use that as the reference frequency
46 * for the A at MIDI pitch 69; otherwise use the tuning frequency 46 * for the A at MIDI pitch 69; otherwise use the tuning frequency
47 * specified in the application preferences (default 440Hz). 47 * specified in the application preferences (default 440Hz).
48 */ 48 */
49 static int getPitchForFrequency(double frequency, 49 static int getPitchForFrequency(double frequency,
50 double *centsOffsetReturn = 0, 50 double *centsOffsetReturn = 0,
51 double concertA = 0.0); 51 double concertA = 0.0);
52 52
53 /** 53 /**
54 * Compatibility version of getPitchForFrequency accepting float 54 * Compatibility version of getPitchForFrequency accepting float
55 * pointer argument. 55 * pointer argument.
56 */ 56 */
57 static int getPitchForFrequency(double frequency, 57 static int getPitchForFrequency(double frequency,
58 float *centsOffsetReturn, 58 float *centsOffsetReturn,
59 double concertA = 0.0) { 59 double concertA = 0.0) {
60 double c; 60 double c;
61 int p = getPitchForFrequency(frequency, &c, concertA); 61 int p = getPitchForFrequency(frequency, &c, concertA);
62 if (centsOffsetReturn) *centsOffsetReturn = float(c); 62 if (centsOffsetReturn) *centsOffsetReturn = float(c);
63 return p; 63 return p;
64 } 64 }
125 * 125 *
126 * If useFlats is true, spell notes with flats instead of sharps, 126 * If useFlats is true, spell notes with flats instead of sharps,
127 * e.g. Bb3 instead of A#3. 127 * e.g. Bb3 instead of A#3.
128 */ 128 */
129 static QString getPitchLabel(int midiPitch, 129 static QString getPitchLabel(int midiPitch,
130 double centsOffset = 0, 130 double centsOffset = 0,
131 bool useFlats = false); 131 bool useFlats = false);
132 132
133 /** 133 /**
134 * Return a string describing the nearest MIDI pitch to the given 134 * Return a string describing the nearest MIDI pitch to the given
135 * frequency, with cents offset. 135 * frequency, with cents offset.
136 * 136 *
140 * 140 *
141 * If useFlats is true, spell notes with flats instead of sharps, 141 * If useFlats is true, spell notes with flats instead of sharps,
142 * e.g. Bb3 instead of A#3. 142 * e.g. Bb3 instead of A#3.
143 */ 143 */
144 static QString getPitchLabelForFrequency(double frequency, 144 static QString getPitchLabelForFrequency(double frequency,
145 double concertA = 0.0, 145 double concertA = 0.0,
146 bool useFlats = false); 146 bool useFlats = false);
147 147
148 /** 148 /**
149 * Return a string describing the given pitch range in octaves, 149 * Return a string describing the given pitch range in octaves,
150 * semitones and cents. This is in the form e.g. "1'2+4c". 150 * semitones and cents. This is in the form e.g. "1'2+4c".
151 */ 151 */