-
Notifications
You must be signed in to change notification settings - Fork 36
Add default default octave depending on KK model #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,23 @@ const uint8_t kKK_ledsDataSize = 25; | |
|
||
const uint8_t kKK_epOut = 0x02; | ||
const uint8_t kKK_epInput = 0x84; | ||
|
||
size_t getInitialOctave(const sl::cabl::KompleteKontrolBase::NUM_KEYS numKeys) | ||
{ | ||
using namespace sl::cabl; | ||
|
||
switch (numKeys) | ||
{ | ||
case KompleteKontrolBase::KEYS_25: | ||
return 48; | ||
case KompleteKontrolBase::KEYS_49: | ||
case KompleteKontrolBase::KEYS_61: | ||
return 36; | ||
default: | ||
return 21; | ||
} | ||
} | ||
|
||
} // namespace | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
|
@@ -243,9 +260,13 @@ enum class KompleteKontrolBase::Button : uint8_t | |
|
||
//-------------------------------------------------------------------------------------------------- | ||
|
||
KompleteKontrolBase::KompleteKontrolBase() | ||
: m_isDirtyLeds(true) | ||
KompleteKontrolBase::KompleteKontrolBase(const NUM_KEYS numKeys) | ||
: m_numKeys(static_cast<unsigned>(numKeys)) | ||
, m_ledsKeysSize(m_numKeys * 3U) | ||
, m_ledsKeys(new uint8_t[m_ledsKeysSize]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c style array creation, since you're using pointers for data writing I didn't change this to a vector There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe a shared_ptr with the array is an option here |
||
, m_isDirtyLeds(true) | ||
, m_isDirtyKeyLeds(true) | ||
, m_firstOctave(getInitialOctave(numKeys)) | ||
#if defined(_WIN32) || defined(__APPLE__) || defined(__linux) | ||
, m_pMidiOut(new RtMidiOut) | ||
, m_pMidiIn(new RtMidiIn) | ||
|
@@ -311,6 +332,7 @@ KompleteKontrolBase::KompleteKontrolBase() | |
|
||
KompleteKontrolBase::~KompleteKontrolBase() | ||
{ | ||
delete[] m_ledsKeys; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete based destruction. A bit ugly, maybe there's a better way to do this |
||
#if defined(_WIN32) || defined(__APPLE__) || defined(__linux) | ||
m_pMidiOut->closePort(); | ||
m_pMidiIn->closePort(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe there's a better name for this