Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bostick committed Oct 30, 2024
1 parent 6236064 commit 4488fb6
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion lib/bar-lines.inl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ parseBarLinesMap(
//
// stored as 32-bit int, so must be cast
//
out.body.barLinesSpaceCount += static_cast<uint16_t>(parseLE4(part[0], part[1], part[2], part[3]));
out.body.barLinesSpaceCount += parseLE4(part[0], part[1], part[2], part[3]);

out.body.barLinesMap[space] = { part[4], part[5] };
}
Expand Down
2 changes: 1 addition & 1 deletion lib/expanddeltalist.inl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ expandDeltaList(

newUnit = unit + n;

dv = std::div(static_cast<int>(newUnit), S);
dv = std::div(newUnit, S);

newSpace = static_cast<uint16_t>(dv.quot);
newSlot = static_cast<uint16_t>(dv.rem);
Expand Down
6 changes: 3 additions & 3 deletions lib/midi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ computeTempoMap(
switch (trackEffect) {
case 'T': {

auto newTempo = static_cast<uint16_t>(vsqs[STRINGS_PER_TRACK + STRINGS_PER_TRACK + 3]);
auto newTempo = (vsqs[STRINGS_PER_TRACK + STRINGS_PER_TRACK + 3]);

insertTempoMap_atActualSpace(newTempo, actualSpace, tempoMap);

Expand Down Expand Up @@ -460,7 +460,7 @@ computeRepeats(
//
auto barLine = barLinesMapIt->second;

auto change = static_cast<tbt_bar_line>(barLine[0] & 0b00001111);
auto change = (barLine[0] & 0b00001111);

switch (change) {
case CLOSE: {
Expand Down Expand Up @@ -1841,7 +1841,7 @@ TconvertToMidi(
//
// convert from (-2400, 2400) to (0b0000000000000000 to 0b0011111111111111) i.e. (0 to 16383)
//
auto newPitchBend = (((rational(static_cast<int16_t>(value)) + 2400) * 0b0011111111111111) / (2 * 2400)).round().to_int16();
auto newPitchBend = (((rational((value)) + 2400) * 0b0011111111111111) / (2 * 2400)).round().to_int16();

diff = (roundedTick - lastEventTick);

Expand Down
60 changes: 30 additions & 30 deletions lib/tablature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,12 @@ TtbtFileTablature(const tbt_file_t &t) {

auto barLine = barLinesMapIt->second;

auto change = static_cast<tbt_bar_line>(barLine[0] & 0b00001111);
auto change = (barLine[0] & 0b00001111);

switch (change) {
case CLOSE: {

auto repeats = static_cast<uint8_t>((barLine[0] & 0b11110000) >> 4);
auto repeats = ((barLine[0] & 0b11110000) >> 4);

auto w = width(repeats);

Expand Down Expand Up @@ -388,12 +388,12 @@ TtbtFileTablature(const tbt_file_t &t) {

auto barLine = barLinesMapIt->second;

auto change = static_cast<tbt_bar_line>(barLine[0] & 0b00001111);
auto change = (barLine[0] & 0b00001111);

switch (change) {
case CLOSE: {

auto repeats = static_cast<uint8_t>((barLine[0] & 0b11110000) >> 4);
auto repeats = ((barLine[0] & 0b11110000) >> 4);

auto w = width(repeats);

Expand Down Expand Up @@ -838,7 +838,7 @@ TtbtFileTablature(const tbt_file_t &t) {
bottomLineText.append(tuningWidth, ' ');
}

debugText += static_cast<char>(tuningWidth + '0');
debugText += (tuningWidth + '0');
debugText.append(tuningWidth - 1, ' ');
}

Expand Down Expand Up @@ -894,7 +894,7 @@ TtbtFileTablature(const tbt_file_t &t) {
bottomLineText += ' ';
}

debugText += static_cast<char>(1 + '0');
debugText += (1 + '0');
}

//
Expand Down Expand Up @@ -1039,7 +1039,7 @@ TtbtFileTablature(const tbt_file_t &t) {
{
repeatsCount += repeatsStr;

repeatsCountWidthAcc += static_cast<uint8_t>(repeatsStr.size());
repeatsCountWidthAcc += (repeatsStr.size());
}

//
Expand Down Expand Up @@ -1100,7 +1100,7 @@ TtbtFileTablature(const tbt_file_t &t) {
}
}

debugText += static_cast<char>(1 + '0');
debugText += (1 + '0');

debugTextWidthAcc += 1;
}
Expand Down Expand Up @@ -1189,7 +1189,7 @@ TtbtFileTablature(const tbt_file_t &t) {

notesAndBarLines[string] += effectBeforeStr;

notesAndBarLinesWidthAcc[string] += static_cast<uint8_t>(effectBeforeStr.size());
notesAndBarLinesWidthAcc[string] += (effectBeforeStr.size());
}

//
Expand All @@ -1212,7 +1212,7 @@ TtbtFileTablature(const tbt_file_t &t) {

notesAndBarLines[string] += noteStr;

notesAndBarLinesWidthAcc[string] += static_cast<uint8_t>(noteStr.size());
notesAndBarLinesWidthAcc[string] += (noteStr.size());

} else if (on == MUTED) {

Expand All @@ -1239,7 +1239,7 @@ TtbtFileTablature(const tbt_file_t &t) {

notesAndBarLines[string] += effectAfterStr;

notesAndBarLinesWidthAcc[string] += static_cast<uint8_t>(effectAfterStr.size());
notesAndBarLinesWidthAcc[string] += (effectAfterStr.size());
}
}
}
Expand All @@ -1261,7 +1261,7 @@ TtbtFileTablature(const tbt_file_t &t) {

trackEffectChanges += trackEffectChangesStr;

trackEffectChangesWidthAcc += static_cast<uint8_t>(trackEffectChangesStr.size());
trackEffectChangesWidthAcc += (trackEffectChangesStr.size());
}

} else {
Expand All @@ -1276,7 +1276,7 @@ TtbtFileTablature(const tbt_file_t &t) {

trackEffectChanges += trackEffectChangesStr;

trackEffectChangesWidthAcc += static_cast<uint8_t>(trackEffectChangesStr.size());
trackEffectChangesWidthAcc += (trackEffectChangesStr.size());
}
}
}
Expand All @@ -1303,7 +1303,7 @@ TtbtFileTablature(const tbt_file_t &t) {
}
}

debugText += static_cast<char>(spaceWidth + '0');
debugText += (spaceWidth + '0');

debugTextWidthAcc += 1;

Expand Down Expand Up @@ -1369,7 +1369,7 @@ TtbtFileTablature(const tbt_file_t &t) {

auto barLine = barLinesMapIt->second;

auto change = static_cast<tbt_bar_line>(barLine[0] & 0b00001111);
auto change = (barLine[0] & 0b00001111);

switch (change) {
case CLOSE: {
Expand All @@ -1384,14 +1384,14 @@ TtbtFileTablature(const tbt_file_t &t) {
// repeats count for bar line
//

auto repeats = static_cast<uint8_t>((barLine[0] & 0b11110000) >> 4);
auto repeats = ((barLine[0] & 0b11110000) >> 4);

auto repeatsStr = std::to_string(repeats);

{
repeatsCount += repeatsStr;

repeatsCountWidthAcc += static_cast<uint8_t>(repeatsStr.size());
repeatsCountWidthAcc += (repeatsStr.size());
}

//
Expand Down Expand Up @@ -1437,7 +1437,7 @@ TtbtFileTablature(const tbt_file_t &t) {

auto barLineNext = barLinesMapItNext->second;

auto changeNext = static_cast<tbt_bar_line>(barLineNext[0] & 0b00001111);
auto changeNext = (barLineNext[0] & 0b00001111);

if (changeNext == OPEN) {

Expand Down Expand Up @@ -1475,7 +1475,7 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

debugText += static_cast<char>(1 + '0');
debugText += (1 + '0');

debugTextWidthAcc += 1;

Expand Down Expand Up @@ -1517,7 +1517,7 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

debugText += static_cast<char>(1 + '0');
debugText += (1 + '0');

debugTextWidthAcc += 1;

Expand All @@ -1535,7 +1535,7 @@ TtbtFileTablature(const tbt_file_t &t) {

auto barLineNext = barLinesMapItNext->second;

auto changeNext = static_cast<tbt_bar_line>(barLineNext[0] & 0b00001111);
auto changeNext = (barLineNext[0] & 0b00001111);

if (changeNext == OPEN) {

Expand Down Expand Up @@ -1573,7 +1573,7 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

debugText += static_cast<char>(1 + '0');
debugText += (1 + '0');

debugTextWidthAcc += 1;

Expand Down Expand Up @@ -1615,7 +1615,7 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

debugText += static_cast<char>(1 + '0');
debugText += (1 + '0');

debugTextWidthAcc += 1;

Expand Down Expand Up @@ -1682,7 +1682,7 @@ TtbtFileTablature(const tbt_file_t &t) {
{
repeatsCount += repeatsStr;

repeatsCountWidthAcc += static_cast<uint8_t>(repeatsStr.size());
repeatsCountWidthAcc += (repeatsStr.size());
}

//
Expand Down Expand Up @@ -1743,7 +1743,7 @@ TtbtFileTablature(const tbt_file_t &t) {
}
}

debugText += static_cast<char>(1 + '0');
debugText += (1 + '0');

debugTextWidthAcc += 1;
}
Expand Down Expand Up @@ -1774,7 +1774,7 @@ TtbtFileTablature(const tbt_file_t &t) {

auto barLine = barLinesMapIt->second;

auto change = static_cast<tbt_bar_line>(barLine[0] & 0b00001111);
auto change = (barLine[0] & 0b00001111);

switch (change) {
case CLOSE: {
Expand All @@ -1788,14 +1788,14 @@ TtbtFileTablature(const tbt_file_t &t) {
// repeats count for bar line
//

auto repeats = static_cast<uint8_t>((barLine[0] & 0b11110000) >> 4);
auto repeats = ((barLine[0] & 0b11110000) >> 4);

auto repeatsStr = std::to_string(repeats);

{
repeatsCount += repeatsStr;

repeatsCountWidthAcc += static_cast<uint8_t>(repeatsStr.size());
repeatsCountWidthAcc += (repeatsStr.size());
}

//
Expand Down Expand Up @@ -1870,7 +1870,7 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

debugText += static_cast<char>(1 + '0');
debugText += (1 + '0');

debugTextWidthAcc += 1;

Expand Down Expand Up @@ -1912,7 +1912,7 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

debugText += static_cast<char>(1 + '0');
debugText += (1 + '0');

debugTextWidthAcc += 1;

Expand Down
2 changes: 1 addition & 1 deletion lib/tbt-parser-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ void toDigitsBEOnly3(uint32_t value, std::vector<uint8_t> &out) {

std::string fromPascal1String(const char *data) {

auto len = static_cast<uint8_t>(data[0]);
auto len = (data[0]);

return { data + 1, data + 1 + len };
}
Expand Down
4 changes: 2 additions & 2 deletions lib/tbt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ TparseTbtBytes(

CHECK(out.header.compressedMetadataLen < MAX_SIGNED_INT32, "out.header.compressedMetadataLen is too large");

CHECK(static_cast<int32_t>(out.header.compressedMetadataLen) < size, "unhandled");
CHECK((out.header.compressedMetadataLen) < size, "unhandled");

CHECK(out.header.totalByteCount < MAX_SIGNED_INT32, "out.header.totalByteCount is too large");

CHECK(static_cast<int32_t>(out.header.totalByteCount) == size, "file is corrupted. file byte counts do not match. expected: %" PRIu32 ", actual: %zu", out.header.totalByteCount, size);
CHECK((out.header.totalByteCount) == size, "file is corrupted. file byte counts do not match. expected: %" PRIu32 ", actual: %zu", out.header.totalByteCount, size);

auto restToCheck_it = it + TBT_HEADER_SIZE;

Expand Down

0 comments on commit 4488fb6

Please sign in to comment.