midi routing from audio app
This commit is contained in:
parent
dd78891783
commit
9498f77278
5 changed files with 25 additions and 9 deletions
|
|
@ -106,9 +106,6 @@ void setup() {
|
||||||
WRITE_VOLATILE(interface_ready, true);
|
WRITE_VOLATILE(interface_ready, true);
|
||||||
Serial.println("Bound interface to MEMLNaut.");
|
Serial.println("Bound interface to MEMLNaut.");
|
||||||
|
|
||||||
if (midi_interf) {
|
|
||||||
currentMode->setupMIDI(midi_interf);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE_VOLATILE(core_0_ready, true);
|
WRITE_VOLATILE(core_0_ready, true);
|
||||||
while (!READ_VOLATILE(core_1_ready)) {
|
while (!READ_VOLATILE(core_1_ready)) {
|
||||||
|
|
@ -203,6 +200,9 @@ void setup1() {
|
||||||
delay(1);
|
delay(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (midi_interf) {
|
||||||
|
currentMode->setupMIDI(midi_interf);
|
||||||
|
}
|
||||||
|
|
||||||
currentMode->setupAudio(AudioDriver::GetSampleRate());
|
currentMode->setupAudio(AudioDriver::GetSampleRate());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,14 @@
|
||||||
|
|
||||||
#include "../../src/memllib/audio/AudioAppBase.hpp"
|
#include "../../src/memllib/audio/AudioAppBase.hpp"
|
||||||
#include "../../src/memllib/synth/maximilian.h"
|
#include "../../src/memllib/synth/maximilian.h"
|
||||||
|
#include "../../src/memllib/interface/MIDIInOut.hpp"
|
||||||
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory> // Added for std::shared_ptr
|
#include <memory> // Added for std::shared_ptr
|
||||||
|
|
||||||
#include "../../src/memllib/interface/InterfaceBase.hpp" // Added missing include
|
#include "../../src/memllib/interface/InterfaceBase.hpp"
|
||||||
|
|
||||||
#include <span>
|
#include <span>
|
||||||
|
|
||||||
|
|
@ -24,6 +26,8 @@ public:
|
||||||
static constexpr size_t kN_Params = NPARAMS;
|
static constexpr size_t kN_Params = NPARAMS;
|
||||||
static constexpr size_t nVoiceSpaces=0;
|
static constexpr size_t nVoiceSpaces=0;
|
||||||
|
|
||||||
|
std::shared_ptr<MIDIInOut> midiIO;
|
||||||
|
|
||||||
std::array<VoiceSpace<NPARAMS>, nVoiceSpaces> voiceSpaces;
|
std::array<VoiceSpace<NPARAMS>, nVoiceSpaces> voiceSpaces;
|
||||||
|
|
||||||
VoiceSpaceFn<NPARAMS> currentVoiceSpace;
|
VoiceSpaceFn<NPARAMS> currentVoiceSpace;
|
||||||
|
|
@ -63,6 +67,12 @@ public:
|
||||||
|
|
||||||
stereosample_t __force_inline Process(const stereosample_t x) override
|
stereosample_t __force_inline Process(const stereosample_t x) override
|
||||||
{
|
{
|
||||||
|
phasor0 += 1.f;
|
||||||
|
if (phasor0>=48000.f) {
|
||||||
|
phasor0-=48000.f;
|
||||||
|
midiIO->queueNoteOn(36, 127);
|
||||||
|
midiIO->flushQueue();
|
||||||
|
}
|
||||||
stereosample_t ret { 0.f,0.f };
|
stereosample_t ret { 0.f,0.f };
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +83,9 @@ public:
|
||||||
maxiSettings::sampleRate = sample_rate;
|
maxiSettings::sampleRate = sample_rate;
|
||||||
sampleRatef = static_cast<float>(sample_rate);
|
sampleRatef = static_cast<float>(sample_rate);
|
||||||
}
|
}
|
||||||
|
void setupMIDI(std::shared_ptr<MIDIInOut> new_midi_interf) {
|
||||||
|
midiIO = new_midi_interf;
|
||||||
|
}
|
||||||
|
|
||||||
void loop() override {
|
void loop() override {
|
||||||
AudioAppBase<NPARAMS>::loop();
|
AudioAppBase<NPARAMS>::loop();
|
||||||
|
|
@ -91,6 +103,8 @@ protected:
|
||||||
|
|
||||||
float sampleRatef;
|
float sampleRatef;
|
||||||
bool firstParamsReceived = false;
|
bool firstParamsReceived = false;
|
||||||
|
|
||||||
|
float phasor0=0.f;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __BREAKOR_AUDIO_APP_HPP__
|
#endif // __BREAKOR_AUDIO_APP_HPP__
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "../src/memllib/interface/MIDIInOut.hpp"
|
#include "../src/memllib/interface/MIDIInOut.hpp"
|
||||||
#include "../src/memllib/hardware/memlnaut/MEMLNaut.hpp"
|
#include "../src/memllib/hardware/memlnaut/MEMLNaut.hpp"
|
||||||
#include "AudioApps/BreakOrAudioApp.hpp"
|
#include "./AudioApps/BreakOrAudioApp.hpp"
|
||||||
#include "../src/memllib/examples/InterfaceRL.hpp"
|
#include "../src/memllib/examples/InterfaceRL.hpp"
|
||||||
#include "../src/memllib/PicoDefs.hpp"
|
#include "../src/memllib/PicoDefs.hpp"
|
||||||
#include "MEMLNautMode.hpp"
|
#include "MEMLNautMode.hpp"
|
||||||
|
|
@ -39,6 +39,7 @@ public:
|
||||||
void setupAudio(float sample_rate) {
|
void setupAudio(float sample_rate) {
|
||||||
audioAppBreakOr.Setup(sample_rate, interfacePtr);
|
audioAppBreakOr.Setup(sample_rate, interfacePtr);
|
||||||
voiceSpaceList = audioAppBreakOr.getVoiceSpaceNames();
|
voiceSpaceList = audioAppBreakOr.getVoiceSpaceNames();
|
||||||
|
audioAppBreakOr.setupMIDI(midi_interf);
|
||||||
}
|
}
|
||||||
|
|
||||||
__force_inline void loop() {
|
__force_inline void loop() {
|
||||||
|
|
@ -49,8 +50,9 @@ public:
|
||||||
|
|
||||||
void setupMIDI(std::shared_ptr<MIDIInOut> new_midi_interf) {
|
void setupMIDI(std::shared_ptr<MIDIInOut> new_midi_interf) {
|
||||||
midi_interf = new_midi_interf;
|
midi_interf = new_midi_interf;
|
||||||
midi_interf->Setup(16);
|
midi_interf->Setup(0);
|
||||||
midi_interf->SetMIDISendChannel(1);
|
midi_interf->SetMIDISendChannel(1);
|
||||||
|
midi_interf->SetMIDINoteChannel(10);
|
||||||
interface.bindMIDI(midi_interf);
|
interface.bindMIDI(midi_interf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5bae63daa89332f333ace163818b23308cdf3518
|
Subproject commit 1693e46e0b38c5920ebdf6cdf2a9107503003c8d
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5d2935d6420f5e6ab0ad8321bab5125cce2fb500
|
Subproject commit 2eaef772c985e221e13c62676eaa293cf75d87e2
|
||||||
Loading…
Reference in a new issue