terraria-cpp2il-methodrecon v1.4.4.9
Terraria mobile dump, with reconstructed method body. Dump with CallAnalysis: https://infinitynichto.github.io/terraria-cpp2il
Loading...
Searching...
No Matches
SoundInstance.cs
Go to the documentation of this file.
1using System;
2using UnityEngine;
4
5// Token: 0x02000052 RID: 82
6public class SoundInstance
7{
8 // Token: 0x060001AF RID: 431 RVA: 0x00004E18 File Offset: 0x00003018
9 public SoundInstance(SoundChannel channel, SoundDefinition definition, float volume = 1f, float pan = 0f, float pitch = 1f, bool loop = false)
10 {
12 AudioClip randomClip = definition.GetRandomClip();
14 this._channel = channel;
16 if (channel._currentSound != null)
17 {
18 channel2 = this._channel;
19 }
23 SoundGroup group = definition.Group;
24 AudioSource audioSource = channel3.AudioSource;
25 if (group != null)
26 {
28 return;
29 }
35 long num = 0L;
39 int priority = definition.Priority;
41 }
42
43 // Token: 0x060001B0 RID: 432 RVA: 0x00004F5C File Offset: 0x0000315C
44 public void Restart()
45 {
46 SoundChannel channel = this._channel;
47 if (channel != null)
48 {
50 float length = this.Clip.length;
53 if (channel2 == null)
54 {
55 }
58 DateTime dateTime = utcNow + timeSpan;
59 this.FinishTime = dateTime;
60 }
61 }
62
63 // Token: 0x17000070 RID: 112
64 // (get) Token: 0x060001B1 RID: 433 RVA: 0x00004FC8 File Offset: 0x000031C8
65 // (set) Token: 0x060001B2 RID: 434 RVA: 0x00004FF8 File Offset: 0x000031F8
66 public float CurrentPosition
67 {
68 get
69 {
70 /*
71An exception occurred when decompiling this method (060001B1)
72
73ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Single SoundInstance::get_CurrentPosition()
74
75 ---> System.Exception: Basic block has to end with unconditional control flow.
76{
77 Block_0:
78 stloc:AudioSource(var_1_10, ldfld:AudioSource(SoundChannel::AudioSource, ldloc:SoundChannel(var_0_06)))
79 stloc:float32(var_3_21, callgetter:float32(AudioSource::get_time, ldfld:AudioSource(SoundChannel::AudioSource, ldfld:SoundChannel(SoundInstance::_channel, ldloc:SoundInstance(this)))))
80}
81
82 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
83 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
84 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
85 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
86 --- End of inner exception stack trace ---
87 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
88 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1683
89*/;
90 }
91 set
92 {
93 SoundChannel channel = this._channel;
94 if (channel != null)
95 {
97 float length = this.Clip.length;
100 if (channel2 == null)
101 {
102 }
105 DateTime dateTime = utcNow + timeSpan;
106 this.FinishTime = dateTime;
107 }
108 }
109 }
110
111 // Token: 0x060001B3 RID: 435 RVA: 0x00005064 File Offset: 0x00003264
112 public void SetVolume(float volume)
113 {
114 SoundChannel channel = this._channel;
115 if (channel != null)
116 {
119 return;
120 }
121 }
122
123 // Token: 0x060001B4 RID: 436 RVA: 0x00005094 File Offset: 0x00003294
124 public void SetPan(float pan)
125 {
126 SoundChannel channel = this._channel;
127 if (channel != null)
128 {
131 return;
132 }
133 }
134
135 // Token: 0x060001B5 RID: 437 RVA: 0x000050C4 File Offset: 0x000032C4
136 public void SetPitch(float pitch)
137 {
138 SoundChannel channel = this._channel;
139 if (channel != null)
140 {
143 return;
144 }
145 }
146
147 // Token: 0x060001B6 RID: 438 RVA: 0x000050F4 File Offset: 0x000032F4
148 public void Stop()
149 {
150 if (!true)
151 {
152 }
154 SoundChannel channel = this._channel;
156 if (channel != null)
157 {
160 return;
161 }
162 }
163
164 // Token: 0x060001B7 RID: 439 RVA: 0x00005138 File Offset: 0x00003338
166 {
168 if (!true)
169 {
170 }
172 bool flag = finishTime > utcNow;
173 SoundChannel channel = this._channel;
176 float volume = channel.AudioSource.volume;
179 if (channel == null)
180 {
181 }
182 bool flag2 = fadeEnd > finishTime2;
185 this._fading = true;
186 }
187
188 // Token: 0x060001B8 RID: 440 RVA: 0x000051BC File Offset: 0x000033BC
189 public bool UpdateFade()
190 {
191 /*
192An exception occurred when decompiling this method (060001B8)
193
194ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean SoundInstance::UpdateFade()
195
196 ---> System.Exception: Basic block has to end with unconditional control flow.
197{
198 IL_00CB:
199 stloc:bool(var_21_D1, ldfld:bool(SoundInstance::_fading, ldloc:SoundInstance(this)))
200}
201
202 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
203 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
204 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
205 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
206 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
207 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
208 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
209 --- End of inner exception stack trace ---
210 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
211 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1683
212*/;
213 }
214
215 // Token: 0x17000071 RID: 113
216 // (get) Token: 0x060001B9 RID: 441 RVA: 0x0000529C File Offset: 0x0000349C
217 // (set) Token: 0x060001BA RID: 442 RVA: 0x000052B0 File Offset: 0x000034B0
219 {
220 get
221 {
222 return this._channel;
223 }
224 set
225 {
227 }
228 }
229
230 // Token: 0x04000127 RID: 295
232
233 // Token: 0x04000128 RID: 296
235
236 // Token: 0x04000129 RID: 297
238
239 // Token: 0x0400012A RID: 298
240 private bool _fading;
241
242 // Token: 0x0400012B RID: 299
244
245 // Token: 0x0400012C RID: 300
247
248 // Token: 0x0400012D RID: 301
249 private float _fadeStartVol;
250
251 // Token: 0x0400012E RID: 302
252 private float _fadeEndVol;
253
254 // Token: 0x0400012F RID: 303
256}
class f__AnonymousType0<< Count > j__TPar
SoundInstance _currentSound
AudioSource AudioSource
AudioMixerGroup MixerGroup
Definition SoundGroup.cs:10
void SetPitch(float pitch)
readonly AudioClip Clip
SoundInstance(SoundChannel channel, SoundDefinition definition, float volume=1f, float pan=0f, float pitch=1f, bool loop=false)
void StartFade(float fadeTarget, DateTime fadeStart, DateTime targetTime)
void SetVolume(float volume)
DateTime _fadeEnd
DateTime FinishTime
DateTime _fadeStart
SoundChannel _channel
SoundChannel Channel
float CurrentPosition
void SetPan(float pan)
readonly SoundDefinition Definition
void Stop(bool stopOneShots)
static DateTime UtcNow
Definition DateTime.cs:1318
static TimeSpan FromSeconds(double value)
Definition TimeSpan.cs:284