|
- package mpx
-
- // Combiner defines the interface used to merge MPX primitives into a composite waveform.
- type Combiner interface {
- Combine(mono, stereo, pilot, rds float64) float64
- }
-
- // DefaultCombiner combines components with configurable gains.
- type DefaultCombiner struct {
- MonoGain float64
- StereoGain float64
- PilotGain float64
- RDSGain float64
- }
-
- // NewDefaultCombiner creates a combiner with sane default gains.
- func NewDefaultCombiner() DefaultCombiner {
- return DefaultCombiner{
- MonoGain: 1,
- StereoGain: 1,
- PilotGain: 1,
- RDSGain: 1,
- }
- }
-
- // Combine merges the provided MPX components.
- func (c DefaultCombiner) Combine(mono, stereo, pilot, rds float64) float64 {
- return c.MonoGain*mono + c.StereoGain*stereo + c.PilotGain*pilot + c.RDSGain*rds
- }
|