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

A eventType of RadioTrack that plays from a chosen AudioClip object. More...

Inheritance diagram for RyleRadio.Tracks.ClipRadioTrack:

Public Member Functions

override void Init ()
 Initializes this track. This needs to be called every time the clip is changed.
void ReadClipAndForceToMono ()
 Reads the clip into the Samples array, and combines its channels into one.
override float GetSample (int _sampleIndex)
 Gets a sample from the clip.
Public Member Functions inherited from RyleRadio.Tracks.RadioTrack
void Init ()
 Initializes this track.
float GetSample (int _sampleIndex)
 Gets a sample from the track.
virtual void AddToPlayerEndCallback (ref Action< RadioTrackPlayer > _callback)
 Activates an event to run whenever this track ends. This is mainly used for stations to switch track when the previous one ends.

Public Attributes

AudioClip clip
 The clip that this track plays.

Static Public Attributes

const string DISPLAY_NAME = "Audio Clip"
 The display name of this track in the editor. Required in RadioTrack.

Properties

float[] Samples [get, set]
 The individual samples of this clip, as it needs to be played sample-by-sample (a limitation of Unity's AudioClip)
bool IsInStation [get, set]
 Whether or not this is in a StationRadioTrack Required by IStationTrack.
Properties inherited from RyleRadio.Tracks.RadioTrack
float SampleRate [get, set]
 The sample rate of this track.
virtual int SampleCount [get, set]
 The number of samples in this track.

Detailed Description

A eventType of RadioTrack that plays from a chosen AudioClip object.

Definition at line 10 of file ClipRadioTrack.cs.

Member Function Documentation

◆ GetSample()

override float RyleRadio.Tracks.ClipRadioTrack.GetSample ( int _sampleIndex)

Gets a sample from the clip.

Parameters
_sampleIndexThe index of the sample
Returns
A sample from the clip at the given index

Implements RyleRadio.Tracks.IRadioTrack.

Definition at line 82 of file ClipRadioTrack.cs.

◆ Init()

override void RyleRadio.Tracks.ClipRadioTrack.Init ( )

Initializes this track. This needs to be called every time the clip is changed.

Implements RyleRadio.Tracks.IRadioTrack.

Definition at line 37 of file ClipRadioTrack.cs.

◆ ReadClipAndForceToMono()

void RyleRadio.Tracks.ClipRadioTrack.ReadClipAndForceToMono ( )

Reads the clip into the Samples array, and combines its channels into one.

We need to flatten the clip into one channel to play it from a RadioOutput as the Output is only using one channel. Theoretically, we could expand the Output to use multiple channels, but given this would be the only track eventType to do this it's probably not worth the significant effort.
For the moment, we'll treat Outputs as AM radios (which are mono in real life)

Definition at line 51 of file ClipRadioTrack.cs.

Referenced by Init().

Member Data Documentation

◆ clip

AudioClip RyleRadio.Tracks.ClipRadioTrack.clip

The clip that this track plays.

Definition at line 20 of file ClipRadioTrack.cs.

Referenced by Init(), and ReadClipAndForceToMono().

◆ DISPLAY_NAME

const string RyleRadio.Tracks.ClipRadioTrack.DISPLAY_NAME = "Audio Clip"
static

The display name of this track in the editor. Required in RadioTrack.

Definition at line 15 of file ClipRadioTrack.cs.

Property Documentation

◆ IsInStation

bool RyleRadio.Tracks.ClipRadioTrack.IsInStation
getset

Whether or not this is in a StationRadioTrack Required by IStationTrack.

Implements RyleRadio.Tracks.IStationTrack.

Definition at line 31 of file ClipRadioTrack.cs.

◆ Samples

float [] RyleRadio.Tracks.ClipRadioTrack.Samples
getsetprotected

The individual samples of this clip, as it needs to be played sample-by-sample (a limitation of Unity's AudioClip)

Definition at line 25 of file ClipRadioTrack.cs.

Referenced by GetSample(), Init(), and ReadClipAndForceToMono().


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