feat(tracker): oscilloscope and LUFS / true peak detection

In addition to the oscilloscope and loudness/peak detections, this
commit refactors all the channels between components (i.e.
ModelMessages and PlayerMessages) etc. into a new class Broker. This
was done because now we have one more goroutine running: a Detector,
where the loudness / true peak detection is done in another thread.
The different threads/components are only aware of the Broker and
communicate through it. Currently, it's just a collection of
channels, so it's many-to-one communication, but in the future,
we could change Broker to have many-to-one-to-many communication.

Related to #61
This commit is contained in:
5684185+vsariola@users.noreply.github.com
2024-11-02 15:04:19 +02:00
parent 86c65939bb
commit ec222bd67d
16 changed files with 945 additions and 174 deletions

View File

@ -23,6 +23,8 @@ func (NullContext) BPM() (bpm float64, ok bool) {
func (NullContext) InputDevices(yield func(tracker.MIDIDevice) bool) {}
func (NullContext) HasDeviceOpen() bool { return false }
func (NullContext) Close() {}
type modelFuzzState struct {
@ -260,7 +262,9 @@ func FuzzModel(f *testing.F) {
f.Fuzz(func(t *testing.T, slice []byte) {
reader := bytes.NewReader(slice)
synther := vm.GoSynther{}
model, player := tracker.NewModelPlayer(synther, NullContext{}, "")
broker := tracker.NewBroker()
defer broker.Close()
model, player := tracker.NewModelPlayer(broker, synther, NullContext{}, "")
buf := make([][2]float32, 2048)
closeChan := make(chan struct{})
go func() {