Skip to content

Commit

Permalink
move device value struct to specific file
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviergodart committed Dec 24, 2024
1 parent 8bc0af8 commit c3df97d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
25 changes: 25 additions & 0 deletions core/music/device_value.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package music

import (
"signls/midi"
)

type DeviceValue struct {
Device midi.Device
GridDevice *midi.Device
Enabled bool
}

func (d DeviceValue) Get() int {
if d.Enabled {
return d.Device.ID
}
return d.GridDevice.ID
}

func (d DeviceValue) Name() string {
if d.Enabled {
return d.Device.Name
}
return ""
}
20 changes: 0 additions & 20 deletions core/music/note.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,6 @@ const (

var lastUsedChannel uint8 = defaultChannel

type DeviceValue struct {
Device midi.Device
GridDevice *midi.Device
Enabled bool
}

func (d DeviceValue) Get() int {
if d.Enabled {
return d.Device.ID
}
return d.GridDevice.ID
}

func (d DeviceValue) Name() string {
if d.Enabled {
return d.Device.Name
}
return ""
}

// Note represents a midi note.
type Note struct {
midi midi.Midi
Expand Down

0 comments on commit c3df97d

Please sign in to comment.