MIDI device start of implementation

This commit is contained in:
2025-11-16 21:44:48 +01:00
parent 19ec0bec74
commit 76b705012c
4 changed files with 43 additions and 12 deletions

View File

@@ -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")
}