mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-22 15:04:36 -04:00
feat(tracker): compile with midi support only when CGO is available
Also add the midi context to the VSTI, so VSTI can use MIDI if they wish so.
This commit is contained in:
parent
3881b8eb22
commit
602b3b05cc
@ -24,16 +24,8 @@ type (
|
||||
eventIndex int
|
||||
host vst2.Host
|
||||
}
|
||||
|
||||
NullMIDIContext struct{}
|
||||
)
|
||||
|
||||
func (m NullMIDIContext) InputDevices(yield func(tracker.MIDIDevice) bool) {}
|
||||
|
||||
func (m NullMIDIContext) Close() {}
|
||||
|
||||
func (m NullMIDIContext) HasDeviceOpen() bool { return false }
|
||||
|
||||
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 {
|
||||
@ -54,7 +46,7 @@ func init() {
|
||||
recoveryFile = filepath.Join(configDir, "sointu", "sointu-vsti-recovery-"+hex.EncodeToString(randBytes))
|
||||
}
|
||||
broker := tracker.NewBroker()
|
||||
model := tracker.NewModel(broker, cmd.MainSynther, NullMIDIContext{}, recoveryFile)
|
||||
model := tracker.NewModel(broker, cmd.MainSynther, cmd.NewMidiContext(broker), recoveryFile)
|
||||
player := tracker.NewPlayer(broker, cmd.MainSynther)
|
||||
detector := tracker.NewDetector(broker)
|
||||
go detector.Run()
|
||||
|
Reference in New Issue
Block a user