feat: midi note input for the tracker

This commit is contained in:
qm210
2024-10-21 22:00:50 +02:00
committed by Veikko Sariola
parent 216cde2365
commit 8dfadacafe
17 changed files with 299 additions and 63 deletions

View File

@ -78,9 +78,10 @@ type (
synther sointu.Synther // the synther used to create new synths
PlayerMessages chan PlayerMsg
modelMessages chan<- interface{}
ModelMessages chan<- interface{}
MIDI MIDIContext
MIDI MIDIContext
trackMidiIn bool
}
// Cursor identifies a row and a track in a song score.
@ -130,6 +131,7 @@ type (
MIDIContext interface {
InputDevices(yield func(MIDIDevice) bool)
Close()
HasDeviceOpen() bool
}
MIDIDevice interface {
@ -183,9 +185,10 @@ func NewModelPlayer(synther sointu.Synther, midiContext MIDIContext, recoveryFil
m := new(Model)
m.synther = synther
m.MIDI = midiContext
m.trackMidiIn = midiContext.HasDeviceOpen()
modelMessages := make(chan interface{}, 1024)
playerMessages := make(chan PlayerMsg, 1024)
m.modelMessages = modelMessages
m.ModelMessages = modelMessages
m.PlayerMessages = playerMessages
m.d.Octave = 4
m.linkInstrTrack = true
@ -421,7 +424,7 @@ func (m *Model) resetSong() {
// send sends a message to the player
func (m *Model) send(message interface{}) {
m.modelMessages <- message
m.ModelMessages <- message
}
func (m *Model) maxID() int {