mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Update cwftoflux to handle index information from CWF files.
This commit is contained in:
@@ -53,6 +53,12 @@ Fluxmap& Fluxmap::appendInterval(uint32_t ticks)
|
||||
return *this;
|
||||
}
|
||||
|
||||
Fluxmap& Fluxmap::appendIndex()
|
||||
{
|
||||
appendByte(0x81);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Fluxmap::precompensate(int threshold_ticks, int amount_ticks)
|
||||
{
|
||||
uint8_t junk = 0xff;
|
||||
|
||||
@@ -20,6 +20,7 @@ public:
|
||||
}
|
||||
|
||||
Fluxmap& appendInterval(uint32_t ticks);
|
||||
Fluxmap& appendIndex();
|
||||
|
||||
Fluxmap& appendBytes(const Bytes& bytes);
|
||||
Fluxmap& appendBytes(const uint8_t* ptr, size_t len);
|
||||
|
||||
@@ -88,9 +88,12 @@ static void read_track()
|
||||
|
||||
Fluxmap fluxmap;
|
||||
uint32_t pending = 0;
|
||||
bool oldindex = true;
|
||||
for (unsigned cursor = 0; cursor < length; cursor++)
|
||||
{
|
||||
uint32_t b = inputdata[cursor] & 0x7f;
|
||||
uint32_t b = inputdata[cursor];
|
||||
bool index = !!(b & 0x80);
|
||||
b &= 0x7f;
|
||||
if (b == 0x7f)
|
||||
{
|
||||
pending += 0x7f;
|
||||
@@ -101,6 +104,10 @@ static void read_track()
|
||||
|
||||
double interval_us = b * (1e6/clockRate);
|
||||
fluxmap.appendInterval(interval_us / US_PER_TICK);
|
||||
|
||||
if (index && !oldindex)
|
||||
fluxmap.appendIndex();
|
||||
oldindex = index;
|
||||
}
|
||||
|
||||
std::cout << fmt::format(" {} ms in {} output bytes\n",
|
||||
|
||||
Reference in New Issue
Block a user