Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bostick committed Oct 29, 2024
1 parent 5fe8a40 commit 45780ae
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 64 deletions.
2 changes: 0 additions & 2 deletions lib/alternate-time-regions.inl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ parseAlternateTimeRegionsMapList(
return ret;
}

#ifndef NDEBUG
rational alternateTimeRegionsCorrection = 0;
for (uint16_t space = 0; space < trackSpaceCount; space++) {

Expand All @@ -97,7 +96,6 @@ parseAlternateTimeRegionsMapList(
}

ASSERT(rational(out.metadata.tracks[track].spaceCount) == rational(out.body.barLinesSpaceCount) + alternateTimeRegionsCorrection);
#endif // NDEBUG
}

return OK;
Expand Down
4 changes: 0 additions & 4 deletions lib/expanddeltalist.inl
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,7 @@ expandDeltaList(
slot = newSlot;
}

#ifndef NDEBUG
ASSERT(static_cast<uint32_t>(unit) == unitCount);
#else
(void)unitCount;
#endif // NDEBUG

return OK;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/last-found.inl
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
// returns m.rend() on failure
//
template <class M, class T>
typename M::const_reverse_iterator last_found(const M& m, const T& val) {
typename M::const_reverse_iterator last_found(const M &m, const T &val) {

typename M::const_reverse_iterator first = m.rbegin();

typename M::const_reverse_iterator last = m.rend();

return std::lower_bound(first, last, val, [](const typename M::value_type& a, const T& b){ return a.first > b; });
return std::lower_bound(first, last, val, [](const typename M::value_type &a, const T &b){ return a.first > b; });
}


Expand Down
2 changes: 0 additions & 2 deletions lib/midi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2126,7 +2126,6 @@ TconvertToMidi(

--actualSpace;

#ifndef NDEBUG
ASSERT(tick == tickCount);
ASSERT(roundedTick == tickCount);
ASSERT(actualSpace == barLinesSpaceCount);
Expand All @@ -2135,7 +2134,6 @@ TconvertToMidi(
ASSERT(r.repeats == 0);
}
ASSERT(openSpaceSet.empty());
#endif // NDEBUG

//
// Emit any final note offs
Expand Down
47 changes: 1 addition & 46 deletions lib/tablature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,7 @@ TtbtFileTablature(const tbt_file_t &t) {
std::string trackEffectChanges;
std::string bottomLineText;

#ifndef NDEBUG
std::string debugText;
#endif // NDEBUG

if (trackMetadata.topLineText) {
topLineText.reserve(totalWidth);
Expand All @@ -773,9 +771,7 @@ TtbtFileTablature(const tbt_file_t &t) {
bottomLineText.reserve(totalWidth);
}

#ifndef NDEBUG
debugText.reserve(totalWidth);
#endif // NDEBUG


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

#ifndef NDEBUG
debugText += static_cast<char>(tuningWidth + '0');
debugText.append(tuningWidth - 1, ' ');
#endif // NDEBUG
}


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

#ifndef NDEBUG
debugText += static_cast<char>(1 + '0');
#endif // NDEBUG
}

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

uint8_t bottomLineTextWidthAcc = 0;

#ifndef NDEBUG
uint8_t debugTextWidthAcc = 0;
#endif // NDEBUG


auto fillin = [&](uint8_t width) {
Expand Down Expand Up @@ -976,11 +966,9 @@ TtbtFileTablature(const tbt_file_t &t) {
bottomLineTextWidthAcc = 0;
}

#ifndef NDEBUG
debugText.append(width - debugTextWidthAcc, ' ');

debugTextWidthAcc = 0;
#endif // NDEBUG
};


Expand Down Expand Up @@ -1071,11 +1059,10 @@ TtbtFileTablature(const tbt_file_t &t) {
}
}

#ifndef NDEBUG
debugText += static_cast<char>(repeatsStr.size() + '0');

debugTextWidthAcc += 1;
#endif // NDEBUG

savedClose = false;

} else {
Expand Down Expand Up @@ -1108,11 +1095,9 @@ TtbtFileTablature(const tbt_file_t &t) {
}
}

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

debugTextWidthAcc += 1;
#endif // NDEBUG
}

if ((barLine[0] & CLOSEREPEAT_MASK_GE70) == CLOSEREPEAT_MASK_GE70) {
Expand Down Expand Up @@ -1313,11 +1298,9 @@ TtbtFileTablature(const tbt_file_t &t) {
}
}

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

debugTextWidthAcc += 1;
#endif // NDEBUG

} // note

