Equal temperament scale without parsing

This commit is contained in:
Jean Pierre Cimalando 2020-05-21 14:33:01 +02:00
parent 4049f3f323
commit ca547f7de9
2 changed files with 10 additions and 21 deletions

View file

@ -57,7 +57,6 @@ namespace Tunings
Type type = kToneRatio; Type type = kToneRatio;
double cents = 0; double cents = 0;
int ratio_d = 1, ratio_n = 1; int ratio_d = 1, ratio_n = 1;
std::string stringRep = "1/1";
double floatValue = 1.0; // cents / 1200 + 1. double floatValue = 1.0; // cents / 1200 + 1.
}; };

View file

@ -33,7 +33,6 @@ namespace Tunings
Tone toneFromString(const std::string &line, int lineno) Tone toneFromString(const std::string &line, int lineno)
{ {
Tone t; Tone t;
t.stringRep = line;
if (line.find(".") != std::string::npos) if (line.find(".") != std::string::npos)
{ {
t.type = Tone::kToneCents; t.type = Tone::kToneCents;
@ -145,25 +144,16 @@ namespace Tunings
Scale evenTemperament12NoteScale() Scale evenTemperament12NoteScale()
{ {
std::string data = R"SCL(! even.scl Scale res;
! res.count = 12;
12 note even temperament res.tones.resize(12);
12 for (int i = 0; i < 12; ++i) {
! Tone &t = res.tones[i];
100.0 t.type = Tone::kToneCents;
200.0 t.cents = 100 * (i + 1);
300.0 t.floatValue = t.cents / 1200.0 + 1.0;
400.0 }
500.0 return res;
600.0
700.0
800.0
900.0
1000.0
1100.0
2/1
)SCL";
return parseSCLData(data);
} }
Scale evenDivisionOfSpanByM( int Span, int M ) Scale evenDivisionOfSpanByM( int Span, int M )