Game.Settings.RadioSettings
Assembly: Assembly-CSharp
Namespace: Game.Settings
Type: class
Base: Setting
Summary:
RadioSettings stores and manages user-configurable audio spectrum and equalizer visualization options for the in-game radio. It is persisted under the "Settings" file location (via the FileLocation attribute) and, when applied, forwards the settings to the runtime Radio instance (AudioManager.instance.radio). Many properties are marked with [SettingsUIHidden], meaning they are not shown in the standard settings UI and are intended for programmatic or internal use.
Fields
private Radio m_Radio
Holds a cached reference to the runtime Radio instance (AudioManager.instance.radio). It is populated lazily in Apply() if null and used to call SetSpectrumSettings on the active radio.
Properties
-
public bool enableSpectrum { get; set; }
Whether the audio spectrum/equalizer visualization is enabled. Default: false. Marked [SettingsUIHidden]. -
public int spectrumNumSamples { get; set; }
Number of samples to use for the FFT when computing the spectrum. Common values are powers of two. Default: 1024. Marked [SettingsUIHidden]. -
public FFTWindow fftWindowType { get; set; }
Type of FFT window to use (from UnityEngine.FFTWindow). Default: FFTWindow.BlackmanHarris. Affects spectral leakage and frequency resolution. Marked [SettingsUIHidden]. -
public Radio.Spectrum.BandType bandType { get; set; }
Spectrum band configuration used by the Radio.Spectrum (for example TenBand). Default: Radio.Spectrum.BandType.TenBand. Marked [SettingsUIHidden]. -
public float equalizerBarSpacing { get; set; }
Horizontal spacing (in UI units) between equalizer bars. Default: 10.2f. Marked [SettingsUIHidden]. -
public float equalizerSidesPadding { get; set; }
Padding at the sides of the equalizer visualization. Default: 4f. Marked [SettingsUIHidden].
Constructors
public RadioSettings()
Constructs a new instance and initializes properties by calling SetDefaults().
Methods
public override void SetDefaults() : System.Void
Sets default values for all stored settings:- spectrumNumSamples = 1024
- enableSpectrum = false
- fftWindowType = FFTWindow.BlackmanHarris
- bandType = Radio.Spectrum.BandType.TenBand
- equalizerBarSpacing = 10.2f
-
equalizerSidesPadding = 4f
-
public override void Apply() : System.Void
Applies the stored settings to the runtime radio: - Ensures a reference to AudioManager.instance.radio is cached in m_Radio (lazily).
- If a Radio instance is available, calls m_Radio.SetSpectrumSettings(enableSpectrum, spectrumNumSamples, fftWindowType, bandType, equalizerBarSpacing, equalizerSidesPadding). This updates the radio's visualization/equalizer behavior at runtime.
Usage Example
// Typical usage: instantiate or load settings, then apply to the running radio.
var settings = new Game.Settings.RadioSettings();
// Optionally modify values (these properties are hidden from the default settings UI)
settings.enableSpectrum = true;
settings.spectrumNumSamples = 2048;
settings.fftWindowType = UnityEngine.FFTWindow.Hamming;
settings.bandType = Game.Audio.Radio.Spectrum.BandType.TenBand;
settings.equalizerBarSpacing = 12f;
settings.equalizerSidesPadding = 5f;
// Persisted settings would normally be saved/loaded by the game's settings system.
// To immediately push changes to the active Radio instance:
settings.Apply();
Notes: - The FileLocation attribute ([FileLocation("Settings")]) indicates this class is saved in the game's Settings location; integration with the game's settings persistence will handle loading/saving instances. - Because many properties are marked [SettingsUIHidden], they may not appear in user-facing settings panels; modify them programmatically or via custom UI if needed. - FFTWindow is the Unity enum controlling windowing function for FFT; choose a window based on desired tradeoffs between frequency resolution and spectral leakage.