Class IntroloopAudio
An asset file for use with IntroloopPlayer. Contains an information where should the audio loop so the player can schedule the seams ahead of time.
Inheritance
System.Object
UnityEngine.Object
UnityEngine.ScriptableObject
IntroloopAudio
Namespace: E7.Introloop
Assembly: E7.Introloop.dll
Syntax
[CreateAssetMenu(menuName = "Introloop/Introloop Audio")]
public class IntroloopAudio : ScriptableObject
Properties
AudioClip
The underlying AudioClip that this asset uses.
Declaration
public AudioClip AudioClip { get; }
Property Value
Type | Description |
---|---|
UnityEngine.AudioClip |
ClipLength
Length of this audio if played without looping, already taken account of pitch modification setup on the asset. (Unity's "pitch" is not a real pitch shifting, it is just a play speed change that in turn affects pitch.)
Declaration
public float ClipLength { get; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
Together with ClipLength, if the audio's Loop
is false
then you can predict
that audio should end after that much time passed.
This allows you to implement an audio queue in the case of playing non-looping audio that wants to follow with something else afterwards. (e.g. inn music while sleeping then continue the old ones which is set to introloop.)
You may not be expecting something like IsPlaying
property to be lacking in IntroloopPlayer
.
Because scheduling methods inside wrecks AudioSource
play state that they could not be trusted 100%.
For instance, a scheduled-to-play audio is already considered "playing" while actually it is not.
Loop
If the asset is set to either Introloop or Loop button in the editor, this is true
.
Declaration
public bool Loop { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
If this is false
, ClipLength can predict when the audio would end after played.
Pitch
Read-only pitch settings that you have set on the IntroloopAudio asset file.
Declaration
public float Pitch { get; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
Introloop does not allow pitch change other than at the asset, since it will wreck the scheduling if that happen while things are playing. Scheduling needs predictability to plan ahead of time and pitch change will invalidates many assumptions.
(For instance, I schedule "halfway ahead of the seam" and that will not work if suddenly you decided to change the pitch right in front of the seam.)
Also Unity's "pitch" wording in their UnityEngine.AudioSource is technically incorrect. It is rather "speed" that affects pitch in the end. It is not a real pitch shifting. The wording here follows what Unity used rather than technical correctness.
Volume
Set the underlying UnityEngine.AudioSource to this volume on play.
Declaration
public float Volume { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This allows a per-music volume adjustment. The composer can master/maximize the volume from his DAW without worry about game's context. The developer can drop the volume down after importing on their own. Resulting in a happy game studio.