display update

This commit is contained in:
chriskiefer 2025-09-08 11:13:10 +01:00
parent 3526e8ba0e
commit 8d7a2c728d
5 changed files with 65 additions and 24 deletions

View file

@ -1,6 +1,6 @@
// #include "src/memllib/interface/InterfaceBase.hpp"
#include "src/memllib/interface/MIDIInOut.hpp"
#include "src/memllib/hardware/memlnaut/display.hpp"
// #include "src/memllib/hardware/memlnaut/display.hpp"
#include "src/memllib/audio/AudioAppBase.hpp"
#include "src/memllib/audio/AudioDriver.hpp"
#include "src/memllib/hardware/memlnaut/MEMLNaut.hpp"
@ -12,7 +12,7 @@
#define APP_SRAM __not_in_flash("app")
display APP_SRAM scr;
// display APP_SRAM scr;
bool core1_disable_systick = true;
bool core1_separate_stack = true;
@ -55,16 +55,16 @@ constexpr size_t kN_InputParams = 3;
#define READ_VOLATILE(var) ({ MEMORY_BARRIER(); typeof(var) __temp = (var); MEMORY_BARRIER(); __temp; })
struct repeating_timer APP_SRAM timerDisplay;
inline bool __not_in_flash_func(displayUpdate)(__unused struct repeating_timer *t) {
scr.update();
return true;
}
// struct repeating_timer APP_SRAM timerDisplay;
// inline bool __not_in_flash_func(displayUpdate)(__unused struct repeating_timer *t) {
// scr.update();
// return true;
// }
void setup()
{
scr.setup();
// scr.setup();
bus_ctrl_hw->priority = BUSCTRL_BUS_PRIORITY_DMA_W_BITS |
BUSCTRL_BUS_PRIORITY_DMA_R_BITS | BUSCTRL_BUS_PRIORITY_PROC1_BITS;
@ -89,8 +89,8 @@ void setup()
// Setup interface with memory barrier protection
WRITE_VOLATILE(interface_ready, true);
// Bind interface after ensuring it's fully initialized
RLInterface->bind_RL_interface(scr);
Serial.println("Bound RL interface to MEMLNaut.");
// RLInterface->bind_RL_interface(scr);
// Serial.println("Bound RL interface to MEMLNaut.");
midi_interf = std::make_shared<MIDIInOut>();
midi_interf->Setup(0);
@ -115,9 +115,10 @@ void setup()
delay(1);
}
scr.post("MEMLNaut PAF CARL");
scr.post("let's go!");
add_repeating_timer_ms(-39, displayUpdate, NULL, &timerDisplay);
// scr.post("MEMLNaut PAF CARL");
// scr.post("let's go!");
// add_repeating_timer_ms(-39, displayUpdate, NULL, &timerDisplay);
MEMLNaut::Instance()->addSystemInfoView();
Serial.println("Finished initialising core 0.");
}

View file

@ -1,6 +1,8 @@
#include "PAFSynthAudioApp.hpp"
#include "src/memllib/synth/maximilian.h" // Required for maxiSettings etc.
#define ARPEGGIATOR
PAFSynthAudioApp::PAFSynthAudioApp() : AudioAppBase() {}
bool PAFSynthAudioApp::euclidean(float phase, const size_t n, const size_t k, const size_t offset, const float pulseWidth)
@ -41,22 +43,53 @@ stereosample_t PAFSynthAudioApp::Process(const stereosample_t x)
// y = y * 0.3f;
// const float envamp = env.play(counter==0);
// const float envamp = line.play(counter==0);
if(newNote) {
// if(zxdetect.onZX(euclidNewNote)) {
newNote = false;
// if(newNote) {
// // if(zxdetect.onZX(euclidNewNote)) {
// newNote = false;
// envamp=0.8f;
// // freqIndex++;
// // if(freqIndex >= 4) {
// // freqIndex = 0;
// // }
// // arpFreq = frequencies[freqIndex];
// }else{
// constexpr float envdec = 0.2f/9000.f;
// envamp -= envdec;
// if (envamp < 0.f) {
// envamp = 0.f;
// }
// }
#ifdef ARPEGGIATOR
const float ph = phasorOsc.phasor(1);
const bool euclidNewNote = euclidean(ph, 12, euclidN, 0, 0.1f);
if(zxdetect.onZX(euclidNewNote)) {
envamp=0.8f;
// freqIndex++;
// if(freqIndex >= 4) {
// freqIndex = 0;
// }
// arpFreq = frequencies[freqIndex];
freqIndex++;
if(freqIndex >= nFREQs) {
freqIndex = 0;
}
baseFreq = frequencies[freqIndex];
}else{
constexpr float envdec = 0.2f/9000.f;
// constexpr float envdec = 0.2f/9000.f;
envamp -= envdec;
if (envamp < 0.f) {
envamp = 0.f;
}
}
#else
if(newNote) {
newNote = false;
envamp=0.8f;
}else{
// constexpr float envdec = 0.2f/9000.f;
envamp -= envdec;
if (envamp < 0.f) {
envamp = 0.f;
}
}
#endif
// PERIODIC_DEBUG(3000, Serial.println(y);)
y = y * envamp* envamp;
// counter++;
@ -73,7 +106,9 @@ stereosample_t PAFSynthAudioApp::Process(const stereosample_t x)
// Serial.println(envamp);
// })
#ifndef ARPEGGIATOR
y *= noteVel;
#endif
float d1 = (dl1.play(y, 3500, 0.8f) * dl1mix);
// float d2 = (dl2.play(y, 15000, 0.8f) * dl2mix);
@ -188,5 +223,8 @@ void PAFSynthAudioApp::ProcessParams(const std::vector<float>& params)
euclidN = static_cast<size_t>(2 + (params[19] * 5));
envdec=((params[20] * 3.f) + 0.1f)/9000.f; // Decay rate for the envelope
// Serial.printf("%f %f %f %f %f\n", paf0_cf, paf0_bw, paf0_vib, paf0_vfr, paf0_shift);
}

View file

@ -96,6 +96,8 @@ protected:
float noteVel = 0.f;
bool firstParamsReceived = false;
float envdec=0.2f/9000.f; // Decay rate for the envelope
};
#endif // __PAF_SYNTH_AUDIO_APP_HPP__

@ -1 +1 @@
Subproject commit 96d0c879fcbbebc1ee57198251029f849c99a278
Subproject commit 5998f312f887b60d13ce3437c0dca5cbf3df819b

@ -1 +1 @@
Subproject commit 053d7b075e509b302dc45cb6664c01f73a96fead
Subproject commit a81f2358a42b3b202c6a3eaf1e89407e0aa026c8