Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set midi messages timestamp relative to buffer start #259

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

DamRsn
Copy link
Contributor

@DamRsn DamRsn commented Oct 5, 2023

ExternalPlugin: Fix MIDI Message Timestamps

Problem

In external plugins, MIDI messages are timestamped relative to the start of the full audio sequence, causing issues when handling note_on or note_off messages with timestamps greater than the bufferSize. This results in notes not being played or not stopped as expected.

Solution

To resolve this issue, I modified the renderMIDIMessages() function in the ExternalPlugin module. The sampleDeltaToAdd argument in midiChunk.addEvents() is changed from 0 to -i, ensuring that each MIDI event is timestamped according to the start of the current buffer and not the entire sequence.

Result

After this change, MIDI messages will have timestamps relative to the start of the current processBlock buffer, allowing external plugins to handle them correctly.

This change addresses the issue reported in #258

@psobot psobot merged commit ce16742 into spotify:master Oct 6, 2023
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants