Update tunings to d9660ef

This commit is contained in:
Jean Pierre Cimalando 2021-04-06 14:08:52 +02:00
parent 30234fa8cf
commit 939b93107b
3 changed files with 37 additions and 6 deletions

View file

@ -1,2 +1,2 @@
Based on the Surge tuning library, revision a5f2879, with small modifications
Based on the Surge tuning library, revision d9660ef, with small modifications
https://github.com/surge-synthesizer/tuning-library

View file

@ -96,7 +96,7 @@ namespace Tunings
int middleNote = 60;
int tuningConstantNote = 60;
double tuningFrequency = MIDI_0_FREQ * 32.0, tuningPitch = 32.0; // pitch = frequency / MIDI_0_FREQ
int octaveDegrees = 12;
int octaveDegrees = 0;
int keys[MAX_CAPACITY]; // rather than an 'x' we use a '-1' for skipped keys
};

View file

@ -414,6 +414,26 @@ namespace Tunings
int mappingKey = distanceFromScale0 % k.count;
if( mappingKey < 0 )
mappingKey += k.count;
// Now have we gone off the end
int rotations = 0;
int dt = distanceFromScale0;
if( dt > 0 )
{
while( dt >= k.count )
{
dt -= k.count;
rotations ++;
}
}
else
{
while( dt < 0 )
{
dt += k.count;
rotations --;
}
}
int cm = k.keys[mappingKey];
int push = 0;
if( cm < 0 )
@ -424,11 +444,22 @@ namespace Tunings
{
push = mappingKey - cm;
}
rounds = (distanceFromScale0 - push - 1) / s.count;
thisRound = (distanceFromScale0 - push - 1) % s.count;
if( k.octaveDegrees > 0 && k.octaveDegrees != k.count )
{
rounds = rotations;
thisRound = cm-1;
if( thisRound < 0 ) { thisRound = k.octaveDegrees - 1; rounds--; }
}
else
{
rounds = (distanceFromScale0 - push - 1) / s.count;
thisRound = (distanceFromScale0 - push - 1) % s.count;
}
#ifdef DEBUG_SCALES
if( i > 296 && i < 340 )
std::cout << "MAPPING n=" << i - 256 << " pushes ds0=" << distanceFromScale0 << " cmc=" << k.count << " tr=" << thisRound << " r=" << rounds << " mk=" << mappingKey << " cm=" << cm << " push=" << push << " dis=" << disable << " mk-p-1=" << mappingKey - push - 1 << std::endl;
if( i > 256+53 && i < 265+85 )
std::cout << "MAPPING n=" << i - 256 << " pushes ds0=" << distanceFromScale0 << " cmc=" << k.count << " tr=" << thisRound << " r=" << rounds << " mk=" << mappingKey << " cm=" << cm << " push=" << push << " dis=" << disable << " mk-p-1=" << mappingKey - push - 1 << " rotations=" << rotations << " od=" << k.octaveDegrees << std::endl;
#endif