37 public override void Init()
53 float[] allSamples =
new float[clip.samples *
clip.channels];
57 if (!
clip.GetData(allSamples, 0))
59 Debug.LogError(
"Cannot access clip data from track " +
clip.name);
64 for (
int sample = 0; sample <
clip.samples; sample++)
69 for (
int channel = 0; channel <
clip.channels; channel++)
70 combined += allSamples[(sample *
clip.channels) + channel];
72 combined /=
clip.channels;
A eventType of RadioTrack that plays from a chosen AudioClip object.
bool IsInStation
Whether or not this is in a StationRadioTrack Required by IStationTrack.
override void Init()
Initializes this track. This needs to be called every time the clip is changed.
AudioClip clip
The clip that this track plays.
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.
const string DISPLAY_NAME
The display name of this track in the editor. Required in RadioTrack.
float[] Samples
The individual samples of this clip, as it needs to be played sample-by-sample (a limitation of Unity...
A track to play as part of a radio. These are the fundamental objects that define the content of the ...
float SampleRate
The sample rate of this track.
virtual int SampleCount
The number of samples in this track.
A RadioTrack that can be played as part of a station.
Tracks to be used on a radio- includes base classes.