Go-based FM stereo transmitter with RDS, Windows-first and cross-platform
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

30 рядки
777B

  1. package mpx
  2. // Combiner defines the interface used to merge MPX primitives into a composite waveform.
  3. type Combiner interface {
  4. Combine(mono, stereo, pilot, rds float64) float64
  5. }
  6. // DefaultCombiner combines components with configurable gains.
  7. type DefaultCombiner struct {
  8. MonoGain float64
  9. StereoGain float64
  10. PilotGain float64
  11. RDSGain float64
  12. }
  13. // NewDefaultCombiner creates a combiner with sane default gains.
  14. func NewDefaultCombiner() DefaultCombiner {
  15. return DefaultCombiner{
  16. MonoGain: 1,
  17. StereoGain: 1,
  18. PilotGain: 1,
  19. RDSGain: 1,
  20. }
  21. }
  22. // Combine merges the provided MPX components.
  23. func (c DefaultCombiner) Combine(mono, stereo, pilot, rds float64) float64 {
  24. return c.MonoGain*mono + c.StereoGain*stereo + c.PilotGain*pilot + c.RDSGain*rds
  25. }