300 lines
11 KiB
C#
300 lines
11 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using UnityEngine.Internal;
|
|
using UnityEngine.Playables;
|
|
using UnityEngine.Scripting;
|
|
|
|
namespace UnityEngine.Audio
|
|
{
|
|
// Token: 0x020001CA RID: 458
|
|
[RequiredByNativeCode]
|
|
public struct AudioClipPlayable : IPlayable, IEquatable<AudioClipPlayable>
|
|
{
|
|
// Token: 0x06002131 RID: 8497 RVA: 0x00027644 File Offset: 0x00025844
|
|
internal AudioClipPlayable(PlayableHandle handle)
|
|
{
|
|
if (handle.IsValid())
|
|
{
|
|
if (!handle.IsPlayableOfType<AudioClipPlayable>())
|
|
{
|
|
throw new InvalidCastException("Can't set handle: the playable is not an AudioClipPlayable.");
|
|
}
|
|
}
|
|
this.m_Handle = handle;
|
|
}
|
|
|
|
// Token: 0x06002132 RID: 8498 RVA: 0x00027674 File Offset: 0x00025874
|
|
public static AudioClipPlayable Create(PlayableGraph graph, AudioClip clip, bool looping)
|
|
{
|
|
PlayableHandle playableHandle = AudioClipPlayable.CreateHandle(graph, clip, looping);
|
|
AudioClipPlayable audioClipPlayable = new AudioClipPlayable(playableHandle);
|
|
if (clip != null)
|
|
{
|
|
audioClipPlayable.SetDuration((double)clip.length);
|
|
}
|
|
return audioClipPlayable;
|
|
}
|
|
|
|
// Token: 0x06002133 RID: 8499 RVA: 0x000276B4 File Offset: 0x000258B4
|
|
private static PlayableHandle CreateHandle(PlayableGraph graph, AudioClip clip, bool looping)
|
|
{
|
|
PlayableHandle @null = PlayableHandle.Null;
|
|
PlayableHandle playableHandle;
|
|
if (!AudioClipPlayable.InternalCreateAudioClipPlayable(ref graph, clip, looping, ref @null))
|
|
{
|
|
playableHandle = PlayableHandle.Null;
|
|
}
|
|
else
|
|
{
|
|
playableHandle = @null;
|
|
}
|
|
return playableHandle;
|
|
}
|
|
|
|
// Token: 0x06002134 RID: 8500 RVA: 0x000276EC File Offset: 0x000258EC
|
|
public PlayableHandle GetHandle()
|
|
{
|
|
return this.m_Handle;
|
|
}
|
|
|
|
// Token: 0x06002135 RID: 8501 RVA: 0x00027708 File Offset: 0x00025908
|
|
public static implicit operator Playable(AudioClipPlayable playable)
|
|
{
|
|
return new Playable(playable.GetHandle());
|
|
}
|
|
|
|
// Token: 0x06002136 RID: 8502 RVA: 0x0002772C File Offset: 0x0002592C
|
|
public static explicit operator AudioClipPlayable(Playable playable)
|
|
{
|
|
return new AudioClipPlayable(playable.GetHandle());
|
|
}
|
|
|
|
// Token: 0x06002137 RID: 8503 RVA: 0x00027750 File Offset: 0x00025950
|
|
public bool Equals(AudioClipPlayable other)
|
|
{
|
|
return this.GetHandle() == other.GetHandle();
|
|
}
|
|
|
|
// Token: 0x06002138 RID: 8504 RVA: 0x00027778 File Offset: 0x00025978
|
|
public AudioClip GetClip()
|
|
{
|
|
return AudioClipPlayable.GetClipInternal(ref this.m_Handle);
|
|
}
|
|
|
|
// Token: 0x06002139 RID: 8505 RVA: 0x00027798 File Offset: 0x00025998
|
|
public void GetClip(AudioClip value)
|
|
{
|
|
AudioClipPlayable.SetClipInternal(ref this.m_Handle, value);
|
|
}
|
|
|
|
// Token: 0x0600213A RID: 8506 RVA: 0x000277A8 File Offset: 0x000259A8
|
|
private static AudioClip GetClipInternal(ref PlayableHandle hdl)
|
|
{
|
|
return AudioClipPlayable.INTERNAL_CALL_GetClipInternal(ref hdl);
|
|
}
|
|
|
|
// Token: 0x0600213B RID: 8507
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern AudioClip INTERNAL_CALL_GetClipInternal(ref PlayableHandle hdl);
|
|
|
|
// Token: 0x0600213C RID: 8508 RVA: 0x000277C4 File Offset: 0x000259C4
|
|
private static void SetClipInternal(ref PlayableHandle hdl, AudioClip clip)
|
|
{
|
|
AudioClipPlayable.INTERNAL_CALL_SetClipInternal(ref hdl, clip);
|
|
}
|
|
|
|
// Token: 0x0600213D RID: 8509
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_SetClipInternal(ref PlayableHandle hdl, AudioClip clip);
|
|
|
|
// Token: 0x0600213E RID: 8510 RVA: 0x000277D0 File Offset: 0x000259D0
|
|
public bool GetLooped()
|
|
{
|
|
return AudioClipPlayable.GetLoopedInternal(ref this.m_Handle);
|
|
}
|
|
|
|
// Token: 0x0600213F RID: 8511 RVA: 0x000277F0 File Offset: 0x000259F0
|
|
public void SetLooped(bool value)
|
|
{
|
|
AudioClipPlayable.SetLoopedInternal(ref this.m_Handle, value);
|
|
}
|
|
|
|
// Token: 0x06002140 RID: 8512 RVA: 0x00027800 File Offset: 0x00025A00
|
|
private static bool GetLoopedInternal(ref PlayableHandle hdl)
|
|
{
|
|
return AudioClipPlayable.INTERNAL_CALL_GetLoopedInternal(ref hdl);
|
|
}
|
|
|
|
// Token: 0x06002141 RID: 8513
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern bool INTERNAL_CALL_GetLoopedInternal(ref PlayableHandle hdl);
|
|
|
|
// Token: 0x06002142 RID: 8514 RVA: 0x0002781C File Offset: 0x00025A1C
|
|
private static void SetLoopedInternal(ref PlayableHandle hdl, bool looped)
|
|
{
|
|
AudioClipPlayable.INTERNAL_CALL_SetLoopedInternal(ref hdl, looped);
|
|
}
|
|
|
|
// Token: 0x06002143 RID: 8515
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_SetLoopedInternal(ref PlayableHandle hdl, bool looped);
|
|
|
|
// Token: 0x06002144 RID: 8516 RVA: 0x00027828 File Offset: 0x00025A28
|
|
public bool IsPlaying()
|
|
{
|
|
return AudioClipPlayable.GetIsPlayingInternal(ref this.m_Handle);
|
|
}
|
|
|
|
// Token: 0x06002145 RID: 8517 RVA: 0x00027848 File Offset: 0x00025A48
|
|
private static bool GetIsPlayingInternal(ref PlayableHandle hdl)
|
|
{
|
|
return AudioClipPlayable.INTERNAL_CALL_GetIsPlayingInternal(ref hdl);
|
|
}
|
|
|
|
// Token: 0x06002146 RID: 8518
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern bool INTERNAL_CALL_GetIsPlayingInternal(ref PlayableHandle hdl);
|
|
|
|
// Token: 0x06002147 RID: 8519 RVA: 0x00027864 File Offset: 0x00025A64
|
|
public double GetStartDelay()
|
|
{
|
|
return AudioClipPlayable.GetStartDelayInternal(ref this.m_Handle);
|
|
}
|
|
|
|
// Token: 0x06002148 RID: 8520 RVA: 0x00027884 File Offset: 0x00025A84
|
|
internal void SetStartDelay(double value)
|
|
{
|
|
this.ValidateStartDelayInternal(value);
|
|
AudioClipPlayable.SetStartDelayInternal(ref this.m_Handle, value);
|
|
}
|
|
|
|
// Token: 0x06002149 RID: 8521 RVA: 0x0002789C File Offset: 0x00025A9C
|
|
private static double GetStartDelayInternal(ref PlayableHandle hdl)
|
|
{
|
|
return AudioClipPlayable.INTERNAL_CALL_GetStartDelayInternal(ref hdl);
|
|
}
|
|
|
|
// Token: 0x0600214A RID: 8522
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern double INTERNAL_CALL_GetStartDelayInternal(ref PlayableHandle hdl);
|
|
|
|
// Token: 0x0600214B RID: 8523 RVA: 0x000278B8 File Offset: 0x00025AB8
|
|
private static void SetStartDelayInternal(ref PlayableHandle hdl, double delay)
|
|
{
|
|
AudioClipPlayable.INTERNAL_CALL_SetStartDelayInternal(ref hdl, delay);
|
|
}
|
|
|
|
// Token: 0x0600214C RID: 8524
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_SetStartDelayInternal(ref PlayableHandle hdl, double delay);
|
|
|
|
// Token: 0x0600214D RID: 8525 RVA: 0x000278C4 File Offset: 0x00025AC4
|
|
public double GetPauseDelay()
|
|
{
|
|
return AudioClipPlayable.GetPauseDelayInternal(ref this.m_Handle);
|
|
}
|
|
|
|
// Token: 0x0600214E RID: 8526 RVA: 0x000278E4 File Offset: 0x00025AE4
|
|
internal void GetPauseDelay(double value)
|
|
{
|
|
double pauseDelayInternal = AudioClipPlayable.GetPauseDelayInternal(ref this.m_Handle);
|
|
if (this.m_Handle.GetPlayState() == PlayState.Playing && (value < 0.05 || (pauseDelayInternal != 0.0 && pauseDelayInternal < 0.05)))
|
|
{
|
|
throw new ArgumentException("AudioClipPlayable.pauseDelay: Setting new delay when existing delay is too small or 0.0 (" + pauseDelayInternal + "), audio system will not be able to change in time");
|
|
}
|
|
AudioClipPlayable.SetPauseDelayInternal(ref this.m_Handle, value);
|
|
}
|
|
|
|
// Token: 0x0600214F RID: 8527 RVA: 0x00027964 File Offset: 0x00025B64
|
|
private static double GetPauseDelayInternal(ref PlayableHandle hdl)
|
|
{
|
|
return AudioClipPlayable.INTERNAL_CALL_GetPauseDelayInternal(ref hdl);
|
|
}
|
|
|
|
// Token: 0x06002150 RID: 8528
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern double INTERNAL_CALL_GetPauseDelayInternal(ref PlayableHandle hdl);
|
|
|
|
// Token: 0x06002151 RID: 8529 RVA: 0x00027980 File Offset: 0x00025B80
|
|
private static void SetPauseDelayInternal(ref PlayableHandle hdl, double delay)
|
|
{
|
|
AudioClipPlayable.INTERNAL_CALL_SetPauseDelayInternal(ref hdl, delay);
|
|
}
|
|
|
|
// Token: 0x06002152 RID: 8530
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern void INTERNAL_CALL_SetPauseDelayInternal(ref PlayableHandle hdl, double delay);
|
|
|
|
// Token: 0x06002153 RID: 8531 RVA: 0x0002798C File Offset: 0x00025B8C
|
|
private static bool InternalCreateAudioClipPlayable(ref PlayableGraph graph, AudioClip clip, bool looping, ref PlayableHandle handle)
|
|
{
|
|
return AudioClipPlayable.INTERNAL_CALL_InternalCreateAudioClipPlayable(ref graph, clip, looping, ref handle);
|
|
}
|
|
|
|
// Token: 0x06002154 RID: 8532
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern bool INTERNAL_CALL_InternalCreateAudioClipPlayable(ref PlayableGraph graph, AudioClip clip, bool looping, ref PlayableHandle handle);
|
|
|
|
// Token: 0x06002155 RID: 8533 RVA: 0x000279AC File Offset: 0x00025BAC
|
|
private static bool ValidateType(ref PlayableHandle hdl)
|
|
{
|
|
return AudioClipPlayable.INTERNAL_CALL_ValidateType(ref hdl);
|
|
}
|
|
|
|
// Token: 0x06002156 RID: 8534
|
|
[GeneratedByOldBindingsGenerator]
|
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
|
private static extern bool INTERNAL_CALL_ValidateType(ref PlayableHandle hdl);
|
|
|
|
// Token: 0x06002157 RID: 8535 RVA: 0x000279C8 File Offset: 0x00025BC8
|
|
[ExcludeFromDocs]
|
|
public void Seek(double startTime, double startDelay)
|
|
{
|
|
double num = 0.0;
|
|
this.Seek(startTime, startDelay, num);
|
|
}
|
|
|
|
// Token: 0x06002158 RID: 8536 RVA: 0x000279EC File Offset: 0x00025BEC
|
|
public void Seek(double startTime, double startDelay, [DefaultValue("0")] double duration)
|
|
{
|
|
this.ValidateStartDelayInternal(startDelay);
|
|
AudioClipPlayable.SetStartDelayInternal(ref this.m_Handle, startDelay);
|
|
if (duration > 0.0)
|
|
{
|
|
this.m_Handle.SetDuration(duration + startTime);
|
|
AudioClipPlayable.SetPauseDelayInternal(ref this.m_Handle, startDelay + duration);
|
|
}
|
|
else
|
|
{
|
|
this.m_Handle.SetDuration(double.MaxValue);
|
|
AudioClipPlayable.SetPauseDelayInternal(ref this.m_Handle, 0.0);
|
|
}
|
|
this.m_Handle.SetTime(startTime);
|
|
this.m_Handle.SetPlayState(PlayState.Playing);
|
|
}
|
|
|
|
// Token: 0x06002159 RID: 8537 RVA: 0x00027A84 File Offset: 0x00025C84
|
|
private void ValidateStartDelayInternal(double startDelay)
|
|
{
|
|
double startDelayInternal = AudioClipPlayable.GetStartDelayInternal(ref this.m_Handle);
|
|
if (this.IsPlaying() && (startDelay < 0.05 || (startDelayInternal >= 1E-05 && startDelayInternal < 0.05)))
|
|
{
|
|
Debug.LogWarning("AudioClipPlayable.StartDelay: Setting new delay when existing delay is too small or 0.0 (" + startDelayInternal + "), audio system will not be able to change in time");
|
|
}
|
|
}
|
|
|
|
// Token: 0x040004E1 RID: 1249
|
|
private PlayableHandle m_Handle;
|
|
}
|
|
}
|