diff --git a/inc/cabl/devices/Device.h b/inc/cabl/devices/Device.h index 549a251..9b5877e 100644 --- a/inc/cabl/devices/Device.h +++ b/inc/cabl/devices/Device.h @@ -237,6 +237,8 @@ class Device virtual size_t numOfLedArrays() const = 0; + virtual size_t currentOctave() const { return 0; } + virtual void setButtonLed(Button, const Color&); virtual void setKeyLed(unsigned, const Color&); diff --git a/src/devices/ni/KompleteKontrol.cpp b/src/devices/ni/KompleteKontrol.cpp index 69caa6e..7932c2c 100644 --- a/src/devices/ni/KompleteKontrol.cpp +++ b/src/devices/ni/KompleteKontrol.cpp @@ -246,6 +246,7 @@ enum class KompleteKontrolBase::Button : uint8_t KompleteKontrolBase::KompleteKontrolBase() : m_isDirtyLeds(true) , m_isDirtyKeyLeds(true) + , m_hasValidOctave(false) #if defined(_WIN32) || defined(__APPLE__) || defined(__linux) , m_pMidiOut(new RtMidiOut) , m_pMidiIn(new RtMidiIn) @@ -515,6 +516,7 @@ void KompleteKontrolBase::processButtons(const Transfer& input_) } m_firstOctave = input_.data()[37]; + m_hasValidOctave = true; } //-------------------------------------------------------------------------------------------------- @@ -692,5 +694,37 @@ void KompleteKontrolBase::midiInCallback( //-------------------------------------------------------------------------------------------------- +template <> +size_t KompleteKontrolS25::defaultOctave() const +{ + return 48; +} + +//-------------------------------------------------------------------------------------------------- + +template <> +size_t KompleteKontrolS49::defaultOctave() const +{ + return 36; +} + +//-------------------------------------------------------------------------------------------------- + +template <> +size_t KompleteKontrolS61::defaultOctave() const +{ + return 36; +} + +//-------------------------------------------------------------------------------------------------- + +template <> +size_t KompleteKontrolS88::defaultOctave() const +{ + return 21; +} + +//-------------------------------------------------------------------------------------------------- + } // namespace cabl } // namespace sl diff --git a/src/devices/ni/KompleteKontrol.h b/src/devices/ni/KompleteKontrol.h index 87c1904..3a2b967 100644 --- a/src/devices/ni/KompleteKontrol.h +++ b/src/devices/ni/KompleteKontrol.h @@ -56,6 +56,16 @@ class KompleteKontrolBase : public Device return 0; } + size_t currentOctave() const override + { + return m_hasValidOctave ? m_firstOctave : defaultOctave(); + } + + virtual size_t defaultOctave() const + { + assert(false); + } + bool tick() override; private: @@ -99,6 +109,7 @@ class KompleteKontrolBase : public Device bool m_isDirtyKeyLeds; uint8_t m_firstOctave; + bool m_hasValidOctave; TextDisplayKompleteKontrol m_displays[kKK_nDisplays]; @@ -125,6 +136,8 @@ class KompleteKontrol final : public KompleteKontrolBase return kKK_keysLedDataSize; } + size_t defaultOctave() const override; + private: uint8_t* ledsKeysData() override {