Skip to content

Commit

Permalink
Add resetPositionOffset to encoder classes
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Feb 8, 2023
1 parent c0cfe92 commit 02374bc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/MIDI_Outputs/Abstract/MIDIAbsoluteEncoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ class GenericMIDIAbsoluteEncoder : public MIDIOutputElement {
/// Set the MIDI address.
void setAddress(MIDIAddress address) { this->address = address; }

int16_t resetPositionOffset() {
auto encval = encoder.read();
return encstate.update(encval);
}

private:
Enc encoder;
MIDIAddress address;
Expand Down
5 changes: 5 additions & 0 deletions src/MIDI_Outputs/Abstract/MIDIRotaryEncoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class GenericMIDIRotaryEncoder : public MIDIOutputElement {
/// Set the MIDI address.
void setAddress(MIDIAddress address) { this->address = address; }

int16_t resetPositionOffset() {
auto encval = encoder.read();
return encstate.update(encval);
}

private:
Enc encoder;
MIDIAddress address;
Expand Down
5 changes: 5 additions & 0 deletions src/MIDI_Outputs/Bankable/Abstract/MIDIAbsoluteEncoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ class GenericMIDIAbsoluteEncoder : public MIDIOutputElement {
}
int16_t getSpeedMultiply() const { return encstate.getSpeedMultiply(); }

int16_t resetPositionOffset() {
auto encval = encoder.read();
return encstate.update(encval);
}

protected:
Enc encoder;
BankAddress address;
Expand Down
5 changes: 5 additions & 0 deletions src/MIDI_Outputs/Bankable/Abstract/MIDIRotaryEncoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class GenericMIDIRotaryEncoder : public MIDIOutputElement {
}
int16_t getSpeedMultiply() const { return encstate.getSpeedMultiply(); }

int16_t resetPositionOffset() {
auto encval = encoder.read();
return encstate.update(encval);
}

protected:
BankAddress address;
Enc encoder;
Expand Down

0 comments on commit 02374bc

Please sign in to comment.