Rework the sampler state machine, with new, better, simpler bytecode at twice

the bandwidth; we now record the state of the index hole.
This commit is contained in:
David Given
2019-03-06 21:09:07 +01:00
parent f3640aa153
commit 379985c2bc
6 changed files with 19 additions and 15 deletions

View File

@@ -9,9 +9,11 @@ uint32_t Fluxmap::getAndIncrement(size_t& index) const
while (index < _bytes.size())
{
uint8_t b = _bytes[index++];
ticks += b;
if (!(b & 0x80))
if (b < 0x80)
ticks += b;
if (b == 0x80)
break;
/* everything above 0x80 is ignored for now */
}
return ticks;
@@ -30,7 +32,8 @@ Fluxmap& Fluxmap::appendBytes(const uint8_t* ptr, size_t len)
while (len--)
{
uint8_t byte = *ptr++;
_ticks += byte;
if (byte < 0x80)
_ticks += byte;
bw.write_8(byte);
}
@@ -40,12 +43,13 @@ Fluxmap& Fluxmap::appendBytes(const uint8_t* ptr, size_t len)
Fluxmap& Fluxmap::appendInterval(uint32_t ticks)
{
while (ticks >= 0x80)
while (ticks >= 0x7f)
{
appendByte(0x80);
ticks -= 0x80;
appendByte(0x7f);
ticks -= 0x7f;
}
appendByte((uint8_t)ticks);
appendByte(0x80);
return *this;
}