mirror of
https://github.com/vsariola/sointu.git
synced 2026-02-13 19:53:16 -05:00
drafting
This commit is contained in:
parent
f765d75fde
commit
2303e89bbd
@ -14,8 +14,6 @@ type (
|
||||
triggerChannel int
|
||||
lengthInBeats int
|
||||
bpm int
|
||||
|
||||
broker *Broker
|
||||
}
|
||||
|
||||
RingBuffer[T any] struct {
|
||||
@ -55,9 +53,8 @@ func (r *RingBuffer[T]) WriteOnceSingle(value T) {
|
||||
}
|
||||
}
|
||||
|
||||
func NewScopeModel(broker *Broker, bpm int) *ScopeModel {
|
||||
func NewScopeModel(bpm int) *ScopeModel {
|
||||
s := &ScopeModel{
|
||||
broker: broker,
|
||||
bpm: bpm,
|
||||
lengthInBeats: 4,
|
||||
}
|
||||
@ -96,10 +93,6 @@ func (s *ScopeModel) ProcessAudioBuffer(bufPtr *sointu.AudioBuffer) {
|
||||
} else {
|
||||
s.waveForm.WriteOnce(*bufPtr)
|
||||
}
|
||||
// chain the messages: when we have a new audio buffer, try passing it on to the detector
|
||||
if !TrySend(s.broker.ToDetector, MsgToDetector{Data: bufPtr}) {
|
||||
s.broker.PutAudioBuffer(bufPtr)
|
||||
}
|
||||
}
|
||||
|
||||
// Note: channel 1 is the first channel
|
||||
@ -116,7 +109,6 @@ func (s *ScopeModel) Reset() {
|
||||
l := len(s.waveForm.Buffer)
|
||||
s.waveForm.Buffer = s.waveForm.Buffer[:0]
|
||||
s.waveForm.Buffer = append(s.waveForm.Buffer, make([][2]float32, l)...)
|
||||
TrySend(s.broker.ToDetector, MsgToDetector{Reset: true}) // chain the messages: when the signal analyzer is reset, also reset the detector
|
||||
}
|
||||
|
||||
func (s *ScopeModel) SetBpm(bpm int) {
|
||||
|
||||
Reference in New Issue
Block a user