From c3df97d8756fa1a53aea97428c24e8880c72858a Mon Sep 17 00:00:00 2001 From: Xavier Godart Date: Tue, 24 Dec 2024 15:47:18 +0100 Subject: [PATCH] move device value struct to specific file --- core/music/device_value.go | 25 +++++++++++++++++++++++++ core/music/note.go | 20 -------------------- 2 files changed, 25 insertions(+), 20 deletions(-) create mode 100644 core/music/device_value.go diff --git a/core/music/device_value.go b/core/music/device_value.go new file mode 100644 index 0000000..59bf2b4 --- /dev/null +++ b/core/music/device_value.go @@ -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 "" +} diff --git a/core/music/note.go b/core/music/note.go index 6e2376f..34a7a6d 100644 --- a/core/music/note.go +++ b/core/music/note.go @@ -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