Skip to content

Commit

Permalink
Large distance handling (#57)
Browse files Browse the repository at this point in the history
Handle large distances, back to note names.
  • Loading branch information
Andreya-Autumn authored Jan 16, 2025
1 parent 6b146ea commit 072b3a8
Show file tree
Hide file tree
Showing 7 changed files with 266 additions and 100 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ target_compile_definitions(${PROJECT_NAME} PUBLIC

target_link_libraries(${PROJECT_NAME} PUBLIC
juce::juce_graphics
juce::juce_animation
juce::juce_audio_utils
juce::juce_audio_devices
oddsound-mts-source
Expand All @@ -96,4 +97,4 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
# lattices-assets
)

include(cmake/basic-installer.cmake)
include(cmake/basic-installer.cmake)
37 changes: 0 additions & 37 deletions src/JIMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,43 +197,6 @@ struct JIMath
octaveReduceRatio(n, d);
ratioToMonzo(n, d, m);
}

// ============ Note Name Support

std::string nameNoteOnLattice(int x, int y)
{
auto location = x + y * 4 + 3;

auto ml = ((location % 7) + 7) % 7;
std::string name = noteNames[ml];

while (location >= 7)
{
name += "#";
location -= 7;
}
while (location < 0)
{
name += "b";
location += 7;
}
auto pom = y;
while (pom > 0)
{
name += "-";
--pom;
}
while (pom < 0)
{
name += "+";
++pom;
}

return name;
}

private:
std::string noteNames[7] = {"F", "C", "G", "D", "A", "E", "B"};
};

#endif // JI_MTS_SOURCE_JIMATH_H
Loading

0 comments on commit 072b3a8

Please sign in to comment.