Skip to content

Commit

Permalink
demote LumatoneController from changing application state (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Aug 2, 2024
1 parent f06f5e8 commit fb24f42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 3 additions & 10 deletions Source/lumatone_editor_library/device/lumatone_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@
#include "../listeners/editor_listener.h"

LumatoneController::LumatoneController(const LumatoneApplicationState& stateIn, LumatoneFirmwareDriver& driverIn)
: LumatoneApplicationState("LumatoneController", stateIn)
, LumatoneApplicationState::DeviceController(static_cast<LumatoneApplicationState&>(*this))
: LumatoneState("LumatoneController", stateIn)
, LumatoneApplicationMidiController(stateIn, driverIn)
, firmwareDriver(driverIn)
, updateBuffer(driverIn, stateIn)
// , LumatoneSandboxLogger("LumatoneController")
{
firmwareDriver.addDriverListener(this);

eventManager = std::make_unique<LumatoneEventManager>(firmwareDriver, stateIn);
eventManager->addFirmwareListener(this);

addStatusListener(this);
}

LumatoneController::~LumatoneController()
Expand All @@ -37,7 +32,7 @@ LumatoneController::~LumatoneController()

juce::ValueTree LumatoneController::loadStateProperties(juce::ValueTree stateIn)
{
LumatoneApplicationState::loadStateProperties(stateIn);
LumatoneState::loadStateProperties(stateIn);
return state;
}

Expand Down Expand Up @@ -115,8 +110,6 @@ void LumatoneController::sendCompleteMapping(const LumatoneLayout& mappingData,
{
for (int boardId = 1; boardId <= getNumBoards(); boardId++)
sendAllParamsOfBoard(boardId, &mappingData.getBoard(boardId - 1), false, bufferKeyUpdates);

clearContext();
}

void LumatoneController::sendCurrentCompleteConfig(bool signalEditorListeners)
Expand Down Expand Up @@ -590,7 +583,7 @@ void LumatoneController::onConnectionConfirmed()

void LumatoneController::handleStatePropertyChange(juce::ValueTree stateIn, const juce::Identifier &property)
{
LumatoneApplicationState::handleStatePropertyChange(stateIn, property);
LumatoneState::handleStatePropertyChange(stateIn, property);

if (waitingForFirmwareVersion && property == LumatoneStateProperty::LastConnectedFirmwareVersion)
{
Expand Down
4 changes: 1 addition & 3 deletions Source/lumatone_editor_library/device/lumatone_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ class LumatoneAction;
// Helper class for parsing and comparing (todo) firmware versions


class LumatoneController : private LumatoneApplicationState
, private LumatoneApplicationState::DeviceController
class LumatoneController : private LumatoneState
, public LumatoneApplicationMidiController
, public LumatoneEditor::StatusListener
, protected LumatoneEditor::FirmwareListener
// , private LumatoneSandboxLogger
{
Expand Down

0 comments on commit fb24f42

Please sign in to comment.