package rds // RDSConfig holds configuration data used to build the RDS data stream. // Covers IEC 62106 groups 0A, 2A, 3A, 4A, 10A, 11A, 14A (everything except TMC/EWS). type RDSConfig struct { // --- Group 0A: Basic tuning & switching --- // Program Identification – 16-bit station identifier. PI uint16 // Program Service name (8 ASCII characters, padded with spaces). PS string // Program Type (0-31 standard RDS PTY values). PTY uint8 // Traffic Program (TP) — this station carries traffic announcements. TP bool // Traffic Announcement (TA) — a traffic announcement is currently on air. // When TA transitions to true, receivers with TP-seek interrupt CD/other media. TA bool // Music/Speech switch: true = music, false = speech. // Receivers may adjust EQ or display accordingly. MS bool // Decoder Identification (DI): 4-bit field sent across 4 group 0A segments. // bit 0 (d3): stereo (1) vs mono (0) // bit 1 (d2): artificial head (1) vs normal (0) // bit 2 (d1): compressed (1) vs not (0) // bit 3 (d0): dynamic PTY (1) vs static (0) DI uint8 // Alternative Frequencies list. Up to 25 frequencies in MHz (e.g. 93.3, 95.7). // Transmitted in group 0A block C (two AF codes per group). // Enables automatic retuning when signal weakens. AF []float64 // --- Group 2A: RadioText --- // RadioText (up to 64 characters). Current song, info, etc. RT string // --- Group 4A: Clock-Time & Date --- // CTEnabled: transmit UTC clock-time once per minute. CTEnabled bool // CTOffsetHalfHours: local time offset from UTC in half-hours (-24..+24). // E.g. CET = +2, CEST = +4. Auto-detected from OS if zero. CTOffsetHalfHours int8 // --- Group 10A: Program Type Name --- // PTYN: 8-character custom label for the program type. // Overrides the standard PTY label on receivers that support it. // Empty = don't transmit group 10A. PTYN string // --- Group 11A + 3A: RT+ (RadioText Plus) --- // RTPlusEnabled: automatically parse RT into semantic tags (artist, title, etc.) // and transmit RT+ groups (11A) with ODA announcements (3A). RTPlusEnabled bool // RTPlusSeparator: string used to split RT into artist/title. // Default "-". E.g. "Depeche Mode - Enjoy The Silence" → artist/title. RTPlusSeparator string // --- Group 14A/14B: Enhanced Other Networks (EON) --- // EON: information about other stations in the network. // Enables cross-station TA switching and AF lists for other programs. EON []EONEntry // --- Encoder internal --- // SampleRate that the encoder will work against. Defaults to 228000 when zero. SampleRate float64 } // EONEntry describes another station in the network for EON (group 14A/14B). type EONEntry struct { PI uint16 // Program Identification of the other station PS string // Program Service name (8 chars) PTY uint8 // Program Type TP bool // Traffic Program flag TA bool // Traffic Announcement flag (live-updated for cross-TA switching) AF []float64 // Alternative Frequencies for the other station } // DefaultConfig returns a minimal config with sane defaults. func DefaultConfig() RDSConfig { return RDSConfig{ PI: 0x1234, PS: "FM-RDS", RT: "Go-based MPX", PTY: 0, TP: false, TA: false, MS: true, // music by default DI: 0x01, // stereo CTEnabled: true, RTPlusEnabled: true, RTPlusSeparator: " - ", SampleRate: 228000, } }