mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-14 02:54:37 -04:00
fix(sointu-vsti): VST crashed due to Model.MIDI being nil
This commit is contained in:
parent
c07d8000c6
commit
f427eca1f4
@ -17,12 +17,22 @@ import (
|
||||
"pipelined.dev/audio/vst2"
|
||||
)
|
||||
|
||||
type VSTIProcessContext struct {
|
||||
events []vst2.MIDIEvent
|
||||
eventIndex int
|
||||
host vst2.Host
|
||||
type (
|
||||
VSTIProcessContext struct {
|
||||
events []vst2.MIDIEvent
|
||||
eventIndex int
|
||||
host vst2.Host
|
||||
}
|
||||
|
||||
NullMIDIContext struct{}
|
||||
)
|
||||
|
||||
func (m *NullMIDIContext) ListInputDevices() func(yield func(tracker.MIDIDevice) bool) {
|
||||
return func(yield func(tracker.MIDIDevice) bool) {}
|
||||
}
|
||||
|
||||
func (m *NullMIDIContext) Close() {}
|
||||
|
||||
func (c *VSTIProcessContext) NextEvent() (event tracker.MIDINoteEvent, ok bool) {
|
||||
for c.eventIndex < len(c.events) {
|
||||
ev := c.events[c.eventIndex]
|
||||
@ -63,6 +73,8 @@ func init() {
|
||||
recoveryFile = filepath.Join(configDir, "sointu", "sointu-vsti-recovery-"+hex.EncodeToString(randBytes))
|
||||
}
|
||||
model, player := tracker.NewModelPlayer(cmd.MainSynther, recoveryFile)
|
||||
model.MIDI = &NullMIDIContext{}
|
||||
|
||||
t := gioui.NewTracker(model)
|
||||
tracker.Bool{BoolData: (*tracker.InstrEnlarged)(model)}.Set(true)
|
||||
go t.Main()
|
||||
|
Reference in New Issue
Block a user