forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAudioClip.cs
More file actions
178 lines (178 loc) · 6.29 KB
/
AudioClip.cs
File metadata and controls
178 lines (178 loc) · 6.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
using System;
using System.Runtime.CompilerServices;
namespace UnityEngine
{
public sealed class AudioClip : Object
{
public delegate void PCMReaderCallback(float[] data);
public delegate void PCMSetPositionCallback(int position);
private event AudioClip.PCMReaderCallback m_PCMReaderCallback
{
[MethodImpl(MethodImplOptions.Synchronized)]
add
{
this.m_PCMReaderCallback = (AudioClip.PCMReaderCallback)Delegate.Combine(this.m_PCMReaderCallback, value);
}
[MethodImpl(MethodImplOptions.Synchronized)]
remove
{
this.m_PCMReaderCallback = (AudioClip.PCMReaderCallback)Delegate.Remove(this.m_PCMReaderCallback, value);
}
}
private event AudioClip.PCMSetPositionCallback m_PCMSetPositionCallback
{
[MethodImpl(MethodImplOptions.Synchronized)]
add
{
this.m_PCMSetPositionCallback = (AudioClip.PCMSetPositionCallback)Delegate.Combine(this.m_PCMSetPositionCallback, value);
}
[MethodImpl(MethodImplOptions.Synchronized)]
remove
{
this.m_PCMSetPositionCallback = (AudioClip.PCMSetPositionCallback)Delegate.Remove(this.m_PCMSetPositionCallback, value);
}
}
public extern float length
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern int samples
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern int channels
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern int frequency
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
[Obsolete("Use AudioClip.loadState instead to get more detailed information about the loading process.")]
public extern bool isReadyToPlay
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern AudioClipLoadType loadType
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern bool preloadAudioData
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern AudioDataLoadState loadState
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern bool loadInBackground
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public extern bool LoadAudioData();
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public extern bool UnloadAudioData();
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public extern bool GetData(float[] data, int offsetSamples);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public extern bool SetData(float[] data, int offsetSamples);
[Obsolete("The _3D argument of AudioClip is deprecated. Use the spatialBlend property of AudioSource instead to morph between 2D and 3D playback.")]
public static AudioClip Create(string name, int lengthSamples, int channels, int frequency, bool _3D, bool stream)
{
return AudioClip.Create(name, lengthSamples, channels, frequency, stream);
}
[Obsolete("The _3D argument of AudioClip is deprecated. Use the spatialBlend property of AudioSource instead to morph between 2D and 3D playback.")]
public static AudioClip Create(string name, int lengthSamples, int channels, int frequency, bool _3D, bool stream, AudioClip.PCMReaderCallback pcmreadercallback)
{
return AudioClip.Create(name, lengthSamples, channels, frequency, stream, pcmreadercallback, null);
}
[Obsolete("The _3D argument of AudioClip is deprecated. Use the spatialBlend property of AudioSource instead to morph between 2D and 3D playback.")]
public static AudioClip Create(string name, int lengthSamples, int channels, int frequency, bool _3D, bool stream, AudioClip.PCMReaderCallback pcmreadercallback, AudioClip.PCMSetPositionCallback pcmsetpositioncallback)
{
return AudioClip.Create(name, lengthSamples, channels, frequency, stream, pcmreadercallback, pcmsetpositioncallback);
}
public static AudioClip Create(string name, int lengthSamples, int channels, int frequency, bool stream)
{
return AudioClip.Create(name, lengthSamples, channels, frequency, stream, null, null);
}
public static AudioClip Create(string name, int lengthSamples, int channels, int frequency, bool stream, AudioClip.PCMReaderCallback pcmreadercallback)
{
return AudioClip.Create(name, lengthSamples, channels, frequency, stream, pcmreadercallback, null);
}
public static AudioClip Create(string name, int lengthSamples, int channels, int frequency, bool stream, AudioClip.PCMReaderCallback pcmreadercallback, AudioClip.PCMSetPositionCallback pcmsetpositioncallback)
{
if (name == null)
{
throw new NullReferenceException();
}
if (lengthSamples <= 0)
{
throw new ArgumentException("Length of created clip must be larger than 0");
}
if (channels <= 0)
{
throw new ArgumentException("Number of channels in created clip must be greater than 0");
}
if (frequency <= 0)
{
throw new ArgumentException("Frequency in created clip must be greater than 0");
}
AudioClip audioClip = AudioClip.Construct_Internal();
if (pcmreadercallback != null)
{
AudioClip expr_50 = audioClip;
expr_50.m_PCMReaderCallback = (AudioClip.PCMReaderCallback)Delegate.Combine(expr_50.m_PCMReaderCallback, pcmreadercallback);
}
if (pcmsetpositioncallback != null)
{
AudioClip expr_6F = audioClip;
expr_6F.m_PCMSetPositionCallback = (AudioClip.PCMSetPositionCallback)Delegate.Combine(expr_6F.m_PCMSetPositionCallback, pcmsetpositioncallback);
}
audioClip.Init_Internal(name, lengthSamples, channels, frequency, stream);
return audioClip;
}
private void InvokePCMReaderCallback_Internal(float[] data)
{
if (this.m_PCMReaderCallback != null)
{
this.m_PCMReaderCallback(data);
}
}
private void InvokePCMSetPositionCallback_Internal(int position)
{
if (this.m_PCMSetPositionCallback != null)
{
this.m_PCMSetPositionCallback(position);
}
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern AudioClip Construct_Internal();
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void Init_Internal(string name, int lengthSamples, int channels, int frequency, bool stream);
}
}