diff --git a/Userland/Libraries/LibDSP/Clip.cpp b/Userland/Libraries/LibDSP/Clip.cpp index ebd8588956..8b672a764c 100644 --- a/Userland/Libraries/LibDSP/Clip.cpp +++ b/Userland/Libraries/LibDSP/Clip.cpp @@ -16,7 +16,7 @@ Sample AudioClip::sample_at(u32 time) void NoteClip::set_note(RollNote note) { - VERIFY(note.pitch >= 0 && note.pitch < note_count); + VERIFY(note.pitch >= 0 && note.pitch < note_frequencies.size()); VERIFY(note.off_sample < m_length); VERIFY(note.length() >= 2); diff --git a/Userland/Libraries/LibDSP/Clip.h b/Userland/Libraries/LibDSP/Clip.h index 9e950d22f9..818a18d15b 100644 --- a/Userland/Libraries/LibDSP/Clip.h +++ b/Userland/Libraries/LibDSP/Clip.h @@ -47,10 +47,10 @@ class NoteClip final : public Clip { public: void set_note(RollNote note); - Array, note_count> const& notes() const { return m_notes; } + Array, note_frequencies.size()> const& notes() const { return m_notes; } private: - Array, note_count> m_notes; + Array, note_frequencies.size()> m_notes; }; } diff --git a/Userland/Libraries/LibDSP/Music.h b/Userland/Libraries/LibDSP/Music.h index 501f364472..d4b90ca93e 100644 --- a/Userland/Libraries/LibDSP/Music.h +++ b/Userland/Libraries/LibDSP/Music.h @@ -84,7 +84,7 @@ struct Signal : public Variant { // We calculate note frequencies relative to A4: // 440.0 * pow(pow(2.0, 1.0 / 12.0), N) // Where N is the note distance from A. -constexpr double note_frequencies[] = { +constexpr Array note_frequencies = { // Octave 1 32.703195662574764, 34.647828872108946, @@ -177,7 +177,6 @@ constexpr double note_frequencies[] = { 3729.3100921447249, 3951.0664100489994, }; -constexpr size_t const note_count = array_size(note_frequencies); constexpr double const middle_c = note_frequencies[36]; diff --git a/Userland/Libraries/LibDSP/Synthesizers.cpp b/Userland/Libraries/LibDSP/Synthesizers.cpp index 8b583adf3d..5cab654a2c 100644 --- a/Userland/Libraries/LibDSP/Synthesizers.cpp +++ b/Userland/Libraries/LibDSP/Synthesizers.cpp @@ -41,7 +41,7 @@ Signal Classic::process_impl(Signal const& input_signal) // "Press" the necessary notes in the internal representation, // and "release" all of the others - for (u8 i = 0; i < note_count; ++i) { + for (u8 i = 0; i < note_frequencies.size(); ++i) { if (auto maybe_note = in.get(i); maybe_note.has_value()) m_playing_notes.set(i, maybe_note.value()); diff --git a/Userland/Libraries/LibDSP/Synthesizers.h b/Userland/Libraries/LibDSP/Synthesizers.h index 01654d99cb..ee74c4cf9b 100644 --- a/Userland/Libraries/LibDSP/Synthesizers.h +++ b/Userland/Libraries/LibDSP/Synthesizers.h @@ -66,7 +66,7 @@ private: ProcessorRangeParameter m_release; RollNotes m_playing_notes; - Array last_random; + Array last_random; }; }