Fixed arpeggio
This commit is contained in:
parent
19af37059f
commit
80fe43cdd7
1 changed files with 12 additions and 24 deletions
|
@ -354,7 +354,7 @@ static const short rawAmigaPeriods[606] =
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
};
|
};
|
||||||
|
|
||||||
static short extendedRawPeriods[16 * 85 + 13];
|
static short extendedRawPeriods[16 * 85 + 14];
|
||||||
|
|
||||||
static const short npertab[84] =
|
static const short npertab[84] =
|
||||||
{
|
{
|
||||||
|
@ -2071,15 +2071,16 @@ static void processTremolo(player *p, mod_channel *ch)
|
||||||
|
|
||||||
static void fxArpeggio(player *p, mod_channel *ch)
|
static void fxArpeggio(player *p, mod_channel *ch)
|
||||||
{
|
{
|
||||||
char noteToAdd;
|
|
||||||
char l;
|
char l;
|
||||||
char m;
|
char m;
|
||||||
char h;
|
char h;
|
||||||
|
char noteToAdd;
|
||||||
char arpeggioTick;
|
char arpeggioTick;
|
||||||
|
unsigned char i;
|
||||||
short *tablePointer;
|
short *tablePointer;
|
||||||
|
|
||||||
noteToAdd = 0;
|
noteToAdd = 0;
|
||||||
|
|
||||||
arpeggioTick = p->modTick % 3;
|
arpeggioTick = p->modTick % 3;
|
||||||
if (arpeggioTick == 0)
|
if (arpeggioTick == 0)
|
||||||
{
|
{
|
||||||
|
@ -2094,42 +2095,29 @@ static void fxArpeggio(player *p, mod_channel *ch)
|
||||||
{
|
{
|
||||||
noteToAdd = LO_NYBBLE(ch->param);
|
noteToAdd = LO_NYBBLE(ch->param);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->minPeriod == PT_MIN_PERIOD) // PT/NT/UST/STK
|
if (p->minPeriod == PT_MIN_PERIOD) // PT/NT/UST/STK
|
||||||
{
|
{
|
||||||
l = 0;
|
|
||||||
h = 35;
|
|
||||||
|
|
||||||
tablePointer = (short *)&rawAmigaPeriods[ch->fineTune * 37];
|
tablePointer = (short *)&rawAmigaPeriods[ch->fineTune * 37];
|
||||||
while (h >= l)
|
for (i = 0; i < 36; ++i)
|
||||||
{
|
{
|
||||||
m = (h + l) / 2;
|
if (ch->period >= tablePointer[i])
|
||||||
|
|
||||||
if (tablePointer[m] == ch->period)
|
|
||||||
{
|
{
|
||||||
p->tempPeriod = tablePointer[m + noteToAdd];
|
p->tempPeriod = tablePointer[i + noteToAdd];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (tablePointer[m] > ch->period)
|
|
||||||
{
|
|
||||||
l = m + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
h = m - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
l = 0;
|
l = 0;
|
||||||
h = 83;
|
h = 83;
|
||||||
|
|
||||||
tablePointer = (short *)&extendedRawPeriods[ch->fineTune * 85];
|
tablePointer = (short *)&extendedRawPeriods[ch->fineTune * 85];
|
||||||
while (h >= l)
|
while (h >= l)
|
||||||
{
|
{
|
||||||
m = (h + l) / 2;
|
m = (h + l) / 2;
|
||||||
|
|
||||||
if (tablePointer[m] == ch->period)
|
if (tablePointer[m] == ch->period)
|
||||||
{
|
{
|
||||||
p->tempPeriod = tablePointer[m + noteToAdd];
|
p->tempPeriod = tablePointer[m + noteToAdd];
|
||||||
|
@ -2763,7 +2751,7 @@ void *playptmod_Create(int samplingFrequency)
|
||||||
for (i = 0; i < 85; ++i)
|
for (i = 0; i < 85; ++i)
|
||||||
extendedRawPeriods[(j * 85) + i] = i == 84 ? 0 : npertab[i] * 8363 / finetune[j];
|
extendedRawPeriods[(j * 85) + i] = i == 84 ? 0 : npertab[i] * 8363 / finetune[j];
|
||||||
|
|
||||||
for (i = 0; i < 13; ++i)
|
for (i = 0; i < 14; ++i)
|
||||||
extendedRawPeriods[16 * 85 + i] = 0;
|
extendedRawPeriods[16 * 85 + i] = 0;
|
||||||
|
|
||||||
p->soundFrequency = samplingFrequency;
|
p->soundFrequency = samplingFrequency;
|
||||||
|
|
Loading…
Reference in a new issue