Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/pitch_interval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ std::string intervalFillStr(const std::string& s, int n) {
static std::unordered_map<std::string, Interval> intervalCache;

// Arrays and constants - match TypeScript implementation
const std::vector<int> SIZES = {0, 2, 4, 5, 7, 9, 11};
const std::string TYPES = "PMMPPMM";
const std::array<int,7> SIZES = {0, 2, 4, 5, 7, 9, 11};
constexpr std::array<char, 7> TYPES = { 'P','M','M','P','P','M','M' };

// Define NoInterval - exactly like in TypeScript
const Interval NoInterval = Interval();
Expand Down Expand Up @@ -246,17 +246,17 @@ Interval interval(const std::string& src, bool useCache) {
}

// Check cache first
if (useCache && intervalCache.find(src) != intervalCache.end()) {
return intervalCache[src];
}
// if (useCache && intervalCache.find(src) != intervalCache.end()) {
// return intervalCache[src];
// }

// Parse string - using renamed function
auto result = parseInterval(src);

// Cache result if valid
if (useCache && !result.empty) {
intervalCache[src] = result;
}
// if (useCache && !result.empty) {
// intervalCache[src] = result;
// }

return result;
}
Expand Down