diff --git a/MEMLNaut-PAF-NISPS.ino b/MEMLNaut-PAF-NISPS.ino index 0693e87..3c603d1 100644 --- a/MEMLNaut-PAF-NISPS.ino +++ b/MEMLNaut-PAF-NISPS.ino @@ -10,6 +10,7 @@ #include "src/memllib/examples/InterfaceRL.hpp" #include "src/memllib/hardware/memlnaut/display/XYPadView.hpp" #include "src/memllib/hardware/memlnaut/display/MessageView.hpp" +#include "src/memllib/hardware/memlnaut/display/VoiceSpaceSelectView.hpp" #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 interface_ready = false; +std::array::nVoiceSpaces> voiceSpaceList; + // We're only bound to the joystick inputs (x, y, rotate) @@ -160,6 +163,17 @@ void setup() { } }); + std::shared_ptr voiceSpaceSelectView; + voiceSpaceSelectView = std::make_shared("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); std::shared_ptr helpView = std::make_shared("Help"); @@ -171,7 +185,7 @@ void setup() { helpView->post("X: Learning rate"); helpView->post("Y: Reward Scale"); helpView->post("Z: Exploration noise"); - helpView->post("Joystick: Explore"); + helpView->post("Joystick: Explore / SW: Drag sound"); MEMLNaut::Instance()->disp->AddView(helpView); MEMLNaut::Instance()->addSystemInfoView(); @@ -263,7 +277,7 @@ void setup1() { // Start audio driver AudioDriver::Setup(); // AudioDriver::SetBlockCallback(audio_block_callback); - + voiceSpaceList = audio_app->getVoiceSpaceNames(); WRITE_VOLATILE(core_1_ready, true); while (!READ_VOLATILE(core_0_ready)) { diff --git a/PAFSynthAudioApp.hpp b/PAFSynthAudioApp.hpp index bb99c7e..bd87458 100644 --- a/PAFSynthAudioApp.hpp +++ b/PAFSynthAudioApp.hpp @@ -48,7 +48,7 @@ public: void setVoiceSpace(size_t i) { if (i < voiceSpaces.size()) { - currentVoiceSpace = voiceSpaces[i]; + currentVoiceSpace = voiceSpaces[i].mappingFunction; } } diff --git a/src/memllib b/src/memllib index 6c0b07b..c26b482 160000 --- a/src/memllib +++ b/src/memllib @@ -1 +1 @@ -Subproject commit 6c0b07b75a799fcddfdea1c6652e31a791d4e2e7 +Subproject commit c26b4828a534eef2db11730c67711b4b740ed09c