Ryle Radio 1.0.0
An open-source "radio" system for Unity, allowing tracks, tuning, broadcasters, and more!
Loading...
Searching...
No Matches
RyleRadio.RadioData Class Reference

The central data object defining the radio. Contains the tracks and information required to play the radio at runtime.

Has a custom editor at RadioDataEditor. More...

Inheritance diagram for RyleRadio.RadioData:

Public Member Functions

void Init ()
 Initialise this radio, its tracks, and referenced components.
void ClearCache ()
 Clears track names and IDs.
bool TryGetTrack (string _idOrName, out RadioTrackWrapper _trackW, bool _useID=true)
 Attempts to find a track in this radio using either an ID or a name.

Static Public Member Functions

static string NameToID (string _name)
 Converts a track's name to ID format.

Static Public Attributes

const float LOW_TUNE = 0
 The lower limit for tune on this radio. This may become non-const at some point.
const float HIGH_TUNE = 1000
 The upper limit for tune on this radio. This may become non-const at some point.

Properties

Color GizmoColor [get]
 Alias for gizmoColor for safety.
Color GizmoColorSecondary [get]
 Alias for gizmoColorSecondary for safety.
List< RadioTrackWrapperTrackWrappers [get]
 Alias for trackWs for safety- in documentation we usually call them the tracks, but for code clarity we explicitly call them wrappers in this object.
Action< RadioDataOnInit = new(_ => { }) [get, set]
 Event invoked when Init() is called.
Action< RadioDataBeforeInit = new(_ => { }) [get, set]
 Event invoked when Init() is called, but at the beginning before anything happens.
List< string > TrackNames [get]
 The names of all tracks stored in this radio, used when selecting them in the inspector.
List< string > TrackIDs [get]

Private Member Functions

void PopulateTrackIDs ()
 Fills TrackNames and TrackIDs to match the current content of trackWs.
void OnValidate ()
 Updates the track names and IDs when this object is changed.

Private Attributes

Color gizmoColor = new Color32(200, 180, 255, 255)
 The primary colour of gizmos relating to this radio.
Color gizmoColorSecondary = new Color32(175, 105, 205, 255)
 The secondary colour of gizmos relating to this radio.
bool forceClipSampleRate = true
 Whether or not this radio forces the sample rate on AudioClips it references.
int forcedSampleRate = 0
 The sample rate this radio can force on AudioClips it references. If left at 0, it chooses the project's default sample rate.
List< RadioTrackWrappertrackWs = new() { new() }
 The tracks contained in this radio, editable in the inspector.
List< string > trackIDs
 The IDs of all tracks stored in this radio.

Detailed Description

The central data object defining the radio. Contains the tracks and information required to play the radio at runtime.

Has a custom editor at RadioDataEditor.

Definition at line 17 of file RadioData.cs.

Member Function Documentation

◆ ClearCache()

void RyleRadio.RadioData.ClearCache ( )

Clears track names and IDs.

Definition at line 166 of file RadioData.cs.

◆ Init()

void RyleRadio.RadioData.Init ( )

Initialise this radio, its tracks, and referenced components.

Definition at line 152 of file RadioData.cs.

◆ NameToID()

string RyleRadio.RadioData.NameToID ( string _name)
static

Converts a track's name to ID format.

Parameters
_nameThe name to convert
Returns
The name transformed into ID format

Definition at line 97 of file RadioData.cs.

Referenced by TryGetTrack().

◆ OnValidate()

void RyleRadio.RadioData.OnValidate ( )
private

Updates the track names and IDs when this object is changed.

Definition at line 144 of file RadioData.cs.

◆ PopulateTrackIDs()

void RyleRadio.RadioData.PopulateTrackIDs ( )
private

Fills TrackNames and TrackIDs to match the current content of trackWs.

Definition at line 105 of file RadioData.cs.

Referenced by OnValidate().

◆ TryGetTrack()

