Skip to content

Commit df606be

Browse files
committed
CleanUp
1 parent 4ffe81d commit df606be

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

src/main.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ BaseSurface::~BaseSurface() {
145145
}
146146

147147
void BaseSurface::Run() {
148-
// ToDo: Rather than putting this in BaseSurface consider to just override Run() in NiMidiSurface and call the superclass : BaseSurface::Run()
149-
this->_peakMixerUpdate();
150-
// --------------------------------------------------------------------------------
151148
if (!this->_midiIn) {
152149
return;
153150
}

src/mcu.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,7 @@ class McuSurface: public BaseSurface {
102102
message += MIDI_SYSEX_END;
103103
this->_sendRaw(message);
104104
}
105-
106-
void _peakMixerUpdate() override {
107-
// DUMMY. Currently only implemented for niMiDi (Mk2). Maybe better to move Run() callback into niMidi.cpp and mcu.cpp?
108-
}
109-
105+
110106
private:
111107
void _sendRaw(const string& message) {
112108
// MIDI_event_t includes 4 bytes for the message, but we need more.

src/niMidi.cpp

+20-9
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,14 @@ class NiMidiSurface: public BaseSurface {
179179
virtual const char* GetDescString() override {
180180
return "Komplete Kontrol S-series Mk2/A-series/M-series";
181181
}
182-
182+
183+
virtual void Run() override {
184+
// Moved from main to deal with activities specific to S-Mk2/A/M series and not applicable to S-Mk1 keyboards
185+
this->_peakMixerUpdate();
186+
// --------------------------------------------------------------------------------
187+
BaseSurface::Run();
188+
}
189+
183190
virtual void SetPlayState(bool play, bool pause, bool rec) override {
184191
#ifdef CALLBACK_DIAGNOSTICS
185192
ostringstream s;
@@ -476,6 +483,8 @@ class NiMidiSurface: public BaseSurface {
476483
return 1;
477484
}
478485

486+
//===============================================================================================================================
487+
479488
protected:
480489
void _onMidiEvent(MIDI_event_t* event) override {
481490
if (event->midi_message[0] != MIDI_CC) {
@@ -621,20 +630,27 @@ class NiMidiSurface: public BaseSurface {
621630
}
622631
}
623632

624-
void _peakMixerUpdate() override {
633+
//===============================================================================================================================
634+
635+
private:
636+
int _protocolVersion = 0;
637+
int _bankStart = 0;
638+
int _bankEnd = 0;
639+
640+
void _peakMixerUpdate() {
625641
// Peak meters. Note: Reaper reports peak, NOT VU
626642

627643
// ToDo: Peak Hold in KK display shall be erased immediately when changing bank
628644
// ToDo: Peak Hold in KK display shall be erased after decay time t when track muted or no signal.
629645
// ToDo: Explore the effect of sending CMD_SEL_TRACK_PARAMS_CHANGED after sending CMD_TRACK_VU
630646
// ToDo: Consider caching and not sending anything via SysEx if no values have changed.
631-
647+
632648
// Meter information is sent to KK as array (string of chars) for all 16 channels (8 x stereo) of one bank.
633649
// A value of 0 will result in stopping to refresh meters further to right as it is interpretated as "end of string".
634650
// peakBank[0]..peakBank[31] are used for data. The array needs one additional last char peakBank[32] set as "end of string" marker.
635651
static char peakBank[(BANK_NUM_TRACKS * 2) + 1];
636652
int j = 0;
637-
double peakValue = 0;
653+
double peakValue = 0;
638654
int numInBank = 0;
639655
for (int id = this->_bankStart; id <= this->_bankEnd; ++id, ++numInBank) {
640656
MediaTrack* track = CSurf_TrackFromID(id, false);
@@ -688,11 +704,6 @@ class NiMidiSurface: public BaseSurface {
688704
this->_sendSysex(CMD_TRACK_VU, 2, 0, peakBank);
689705
}
690706

691-
private:
692-
int _protocolVersion = 0;
693-
int _bankStart = 0;
694-
int _bankEnd = 0;
695-
696707
void _allMixerUpdate() {
697708
#ifdef CALLBACK_DIAGNOSTICS
698709
ostringstream s;

src/reaKontrol.h

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class BaseSurface: public IReaperControlSurface {
7979
midi_Input* _midiIn = nullptr;
8080
midi_Output* _midiOut = nullptr;
8181
virtual void _onMidiEvent(MIDI_event_t* event) = 0;
82-
virtual void _peakMixerUpdate() = 0;
8382
};
8483

8584
IReaperControlSurface* createNiMidiSurface(int inDev, int outDev);

0 commit comments

Comments
 (0)