feat(tracker): try to honor MIDI message timestamps

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2024-11-02 19:55:40 +02:00
parent 2aa0aaee0c
commit ee3ab3bf86
4 changed files with 74 additions and 26 deletions

View File

@ -33,7 +33,7 @@ func (m NullMIDIContext) Close() {}
func (m NullMIDIContext) HasDeviceOpen() bool { return false }
func (c *VSTIProcessContext) NextEvent() (event tracker.MIDINoteEvent, ok bool) {
func (c *VSTIProcessContext) NextEvent(frame int) (event tracker.MIDINoteEvent, ok bool) {
for c.eventIndex < len(c.events) {
ev := c.events[c.eventIndex]
c.eventIndex++
@ -53,6 +53,8 @@ func (c *VSTIProcessContext) NextEvent() (event tracker.MIDINoteEvent, ok bool)
return tracker.MIDINoteEvent{}, false
}
func (c *VSTIProcessContext) FinishBlock(frame int) {}
func (c *VSTIProcessContext) BPM() (bpm float64, ok bool) {
timeInfo := c.host.GetTimeInfo(vst2.TempoValid)
if timeInfo == nil || timeInfo.Flags&vst2.TempoValid == 0 || timeInfo.Tempo == 0 {