bool RyleRadio.RadioData.TryGetTrack ( string _idOrName,
out RadioTrackWrapper _trackW,
bool _useID = true )

Attempts to find a track in this radio using either an ID or a name.

Parameters
_idOrNameThe ID or name of the track to find
_trackWThe track that has been found, or null if none was found
_useIDIf true, this method searches for a matching ID. If false, it searches for a matching name
Returns
True if a track was found, false if not

Definition at line 179 of file RadioData.cs.

Member Data Documentation

◆ forceClipSampleRate

bool RyleRadio.RadioData.forceClipSampleRate = true
private

Whether or not this radio forces the sample rate on AudioClips it references.

Definition at line 31 of file RadioData.cs.

◆ forcedSampleRate

int RyleRadio.RadioData.forcedSampleRate = 0
private

The sample rate this radio can force on AudioClips it references. If left at 0, it chooses the project's default sample rate.

Definition at line 33 of file RadioData.cs.

◆ gizmoColor

Color RyleRadio.RadioData.gizmoColor = new Color32(200, 180, 255, 255)
private

The primary colour of gizmos relating to this radio.

Definition at line 26 of file RadioData.cs.

◆ gizmoColorSecondary

Color RyleRadio.RadioData.gizmoColorSecondary = new Color32(175, 105, 205, 255)
private

The secondary colour of gizmos relating to this radio.

Definition at line 28 of file RadioData.cs.

◆ HIGH_TUNE

const float RyleRadio.RadioData.HIGH_TUNE = 1000
static

The upper limit for tune on this radio. This may become non-const at some point.

Definition at line 23 of file RadioData.cs.

◆ LOW_TUNE

const float RyleRadio.RadioData.LOW_TUNE = 0
static

The lower limit for tune on this radio. This may become non-const at some point.

Definition at line 21 of file RadioData.cs.

◆ trackIDs

List<string> RyleRadio.RadioData.trackIDs
private

The IDs of all tracks stored in this radio.

Definition at line 78 of file RadioData.cs.

Referenced by PopulateTrackIDs().

◆ trackWs

List<RadioTrackWrapper> RyleRadio.RadioData.trackWs = new() { new() }
private

The tracks contained in this radio, editable in the inspector.

Definition at line 38 of file RadioData.cs.

Referenced by PopulateTrackIDs().

Property Documentation

◆ BeforeInit

Action<RadioData> RyleRadio.RadioData.BeforeInit = new(_ => { })
getset

Event invoked when Init() is called, but at the beginning before anything happens.

Definition at line 53 of file RadioData.cs.

Referenced by Init().

◆ GizmoColor

Color RyleRadio.RadioData.GizmoColor
get

Alias for gizmoColor for safety.

Definition at line 42 of file RadioData.cs.

◆ GizmoColorSecondary

Color RyleRadio.RadioData.GizmoColorSecondary
get

Alias for gizmoColorSecondary for safety.

Definition at line 44 of file RadioData.cs.

◆ OnInit

Action<RadioData> RyleRadio.RadioData.OnInit = new(_ => { })
getset

Event invoked when Init() is called.

Definition at line 51 of file RadioData.cs.

Referenced by Init().

◆ TrackIDs

List<string> RyleRadio.RadioData.TrackIDs
get

Definition at line 79 of file RadioData.cs.

◆ TrackNames

List<string> RyleRadio.RadioData.TrackNames
get

The names of all tracks stored in this radio, used when selecting them in the inspector.

Definition at line 63 of file RadioData.cs.

Referenced by ClearCache().

◆ TrackWrappers

List<RadioTrackWrapper> RyleRadio.RadioData.TrackWrappers
get

Alias for trackWs for safety- in documentation we usually call them the tracks, but for code clarity we explicitly call them wrappers in this object.

Definition at line 47 of file RadioData.cs.

Referenced by Init(), PopulateTrackIDs(), and TryGetTrack().


The documentation for this class was generated from the following file: