Fixed performance problem

This commit is contained in:
Andrea Martelloni 2025-09-08 13:17:35 +01:00
parent c1ce9f1fc9
commit afd542ee86
4 changed files with 28 additions and 4 deletions

View file

@ -141,6 +141,26 @@ void loop()
delay(10); // Add a small delay to avoid flooding the serial output
}
void AUDIO_FUNC(audio_block_callback)(float in[][kBufferSize], float out[][kBufferSize], size_t n_channels, size_t n_frames)
{
digitalWrite(Pins::LED_TIMING, HIGH);
for (size_t i = 0; i < n_frames; ++i) {
float y = in[0][i];
// Audio processing
if (audio_app) {
y = audio_app->ProcessLean();
}
out[0][i] = y;
out[1][i] = y;
}
digitalWrite(Pins::LED_TIMING, LOW);
}
void setup1()
{
while (!READ_VOLATILE(serial_ready)) {
@ -162,14 +182,17 @@ void setup1()
// shared_ptr with custom deleter calling only the destructor (control block still allocates)
auto audio_deleter = [](PAFSynthAudioApp* p) { if (p) p->~PAFSynthAudioApp(); };
std::shared_ptr<PAFSynthAudioApp> temp_audio_app(audio_raw, audio_deleter);
MEMORY_BARRIER();
audio_app = temp_audio_app;
MEMORY_BARRIER();
}
AudioDriver::SetBlockCallback(audio_block_callback);
// Start audio driver
AudioDriver::Setup();
AudioDriver::SetBlockCallback(audio_block_callback);
WRITE_VOLATILE(core_1_ready, true);
while (!READ_VOLATILE(core_0_ready)) {

View file

@ -1,8 +1,6 @@
#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)

View file

@ -13,6 +13,9 @@
#include "src/memllib/interface/InterfaceBase.hpp" // Added missing include
#define ARPEGGIATOR
class PAFSynthAudioApp : public AudioAppBase
{
public:

@ -1 +1 @@
Subproject commit a85fab44b44034098cec31285bfd68f4a041b33a
Subproject commit 95c1e6abd474c744b17763d432e65fe208a773b3