voice space selectotr

This commit is contained in:
chriskiefer 2025-11-04 13:26:08 +00:00
parent 4e3145c385
commit 66ff5b756c
3 changed files with 18 additions and 4 deletions

View file

@ -10,6 +10,7 @@
#include "src/memllib/examples/InterfaceRL.hpp" #include "src/memllib/examples/InterfaceRL.hpp"
#include "src/memllib/hardware/memlnaut/display/XYPadView.hpp" #include "src/memllib/hardware/memlnaut/display/XYPadView.hpp"
#include "src/memllib/hardware/memlnaut/display/MessageView.hpp" #include "src/memllib/hardware/memlnaut/display/MessageView.hpp"
#include "src/memllib/hardware/memlnaut/display/VoiceSpaceSelectView.hpp"
#define INTERFACE_TYPE InterfaceRL #define INTERFACE_TYPE InterfaceRL
@ -47,6 +48,8 @@ volatile bool APP_SRAM core_1_ready = false;
volatile bool APP_SRAM serial_ready = false; volatile bool APP_SRAM serial_ready = false;
volatile bool APP_SRAM interface_ready = false; volatile bool APP_SRAM interface_ready = false;
std::array<String, PAFSynthAudioApp<>::nVoiceSpaces> voiceSpaceList;
// We're only bound to the joystick inputs (x, y, rotate) // We're only bound to the joystick inputs (x, y, rotate)
@ -160,6 +163,17 @@ void setup() {
} }
}); });
std::shared_ptr<VoiceSpaceSelectView> voiceSpaceSelectView;
voiceSpaceSelectView = std::make_shared<VoiceSpaceSelectView>("Voice Spaces");
MEMLNaut::Instance()->disp->AddView(voiceSpaceSelectView);
voiceSpaceSelectView->setOptions(voiceSpaceList); //set by core 1 on startup
voiceSpaceSelectView->setNewVoiceCallback(
[](size_t idx) {
// Serial.println(idx);
audio_app->setVoiceSpace(idx);
}
);
MEMLNaut::Instance()->disp->AddView(noteTrigView); MEMLNaut::Instance()->disp->AddView(noteTrigView);
std::shared_ptr<MessageView> helpView = std::make_shared<MessageView>("Help"); std::shared_ptr<MessageView> helpView = std::make_shared<MessageView>("Help");
@ -171,7 +185,7 @@ void setup() {
helpView->post("X: Learning rate"); helpView->post("X: Learning rate");
helpView->post("Y: Reward Scale"); helpView->post("Y: Reward Scale");
helpView->post("Z: Exploration noise"); helpView->post("Z: Exploration noise");
helpView->post("Joystick: Explore"); helpView->post("Joystick: Explore / SW: Drag sound");
MEMLNaut::Instance()->disp->AddView(helpView); MEMLNaut::Instance()->disp->AddView(helpView);
MEMLNaut::Instance()->addSystemInfoView(); MEMLNaut::Instance()->addSystemInfoView();
@ -263,7 +277,7 @@ void setup1() {
// Start audio driver // Start audio driver
AudioDriver::Setup(); AudioDriver::Setup();
// AudioDriver::SetBlockCallback(audio_block_callback); // AudioDriver::SetBlockCallback(audio_block_callback);
voiceSpaceList = audio_app->getVoiceSpaceNames();
WRITE_VOLATILE(core_1_ready, true); WRITE_VOLATILE(core_1_ready, true);
while (!READ_VOLATILE(core_0_ready)) { while (!READ_VOLATILE(core_0_ready)) {

View file

@ -48,7 +48,7 @@ public:
void setVoiceSpace(size_t i) { void setVoiceSpace(size_t i) {
if (i < voiceSpaces.size()) { if (i < voiceSpaces.size()) {
currentVoiceSpace = voiceSpaces[i]; currentVoiceSpace = voiceSpaces[i].mappingFunction;
} }
} }

@ -1 +1 @@
Subproject commit 6c0b07b75a799fcddfdea1c6652e31a791d4e2e7 Subproject commit c26b4828a534eef2db11730c67711b4b740ed09c