Ryle Radio 1.0.0
An open-source "radio" system for Unity, allowing tracks, tuning, broadcasters, and more!
Loading...
Searching...
No Matches
IRadioTrack.cs
1using System;
2
3namespace RyleRadio.Tracks
4{
5
6 // internal interface for radiotracks, mainly kept for the purpose of logic issues
7 // tracks for stations can be accessed with an interface, so we should do the same with tracks in general
8
9
10
11 // use the RadioTrack class if you're making custom tracks
12 /// <summary>
13 /// Internal interface for a \ref RadioTrack
14 /// </summary>
15 /// <remarks>
16 /// <i>truth be told i can't fully remember why i have this and RadioTrack as separate entities- i do know that i went through a lot of effort to make
17 ///this layout work, though, and so for the moment i'm keeping it in- however if it turns out to be ultimately useless and can be deprecated without
18 ///issue i'm happy to say goodbye to it</i>
19 ///</remarks>
20 public interface IRadioTrack
21 {
22 /// <summary>
23 /// The samples per second of this track right now. Can be changed at runtime, e.g: StationRadioTrack
24 /// </summary>
25 public abstract float SampleRate { get; set; }
26
27 /// <summary>
28 /// The total number of samples in this track right now. Can be changed at runtime, e.g: StationRadioTrack
29 /// </summary>
30 public abstract int SampleCount { get; set; }
31
32 /// <summary>
33 /// Initializes this track.
34 /// </summary>
35 public abstract void Init();
36
37 /// <summary>
38 /// Get a sample at the provided index. This is the core method of a track- whatever you return here defines the audio that the track will play when selected
39 /// </summary>
40 /// <param name="_sampleIndex">The index of the sample to get</param>
41 /// <returns>The sample- a value between -1 and 1 representing the y-value of the sound wave</returns>
42 public abstract float GetSample(int _sampleIndex);
43
44 /// <summary>
45 /// Update a RadioTrackPlayer when this current track ends. Used in StationRadioTrack.
46 ///
47 /// <b>See also:</b> \ref RadioTrackPlayer.OnEnd, \ref StationRadioTrack.AddToPlayerEndCallback()
48 /// </summary>
49 /// <param name="_callback">The function to run when the track ends</param>
50 public virtual void AddToPlayerEndCallback(ref Action<RadioTrackPlayer> _callback) { }
51 }
52
53}
Internal interface for a RadioTrack.
float SampleRate
The samples per second of this track right now. Can be changed at runtime, e.g: StationRadioTrack.
float GetSample(int _sampleIndex)
Get a sample at the provided index. This is the core method of a track- whatever you return here defi...
void Init()
Initializes this track.
int SampleCount
The total number of samples in this track right now. Can be changed at runtime, e....
virtual void AddToPlayerEndCallback(ref Action< RadioTrackPlayer > _callback)
Update a RadioTrackPlayer when this current track ends. Used in StationRadioTrack.
Tracks to be used on a radio- includes base classes.
Definition RadioUtils.cs:20