Skip to content

Commit c3df97d

Browse files
committed
move device value struct to specific file
1 parent 8bc0af8 commit c3df97d

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

core/music/device_value.go

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package music
2+
3+
import (
4+
"signls/midi"
5+
)
6+
7+
type DeviceValue struct {
8+
Device midi.Device
9+
GridDevice *midi.Device
10+
Enabled bool
11+
}
12+
13+
func (d DeviceValue) Get() int {
14+
if d.Enabled {
15+
return d.Device.ID
16+
}
17+
return d.GridDevice.ID
18+
}
19+
20+
func (d DeviceValue) Name() string {
21+
if d.Enabled {
22+
return d.Device.Name
23+
}
24+
return ""
25+
}

core/music/note.go

-20
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,6 @@ const (
2929

3030
var lastUsedChannel uint8 = defaultChannel
3131

32-
type DeviceValue struct {
33-
Device midi.Device
34-
GridDevice *midi.Device
35-
Enabled bool
36-
}
37-
38-
func (d DeviceValue) Get() int {
39-
if d.Enabled {
40-
return d.Device.ID
41-
}
42-
return d.GridDevice.ID
43-
}
44-
45-
func (d DeviceValue) Name() string {
46-
if d.Enabled {
47-
return d.Device.Name
48-
}
49-
return ""
50-
}
51-
5232
// Note represents a midi note.
5333
type Note struct {
5434
midi midi.Midi

0 commit comments

Comments
 (0)