moved midi around
This commit is contained in:
parent
fa30594239
commit
9f6525c918
@ -133,11 +133,23 @@ void Chassis::noteOff(uint8_t note) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEvent *MidiEvents, uint32_t midiEventCount) {
|
void Chassis::doMidi(const MidiEvent *ev, uint32_t count, uint32_t timelimit ) {
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
|
if (ev[i].data[0] == 0x90) {
|
||||||
|
noteOn(ev[i].data[1]);
|
||||||
|
}
|
||||||
|
if (ev[i].data[0] == 0x80) {
|
||||||
|
noteOff(ev[i].data[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEvent *midiEvents, uint32_t midiEventCount) {
|
||||||
// if (midiEventCount > 0) printf("\n--------------------\n");
|
// if (midiEventCount > 0) printf("\n--------------------\n");
|
||||||
|
|
||||||
|
s.framesLeft = frames;
|
||||||
if (s.framesLeft == 0) s.framesLeft = frames;
|
|
||||||
|
|
||||||
while ( s.framesLeft != 0) {
|
while ( s.framesLeft != 0) {
|
||||||
uint32_t sizeThisTime = (frames <= s.blockLeft)?frames:s.blockLeft;
|
uint32_t sizeThisTime = (frames <= s.blockLeft)?frames:s.blockLeft;
|
||||||
@ -149,6 +161,8 @@ void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEv
|
|||||||
s.blockLeft -= sizeThisTime;
|
s.blockLeft -= sizeThisTime;
|
||||||
if (s.blockLeft == 0) {
|
if (s.blockLeft == 0) {
|
||||||
s.blockLeft = 48000/238;
|
s.blockLeft = 48000/238;
|
||||||
|
doMidi(midiEvents, midiEventCount, 201);
|
||||||
|
|
||||||
printf("compute params and reset block size\n");
|
printf("compute params and reset block size\n");
|
||||||
}
|
}
|
||||||
if (s.framesLeft <= s.blockLeft) {
|
if (s.framesLeft <= s.blockLeft) {
|
||||||
@ -162,14 +176,6 @@ void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEv
|
|||||||
|
|
||||||
printf("and now run the rest of the process for %d frames\n\n", frames);
|
printf("and now run the rest of the process for %d frames\n\n", frames);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < midiEventCount; i++) {
|
|
||||||
if (MidiEvents[i].data[0] == 0x90) {
|
|
||||||
noteOn(MidiEvents[i].data[1]);
|
|
||||||
}
|
|
||||||
if (MidiEvents[i].data[0] == 0x80) {
|
|
||||||
noteOff(MidiEvents[i].data[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// run each synth voice
|
// run each synth voice
|
||||||
bzero(outputs[0], sizeof(float) * frames);
|
bzero(outputs[0], sizeof(float) * frames);
|
||||||
|
@ -60,12 +60,13 @@ class Chassis : public Plugin {
|
|||||||
// Processing
|
// Processing
|
||||||
void activate() override;
|
void activate() override;
|
||||||
void deactivate() override;
|
void deactivate() override;
|
||||||
void run(const float **, float **outputs, uint32_t frames, const MidiEvent *MidiEvents, uint32_t midiEventCount) override;
|
void run(const float **, float **outputs, uint32_t frames, const MidiEvent *midiEvents, uint32_t midiEventCount) override;
|
||||||
|
|
||||||
void noteOn(uint8_t note);
|
void noteOn(uint8_t note);
|
||||||
void noteOff(uint8_t note);
|
void noteOff(uint8_t note);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void doMidi(const MidiEvent *ev, uint32_t count, uint32_t timelimit ) ;
|
||||||
double sampleRate;
|
double sampleRate;
|
||||||
// Voice voice[NUM_VOICES];
|
// Voice voice[NUM_VOICES];
|
||||||
uint8_t vPtr;
|
uint8_t vPtr;
|
||||||
|
Loading…
Reference in New Issue
Block a user