-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathchannelstate.go
More file actions
74 lines (59 loc) · 1.72 KB
/
Copy pathchannelstate.go
File metadata and controls
74 lines (59 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package playback
import (
"github.com/gotracker/playback/mixing/sampling"
"github.com/gotracker/playback/instrument"
"github.com/gotracker/playback/voice/types"
)
// ChannelState is the information needed to make an instrument play
type ChannelState[TPeriod types.Period, TVolume types.Volume, TPanning types.Panning] struct {
inst instrument.InstrumentIntf
period TPeriod
vol TVolume
pos sampling.Pos
pan TPanning
}
// Reset sets the render state to defaults
func (s *ChannelState[TPeriod, TVolume, TPanning]) Reset() {
s.inst = nil
var emptyPeriod TPeriod
s.period = emptyPeriod
s.pos = sampling.Pos{}
var emptyPan TPanning
s.pan = emptyPan
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) GetVolume() TVolume {
return s.vol
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) SetVolume(vol TVolume) {
if !vol.IsUseInstrumentVol() {
s.vol = vol
}
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) NoteCut() {
var empty TPeriod
s.period = empty
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) Instrument() instrument.InstrumentIntf {
return s.inst
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) SetInstrument(inst instrument.InstrumentIntf) {
s.inst = inst
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) Period() TPeriod {
return s.period
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) SetPeriod(p TPeriod) {
s.period = p
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) Pos() sampling.Pos {
return s.pos
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) SetPos(pos sampling.Pos) {
s.pos = pos
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) Pan() TPanning {
return s.pan
}
func (s *ChannelState[TPeriod, TVolume, TPanning]) SetPan(p TPanning) {
s.pan = p
}