yaw-shep bug fixes:

handle MIDI events at correct frame;
display cursor at correct position
This commit is contained in:
yaw-man 2022-10-29 16:20:27 -03:00
parent f60f589359
commit 994ff19596
2 changed files with 13 additions and 2 deletions

View File

@ -26,7 +26,7 @@ protected:
void initParameter(uint32_t index, Parameter& parameter) override void initParameter(uint32_t index, Parameter& parameter) override
{ {
parameter.hints = kParameterIsAutomable; parameter.hints = kParameterIsAutomatable;
parameter.ranges.def = 0.0f; parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f; parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f; parameter.ranges.max = 1.0f;
@ -86,10 +86,17 @@ protected:
const MidiEvent* midiEvents, uint32_t midiEventCount) override const MidiEvent* midiEvents, uint32_t midiEventCount) override
{ {
uint32_t currentFrame = 0;
if( midiEventCount > 1 )
{
currentFrame = 0;
}
for (uint32_t i = 0; i < midiEventCount; ++i) for (uint32_t i = 0; i < midiEventCount; ++i)
{ {
if (midiEvents[i].size <= 3) if (midiEvents[i].size <= 3)
{ {
uint8_t status = midiEvents[i].data[0]; uint8_t status = midiEvents[i].data[0];
uint8_t data = midiEvents[i].data[1] & 127; uint8_t data = midiEvents[i].data[1] & 127;
uint8_t velocity = midiEvents[i].data[2] & 127; uint8_t velocity = midiEvents[i].data[2] & 127;
@ -119,10 +126,13 @@ protected:
break; break;
} }
synth.process(*outputs, midiEvents[i].frame - currentFrame);
currentFrame = midiEvents[i].frame;
} }
} }
synth.process(*outputs, frames); synth.process(*outputs, frames - currentFrame);
fParameters[kHz] = synth.hzFund; fParameters[kHz] = synth.hzFund;
} }

View File

@ -42,6 +42,7 @@ void MouseUI::parameterChanged(uint32_t index, float value)
void MouseUI::uiIdle() void MouseUI::uiIdle()
{ {
repaint();
} }
bool MouseUI::onMouse(const MouseEvent &ev) bool MouseUI::onMouse(const MouseEvent &ev)