generated from thinkode/modelRepository
MIDI device start of implementation
This commit is contained in:
@@ -242,18 +242,19 @@ func (f *MIDIFinder) scanPeripherals(ctx context.Context) error {
|
||||
}
|
||||
|
||||
baseName := normalizeName(port.String())
|
||||
sn := strings.ReplaceAll(strings.ToLower(baseName), " ", "_")
|
||||
|
||||
if _, ok := currentMap[baseName]; !ok {
|
||||
currentMap[baseName] = &MIDIPeripheral{
|
||||
if _, ok := currentMap[sn]; !ok {
|
||||
currentMap[sn] = &MIDIPeripheral{
|
||||
info: PeripheralInfo{
|
||||
Name: baseName,
|
||||
SerialNumber: baseName,
|
||||
SerialNumber: sn,
|
||||
ProtocolName: "MIDI",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
currentMap[baseName].inputPorts = append(currentMap[baseName].inputPorts, port)
|
||||
currentMap[sn].inputPorts = append(currentMap[sn].inputPorts, port)
|
||||
log.Info().Any("peripherals", currentMap).Msg("available MIDI IN ports")
|
||||
}
|
||||
|
||||
@@ -270,17 +271,19 @@ func (f *MIDIFinder) scanPeripherals(ctx context.Context) error {
|
||||
}
|
||||
baseName := normalizeName(port.String())
|
||||
|
||||
if _, ok := currentMap[baseName]; !ok {
|
||||
currentMap[baseName] = &MIDIPeripheral{
|
||||
sn := strings.ReplaceAll(strings.ToLower(baseName), " ", "_")
|
||||
|
||||
if _, ok := currentMap[sn]; !ok {
|
||||
currentMap[sn] = &MIDIPeripheral{
|
||||
info: PeripheralInfo{
|
||||
Name: baseName,
|
||||
SerialNumber: baseName,
|
||||
SerialNumber: sn,
|
||||
ProtocolName: "MIDI",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
currentMap[baseName].outputsPorts = append(currentMap[baseName].outputsPorts, port)
|
||||
currentMap[sn].outputsPorts = append(currentMap[sn].outputsPorts, port)
|
||||
log.Info().Any("peripherals", currentMap).Msg("available MIDI OUT ports")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user