Expand Down Expand Up @@ -1428,11 +1411,9 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

#ifndef NDEBUG
debugText += static_cast<char>(repeatsStr.size() + '0');

debugTextWidthAcc += 1;
#endif // NDEBUG

break;
}
Expand Down Expand Up @@ -1489,11 +1470,9 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

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

debugTextWidthAcc += 1;
#endif // NDEBUG

break;
}
Expand Down Expand Up @@ -1533,11 +1512,9 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

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

debugTextWidthAcc += 1;
#endif // NDEBUG

} while (false);

Expand Down Expand Up @@ -1591,11 +1568,9 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

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

debugTextWidthAcc += 1;
#endif // NDEBUG

break;
}
Expand Down Expand Up @@ -1635,11 +1610,9 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

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

debugTextWidthAcc += 1;
#endif // NDEBUG

} while (false);

Expand Down Expand Up @@ -1729,11 +1702,9 @@ TtbtFileTablature(const tbt_file_t &t) {
}
}

#ifndef NDEBUG
debugText += static_cast<char>(repeatsStr.size() + '0');

debugTextWidthAcc += 1;
#endif // NDEBUG

savedClose = false;

Expand Down Expand Up @@ -1767,11 +1738,9 @@ TtbtFileTablature(const tbt_file_t &t) {
}
}

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

debugTextWidthAcc += 1;
#endif // NDEBUG
}

if ((barLine[0] & CLOSEREPEAT_MASK_GE70) == CLOSEREPEAT_MASK_GE70) {
Expand Down Expand Up @@ -1846,11 +1815,9 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

#ifndef NDEBUG
debugText += static_cast<char>(repeatsStr.size() + '0');

debugTextWidthAcc += 1;
#endif // NDEBUG

break;
}
Expand Down Expand Up @@ -1898,11 +1865,9 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

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

debugTextWidthAcc += 1;
#endif // NDEBUG

break;
}
Expand Down Expand Up @@ -1942,11 +1907,9 @@ TtbtFileTablature(const tbt_file_t &t) {
// nothing to do here
//

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

debugTextWidthAcc += 1;
#endif // NDEBUG

break;
}
Expand Down Expand Up @@ -1983,9 +1946,7 @@ TtbtFileTablature(const tbt_file_t &t) {
ASSERT(bottomLineTextWidthAcc == 0);
}

#ifndef NDEBUG
ASSERT(debugTextWidthAcc == 0);
#endif // NDEBUG


if (trackMetadata.topLineText) {
Expand All @@ -2004,9 +1965,7 @@ TtbtFileTablature(const tbt_file_t &t) {
ASSERT(bottomLineText.size() == totalWidth);
}

#ifndef NDEBUG
ASSERT(debugText.size() == totalWidth);
#endif // NDEBUG

acc += std::string("track ") + std::to_string(track + 1) + ":\n";

Expand All @@ -2027,9 +1986,7 @@ TtbtFileTablature(const tbt_file_t &t) {
toReserve += (totalWidth + 1);
}

#ifndef NDEBUG
toReserve += (totalWidth + 1);
#endif // NDEBUG

toReserve += 1;

Expand Down Expand Up @@ -2057,10 +2014,8 @@ TtbtFileTablature(const tbt_file_t &t) {
acc += '\n';
}

#ifndef NDEBUG
acc += debugText;
acc += '\n';
#endif // NDEBUG

acc += '\n';

Expand Down
8 changes: 0 additions & 8 deletions lib/tbt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,31 +151,23 @@ TparseTbtBytes(
{
if constexpr (0x6e <= VERSION) {

#ifndef NDEBUG
uint32_t metadataLen;
#endif // NDEBUG

if constexpr (0x71 <= VERSION) {

#ifndef NDEBUG
metadataLen = sizeof(tbt_track_metadata71) * out.header.trackCount;
#endif // NDEBUG

out.metadata.tracks = std::vector<tbt_track_metadata71>(out.header.trackCount);

} else if constexpr (0x70 <= VERSION) {

#ifndef NDEBUG
metadataLen = sizeof(tbt_track_metadata70) * out.header.trackCount;
#endif // NDEBUG

out.metadata.tracks = std::vector<tbt_track_metadata70>(out.header.trackCount);

} else {

#ifndef NDEBUG
metadataLen = sizeof(tbt_track_metadata6e) * out.header.trackCount;
#endif // NDEBUG

out.metadata.tracks = std::vector<tbt_track_metadata6e>(out.header.trackCount);
}
Expand Down

0 comments on commit 45780ae

Please sign in to comment.