diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-11 15:33:28 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-11 15:33:28 -0500 |
commit | 6cfc54f019ea793c75c012af9c8249eac936cfac (patch) | |
tree | f19eed64e9b284136f3b802d4dee71ee24978646 /vendor/fmod/inc/fmod_studio.cs | |
parent | 456122f5f0086ed0dbe1b784266b96e9624aa8e1 (diff) | |
download | ether-6cfc54f019ea793c75c012af9c8249eac936cfac.tar.gz ether-6cfc54f019ea793c75c012af9c8249eac936cfac.tar.bz2 ether-6cfc54f019ea793c75c012af9c8249eac936cfac.zip |
Added music and lamp popping sound
Diffstat (limited to 'vendor/fmod/inc/fmod_studio.cs')
-rw-r--r-- | vendor/fmod/inc/fmod_studio.cs | 2250 |
1 files changed, 2250 insertions, 0 deletions
diff --git a/vendor/fmod/inc/fmod_studio.cs b/vendor/fmod/inc/fmod_studio.cs new file mode 100644 index 0000000..e8237cc --- /dev/null +++ b/vendor/fmod/inc/fmod_studio.cs | |||
@@ -0,0 +1,2250 @@ | |||
1 | /* ======================================================================================== */ | ||
2 | /* FMOD Studio API - C# wrapper. */ | ||
3 | /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2021. */ | ||
4 | /* */ | ||
5 | /* For more detail visit: */ | ||
6 | /* https://fmod.com/resources/documentation-api?version=2.0&page=page=studio-api.html */ | ||
7 | /* ======================================================================================== */ | ||
8 | |||
9 | using System; | ||
10 | using System.Text; | ||
11 | using System.Runtime.InteropServices; | ||
12 | using System.Collections; | ||
13 | |||
14 | namespace FMOD.Studio | ||
15 | { | ||
16 | public partial class STUDIO_VERSION | ||
17 | { | ||
18 | #if !UNITY_2019_4_OR_NEWER | ||
19 | public const string dll = "fmodstudio"; | ||
20 | #endif | ||
21 | } | ||
22 | |||
23 | public enum STOP_MODE : int | ||
24 | { | ||
25 | ALLOWFADEOUT, | ||
26 | IMMEDIATE, | ||
27 | } | ||
28 | |||
29 | public enum LOADING_STATE : int | ||
30 | { | ||
31 | UNLOADING, | ||
32 | UNLOADED, | ||
33 | LOADING, | ||
34 | LOADED, | ||
35 | ERROR, | ||
36 | } | ||
37 | |||
38 | [StructLayout(LayoutKind.Sequential)] | ||
39 | public struct PROGRAMMER_SOUND_PROPERTIES | ||
40 | { | ||
41 | public StringWrapper name; | ||
42 | public IntPtr sound; | ||
43 | public int subsoundIndex; | ||
44 | } | ||
45 | |||
46 | [StructLayout(LayoutKind.Sequential)] | ||
47 | public struct TIMELINE_MARKER_PROPERTIES | ||
48 | { | ||
49 | public StringWrapper name; | ||
50 | public int position; | ||
51 | } | ||
52 | |||
53 | [StructLayout(LayoutKind.Sequential)] | ||
54 | public struct TIMELINE_BEAT_PROPERTIES | ||
55 | { | ||
56 | public int bar; | ||
57 | public int beat; | ||
58 | public int position; | ||
59 | public float tempo; | ||
60 | public int timesignatureupper; | ||
61 | public int timesignaturelower; | ||
62 | } | ||
63 | |||
64 | [StructLayout(LayoutKind.Sequential)] | ||
65 | public struct TIMELINE_NESTED_BEAT_PROPERTIES | ||
66 | { | ||
67 | public GUID eventid; | ||
68 | public TIMELINE_BEAT_PROPERTIES properties; | ||
69 | } | ||
70 | |||
71 | [StructLayout(LayoutKind.Sequential)] | ||
72 | public struct ADVANCEDSETTINGS | ||
73 | { | ||
74 | public int cbsize; | ||
75 | public int commandqueuesize; | ||
76 | public int handleinitialsize; | ||
77 | public int studioupdateperiod; | ||
78 | public int idlesampledatapoolsize; | ||
79 | public int streamingscheduledelay; | ||
80 | public IntPtr encryptionkey; | ||
81 | } | ||
82 | |||
83 | [StructLayout(LayoutKind.Sequential)] | ||
84 | public struct CPU_USAGE | ||
85 | { | ||
86 | public float update; | ||
87 | } | ||
88 | |||
89 | [StructLayout(LayoutKind.Sequential)] | ||
90 | public struct BUFFER_INFO | ||
91 | { | ||
92 | public int currentusage; | ||
93 | public int peakusage; | ||
94 | public int capacity; | ||
95 | public int stallcount; | ||
96 | public float stalltime; | ||
97 | } | ||
98 | |||
99 | [StructLayout(LayoutKind.Sequential)] | ||
100 | public struct BUFFER_USAGE | ||
101 | { | ||
102 | public BUFFER_INFO studiocommandqueue; | ||
103 | public BUFFER_INFO studiohandle; | ||
104 | } | ||
105 | |||
106 | [StructLayout(LayoutKind.Sequential)] | ||
107 | public struct BANK_INFO | ||
108 | { | ||
109 | public int size; | ||
110 | public IntPtr userdata; | ||
111 | public int userdatalength; | ||
112 | public FILE_OPEN_CALLBACK opencallback; | ||
113 | public FILE_CLOSE_CALLBACK closecallback; | ||
114 | public FILE_READ_CALLBACK readcallback; | ||
115 | public FILE_SEEK_CALLBACK seekcallback; | ||
116 | } | ||
117 | |||
118 | [Flags] | ||
119 | public enum SYSTEM_CALLBACK_TYPE : uint | ||
120 | { | ||
121 | PREUPDATE = 0x00000001, | ||
122 | POSTUPDATE = 0x00000002, | ||
123 | BANK_UNLOAD = 0x00000004, | ||
124 | LIVEUPDATE_CONNECTED = 0x00000008, | ||
125 | LIVEUPDATE_DISCONNECTED = 0x00000010, | ||
126 | ALL = 0xFFFFFFFF, | ||
127 | } | ||
128 | |||
129 | public delegate RESULT SYSTEM_CALLBACK(IntPtr system, SYSTEM_CALLBACK_TYPE type, IntPtr commanddata, IntPtr userdata); | ||
130 | |||
131 | public enum PARAMETER_TYPE : int | ||
132 | { | ||
133 | GAME_CONTROLLED, | ||
134 | AUTOMATIC_DISTANCE, | ||
135 | AUTOMATIC_EVENT_CONE_ANGLE, | ||
136 | AUTOMATIC_EVENT_ORIENTATION, | ||
137 | AUTOMATIC_DIRECTION, | ||
138 | AUTOMATIC_ELEVATION, | ||
139 | AUTOMATIC_LISTENER_ORIENTATION, | ||
140 | AUTOMATIC_SPEED, | ||
141 | AUTOMATIC_SPEED_ABSOLUTE, | ||
142 | AUTOMATIC_DISTANCE_NORMALIZED, | ||
143 | MAX | ||
144 | } | ||
145 | |||
146 | [Flags] | ||
147 | public enum PARAMETER_FLAGS : uint | ||
148 | { | ||
149 | READONLY = 0x00000001, | ||
150 | AUTOMATIC = 0x00000002, | ||
151 | GLOBAL = 0x00000004, | ||
152 | DISCRETE = 0x00000008, | ||
153 | LABELED = 0x00000010, | ||
154 | } | ||
155 | |||
156 | [StructLayout(LayoutKind.Sequential)] | ||
157 | public struct PARAMETER_ID | ||
158 | { | ||
159 | public uint data1; | ||
160 | public uint data2; | ||
161 | } | ||
162 | |||
163 | [StructLayout(LayoutKind.Sequential)] | ||
164 | public struct PARAMETER_DESCRIPTION | ||
165 | { | ||
166 | public StringWrapper name; | ||
167 | public PARAMETER_ID id; | ||
168 | public float minimum; | ||
169 | public float maximum; | ||
170 | public float defaultvalue; | ||
171 | public PARAMETER_TYPE type; | ||
172 | public PARAMETER_FLAGS flags; | ||
173 | public GUID guid; | ||
174 | } | ||
175 | |||
176 | // This is only need for loading memory and given our C# wrapper LOAD_MEMORY_POINT isn't feasible anyway | ||
177 | enum LOAD_MEMORY_MODE : int | ||
178 | { | ||
179 | LOAD_MEMORY, | ||
180 | LOAD_MEMORY_POINT, | ||
181 | } | ||
182 | |||
183 | enum LOAD_MEMORY_ALIGNMENT : int | ||
184 | { | ||
185 | VALUE = 32 | ||
186 | } | ||
187 | |||
188 | [StructLayout(LayoutKind.Sequential)] | ||
189 | public struct SOUND_INFO | ||
190 | { | ||
191 | public IntPtr name_or_data; | ||
192 | public MODE mode; | ||
193 | public CREATESOUNDEXINFO exinfo; | ||
194 | public int subsoundindex; | ||
195 | |||
196 | public string name | ||
197 | { | ||
198 | get | ||
199 | { | ||
200 | using (StringHelper.ThreadSafeEncoding encoding = StringHelper.GetFreeHelper()) | ||
201 | { | ||
202 | return ((mode & (MODE.OPENMEMORY | MODE.OPENMEMORY_POINT)) == 0) ? encoding.stringFromNative(name_or_data) : String.Empty; | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | |||
208 | public enum USER_PROPERTY_TYPE : int | ||
209 | { | ||
210 | INTEGER, | ||
211 | BOOLEAN, | ||
212 | FLOAT, | ||
213 | STRING, | ||
214 | } | ||
215 | |||
216 | [StructLayout(LayoutKind.Sequential)] | ||
217 | public struct USER_PROPERTY | ||
218 | { | ||
219 | public StringWrapper name; | ||
220 | public USER_PROPERTY_TYPE type; | ||
221 | private Union_IntBoolFloatString value; | ||
222 | |||
223 | public int intValue() { return (type == USER_PROPERTY_TYPE.INTEGER) ? value.intvalue : -1; } | ||
224 | public bool boolValue() { return (type == USER_PROPERTY_TYPE.BOOLEAN) ? value.boolvalue : false; } | ||
225 | public float floatValue() { return (type == USER_PROPERTY_TYPE.FLOAT) ? value.floatvalue : -1; } | ||
226 | public string stringValue() { return (type == USER_PROPERTY_TYPE.STRING) ? value.stringvalue : ""; } | ||
227 | }; | ||
228 | |||
229 | [StructLayout(LayoutKind.Explicit)] | ||
230 | struct Union_IntBoolFloatString | ||
231 | { | ||
232 | [FieldOffset(0)] | ||
233 | public int intvalue; | ||
234 | [FieldOffset(0)] | ||
235 | public bool boolvalue; | ||
236 | [FieldOffset(0)] | ||
237 | public float floatvalue; | ||
238 | [FieldOffset(0)] | ||
239 | public StringWrapper stringvalue; | ||
240 | } | ||
241 | |||
242 | [Flags] | ||
243 | public enum INITFLAGS : uint | ||
244 | { | ||
245 | NORMAL = 0x00000000, | ||
246 | LIVEUPDATE = 0x00000001, | ||
247 | ALLOW_MISSING_PLUGINS = 0x00000002, | ||
248 | SYNCHRONOUS_UPDATE = 0x00000004, | ||
249 | DEFERRED_CALLBACKS = 0x00000008, | ||
250 | LOAD_FROM_UPDATE = 0x00000010, | ||
251 | MEMORY_TRACKING = 0x00000020, | ||
252 | } | ||
253 | |||
254 | [Flags] | ||
255 | public enum LOAD_BANK_FLAGS : uint | ||
256 | { | ||
257 | NORMAL = 0x00000000, | ||
258 | NONBLOCKING = 0x00000001, | ||
259 | DECOMPRESS_SAMPLES = 0x00000002, | ||
260 | UNENCRYPTED = 0x00000004, | ||
261 | } | ||
262 | |||
263 | [Flags] | ||
264 | public enum COMMANDCAPTURE_FLAGS : uint | ||
265 | { | ||
266 | NORMAL = 0x00000000, | ||
267 | FILEFLUSH = 0x00000001, | ||
268 | SKIP_INITIAL_STATE = 0x00000002, | ||
269 | } | ||
270 | |||
271 | [Flags] | ||
272 | public enum COMMANDREPLAY_FLAGS : uint | ||
273 | { | ||
274 | NORMAL = 0x00000000, | ||
275 | SKIP_CLEANUP = 0x00000001, | ||
276 | FAST_FORWARD = 0x00000002, | ||
277 | SKIP_BANK_LOAD = 0x00000004, | ||
278 | } | ||
279 | |||
280 | public enum PLAYBACK_STATE : int | ||
281 | { | ||
282 | PLAYING, | ||
283 | SUSTAINING, | ||
284 | STOPPED, | ||
285 | STARTING, | ||
286 | STOPPING, | ||
287 | } | ||
288 | |||
289 | public enum EVENT_PROPERTY : int | ||
290 | { | ||
291 | CHANNELPRIORITY, | ||
292 | SCHEDULE_DELAY, | ||
293 | SCHEDULE_LOOKAHEAD, | ||
294 | MINIMUM_DISTANCE, | ||
295 | MAXIMUM_DISTANCE, | ||
296 | COOLDOWN, | ||
297 | MAX | ||
298 | }; | ||
299 | |||
300 | [StructLayout(LayoutKind.Sequential)] | ||
301 | public struct PLUGIN_INSTANCE_PROPERTIES | ||
302 | { | ||
303 | public IntPtr name; | ||
304 | public IntPtr dsp; | ||
305 | } | ||
306 | |||
307 | [Flags] | ||
308 | public enum EVENT_CALLBACK_TYPE : uint | ||
309 | { | ||
310 | CREATED = 0x00000001, | ||
311 | DESTROYED = 0x00000002, | ||
312 | STARTING = 0x00000004, | ||
313 | STARTED = 0x00000008, | ||
314 | RESTARTED = 0x00000010, | ||
315 | STOPPED = 0x00000020, | ||
316 | START_FAILED = 0x00000040, | ||
317 | CREATE_PROGRAMMER_SOUND = 0x00000080, | ||
318 | DESTROY_PROGRAMMER_SOUND = 0x00000100, | ||
319 | PLUGIN_CREATED = 0x00000200, | ||
320 | PLUGIN_DESTROYED = 0x00000400, | ||
321 | TIMELINE_MARKER = 0x00000800, | ||
322 | TIMELINE_BEAT = 0x00001000, | ||
323 | SOUND_PLAYED = 0x00002000, | ||
324 | SOUND_STOPPED = 0x00004000, | ||
325 | REAL_TO_VIRTUAL = 0x00008000, | ||
326 | VIRTUAL_TO_REAL = 0x00010000, | ||
327 | START_EVENT_COMMAND = 0x00020000, | ||
328 | NESTED_TIMELINE_BEAT = 0x00040000, | ||
329 | |||
330 | ALL = 0xFFFFFFFF, | ||
331 | } | ||
332 | |||
333 | public delegate RESULT EVENT_CALLBACK(EVENT_CALLBACK_TYPE type, IntPtr _event, IntPtr parameters); | ||
334 | |||
335 | public delegate RESULT COMMANDREPLAY_FRAME_CALLBACK(IntPtr replay, int commandindex, float currenttime, IntPtr userdata); | ||
336 | public delegate RESULT COMMANDREPLAY_LOAD_BANK_CALLBACK(IntPtr replay, int commandindex, GUID bankguid, IntPtr bankfilename, LOAD_BANK_FLAGS flags, out IntPtr bank, IntPtr userdata); | ||
337 | public delegate RESULT COMMANDREPLAY_CREATE_INSTANCE_CALLBACK(IntPtr replay, int commandindex, IntPtr eventdescription, out IntPtr instance, IntPtr userdata); | ||
338 | |||
339 | public enum INSTANCETYPE : int | ||
340 | { | ||
341 | NONE, | ||
342 | SYSTEM, | ||
343 | EVENTDESCRIPTION, | ||
344 | EVENTINSTANCE, | ||
345 | PARAMETERINSTANCE, | ||
346 | BUS, | ||
347 | VCA, | ||
348 | BANK, | ||
349 | COMMANDREPLAY, | ||
350 | } | ||
351 | |||
352 | [StructLayout(LayoutKind.Sequential)] | ||
353 | public struct COMMAND_INFO | ||
354 | { | ||
355 | public StringWrapper commandname; | ||
356 | public int parentcommandindex; | ||
357 | public int framenumber; | ||
358 | public float frametime; | ||
359 | public INSTANCETYPE instancetype; | ||
360 | public INSTANCETYPE outputtype; | ||
361 | public UInt32 instancehandle; | ||
362 | public UInt32 outputhandle; | ||
363 | } | ||
364 | |||
365 | [StructLayout(LayoutKind.Sequential)] | ||
366 | public struct MEMORY_USAGE | ||
367 | { | ||
368 | public int exclusive; | ||
369 | public int inclusive; | ||
370 | public int sampledata; | ||
371 | } | ||
372 | |||
373 | public struct Util | ||
374 | { | ||
375 | public static RESULT parseID(string idString, out GUID id) | ||
376 | { | ||
377 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
378 | { | ||
379 | return FMOD_Studio_ParseID(encoder.byteFromStringUTF8(idString), out id); | ||
380 | } | ||
381 | } | ||
382 | |||
383 | #region importfunctions | ||
384 | [DllImport(STUDIO_VERSION.dll)] | ||
385 | private static extern RESULT FMOD_Studio_ParseID(byte[] idString, out GUID id); | ||
386 | #endregion | ||
387 | } | ||
388 | |||
389 | public struct System | ||
390 | { | ||
391 | // Initialization / system functions. | ||
392 | public static RESULT create(out System system) | ||
393 | { | ||
394 | return FMOD_Studio_System_Create(out system.handle, VERSION.number); | ||
395 | } | ||
396 | public RESULT setAdvancedSettings(ADVANCEDSETTINGS settings) | ||
397 | { | ||
398 | settings.cbsize = MarshalHelper.SizeOf(typeof(ADVANCEDSETTINGS)); | ||
399 | return FMOD_Studio_System_SetAdvancedSettings(this.handle, ref settings); | ||
400 | } | ||
401 | public RESULT setAdvancedSettings(ADVANCEDSETTINGS settings, string encryptionKey) | ||
402 | { | ||
403 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
404 | { | ||
405 | IntPtr userKey = settings.encryptionkey; | ||
406 | settings.encryptionkey = encoder.intptrFromStringUTF8(encryptionKey); | ||
407 | FMOD.RESULT result = setAdvancedSettings(settings); | ||
408 | settings.encryptionkey = userKey; | ||
409 | return result; | ||
410 | } | ||
411 | } | ||
412 | public RESULT getAdvancedSettings(out ADVANCEDSETTINGS settings) | ||
413 | { | ||
414 | settings.cbsize = MarshalHelper.SizeOf(typeof(ADVANCEDSETTINGS)); | ||
415 | return FMOD_Studio_System_GetAdvancedSettings(this.handle, out settings); | ||
416 | } | ||
417 | public RESULT initialize(int maxchannels, INITFLAGS studioflags, FMOD.INITFLAGS flags, IntPtr extradriverdata) | ||
418 | { | ||
419 | return FMOD_Studio_System_Initialize(this.handle, maxchannels, studioflags, flags, extradriverdata); | ||
420 | } | ||
421 | public RESULT release() | ||
422 | { | ||
423 | return FMOD_Studio_System_Release(this.handle); | ||
424 | } | ||
425 | public RESULT update() | ||
426 | { | ||
427 | return FMOD_Studio_System_Update(this.handle); | ||
428 | } | ||
429 | public RESULT getCoreSystem(out FMOD.System coresystem) | ||
430 | { | ||
431 | return FMOD_Studio_System_GetCoreSystem(this.handle, out coresystem.handle); | ||
432 | } | ||
433 | public RESULT getEvent(string path, out EventDescription _event) | ||
434 | { | ||
435 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
436 | { | ||
437 | return FMOD_Studio_System_GetEvent(this.handle, encoder.byteFromStringUTF8(path), out _event.handle); | ||
438 | } | ||
439 | } | ||
440 | public RESULT getBus(string path, out Bus bus) | ||
441 | { | ||
442 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
443 | { | ||
444 | return FMOD_Studio_System_GetBus(this.handle, encoder.byteFromStringUTF8(path), out bus.handle); | ||
445 | } | ||
446 | } | ||
447 | public RESULT getVCA(string path, out VCA vca) | ||
448 | { | ||
449 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
450 | { | ||
451 | return FMOD_Studio_System_GetVCA(this.handle, encoder.byteFromStringUTF8(path), out vca.handle); | ||
452 | } | ||
453 | } | ||
454 | public RESULT getBank(string path, out Bank bank) | ||
455 | { | ||
456 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
457 | { | ||
458 | return FMOD_Studio_System_GetBank(this.handle, encoder.byteFromStringUTF8(path), out bank.handle); | ||
459 | } | ||
460 | } | ||
461 | |||
462 | public RESULT getEventByID(GUID id, out EventDescription _event) | ||
463 | { | ||
464 | return FMOD_Studio_System_GetEventByID(this.handle, ref id, out _event.handle); | ||
465 | } | ||
466 | public RESULT getBusByID(GUID id, out Bus bus) | ||
467 | { | ||
468 | return FMOD_Studio_System_GetBusByID(this.handle, ref id, out bus.handle); | ||
469 | } | ||
470 | public RESULT getVCAByID(GUID id, out VCA vca) | ||
471 | { | ||
472 | return FMOD_Studio_System_GetVCAByID(this.handle, ref id, out vca.handle); | ||
473 | } | ||
474 | public RESULT getBankByID(GUID id, out Bank bank) | ||
475 | { | ||
476 | return FMOD_Studio_System_GetBankByID(this.handle, ref id, out bank.handle); | ||
477 | } | ||
478 | public RESULT getSoundInfo(string key, out SOUND_INFO info) | ||
479 | { | ||
480 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
481 | { | ||
482 | return FMOD_Studio_System_GetSoundInfo(this.handle, encoder.byteFromStringUTF8(key), out info); | ||
483 | } | ||
484 | } | ||
485 | public RESULT getParameterDescriptionByName(string name, out PARAMETER_DESCRIPTION parameter) | ||
486 | { | ||
487 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
488 | { | ||
489 | return FMOD_Studio_System_GetParameterDescriptionByName(this.handle, encoder.byteFromStringUTF8(name), out parameter); | ||
490 | } | ||
491 | } | ||
492 | public RESULT getParameterDescriptionByID(PARAMETER_ID id, out PARAMETER_DESCRIPTION parameter) | ||
493 | { | ||
494 | return FMOD_Studio_System_GetParameterDescriptionByID(this.handle, id, out parameter); | ||
495 | } | ||
496 | public RESULT getParameterLabelByName(string name, int labelindex, out string label) | ||
497 | { | ||
498 | label = null; | ||
499 | |||
500 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
501 | { | ||
502 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
503 | int retrieved = 0; | ||
504 | byte[] nameBytes = encoder.byteFromStringUTF8(name); | ||
505 | RESULT result = FMOD_Studio_System_GetParameterLabelByName(this.handle, nameBytes, labelindex, stringMem, 256, out retrieved); | ||
506 | |||
507 | if (result == RESULT.ERR_TRUNCATED) | ||
508 | { | ||
509 | Marshal.FreeHGlobal(stringMem); | ||
510 | result = FMOD_Studio_System_GetParameterLabelByName(this.handle, nameBytes, labelindex, IntPtr.Zero, 0, out retrieved); | ||
511 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
512 | result = FMOD_Studio_System_GetParameterLabelByName(this.handle, nameBytes, labelindex, stringMem, retrieved, out retrieved); | ||
513 | } | ||
514 | |||
515 | if (result == RESULT.OK) | ||
516 | { | ||
517 | label = encoder.stringFromNative(stringMem); | ||
518 | } | ||
519 | Marshal.FreeHGlobal(stringMem); | ||
520 | return result; | ||
521 | } | ||
522 | } | ||
523 | public RESULT getParameterLabelByID(PARAMETER_ID id, int labelindex, out string label) | ||
524 | { | ||
525 | label = null; | ||
526 | |||
527 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
528 | { | ||
529 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
530 | int retrieved = 0; | ||
531 | RESULT result = FMOD_Studio_System_GetParameterLabelByID(this.handle, id, labelindex, stringMem, 256, out retrieved); | ||
532 | |||
533 | if (result == RESULT.ERR_TRUNCATED) | ||
534 | { | ||
535 | Marshal.FreeHGlobal(stringMem); | ||
536 | result = FMOD_Studio_System_GetParameterLabelByID(this.handle, id, labelindex, IntPtr.Zero, 0, out retrieved); | ||
537 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
538 | result = FMOD_Studio_System_GetParameterLabelByID(this.handle, id, labelindex, stringMem, retrieved, out retrieved); | ||
539 | } | ||
540 | |||
541 | if (result == RESULT.OK) | ||
542 | { | ||
543 | label = encoder.stringFromNative(stringMem); | ||
544 | } | ||
545 | Marshal.FreeHGlobal(stringMem); | ||
546 | return result; | ||
547 | } | ||
548 | } | ||
549 | public RESULT getParameterByID(PARAMETER_ID id, out float value) | ||
550 | { | ||
551 | float finalValue; | ||
552 | return getParameterByID(id, out value, out finalValue); | ||
553 | } | ||
554 | public RESULT getParameterByID(PARAMETER_ID id, out float value, out float finalvalue) | ||
555 | { | ||
556 | return FMOD_Studio_System_GetParameterByID(this.handle, id, out value, out finalvalue); | ||
557 | } | ||
558 | public RESULT setParameterByID(PARAMETER_ID id, float value, bool ignoreseekspeed = false) | ||
559 | { | ||
560 | return FMOD_Studio_System_SetParameterByID(this.handle, id, value, ignoreseekspeed); | ||
561 | } | ||
562 | public RESULT setParameterByIDWithLabel(PARAMETER_ID id, string label, bool ignoreseekspeed = false) | ||
563 | { | ||
564 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
565 | { | ||
566 | return FMOD_Studio_System_SetParameterByIDWithLabel(this.handle, id, encoder.byteFromStringUTF8(label), ignoreseekspeed); | ||
567 | } | ||
568 | } | ||
569 | public RESULT setParametersByIDs(PARAMETER_ID[] ids, float[] values, int count, bool ignoreseekspeed = false) | ||
570 | { | ||
571 | return FMOD_Studio_System_SetParametersByIDs(this.handle, ids, values, count, ignoreseekspeed); | ||
572 | } | ||
573 | public RESULT getParameterByName(string name, out float value) | ||
574 | { | ||
575 | float finalValue; | ||
576 | return getParameterByName(name, out value, out finalValue); | ||
577 | } | ||
578 | public RESULT getParameterByName(string name, out float value, out float finalvalue) | ||
579 | { | ||
580 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
581 | { | ||
582 | return FMOD_Studio_System_GetParameterByName(this.handle, encoder.byteFromStringUTF8(name), out value, out finalvalue); | ||
583 | } | ||
584 | } | ||
585 | public RESULT setParameterByName(string name, float value, bool ignoreseekspeed = false) | ||
586 | { | ||
587 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
588 | { | ||
589 | return FMOD_Studio_System_SetParameterByName(this.handle, encoder.byteFromStringUTF8(name), value, ignoreseekspeed); | ||
590 | } | ||
591 | } | ||
592 | public RESULT setParameterByNameWithLabel(string name, string label, bool ignoreseekspeed = false) | ||
593 | { | ||
594 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper(), | ||
595 | labelEncoder = StringHelper.GetFreeHelper()) | ||
596 | { | ||
597 | return FMOD_Studio_System_SetParameterByNameWithLabel(this.handle, encoder.byteFromStringUTF8(name), labelEncoder.byteFromStringUTF8(label), ignoreseekspeed); | ||
598 | } | ||
599 | } | ||
600 | public RESULT lookupID(string path, out GUID id) | ||
601 | { | ||
602 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
603 | { | ||
604 | return FMOD_Studio_System_LookupID(this.handle, encoder.byteFromStringUTF8(path), out id); | ||
605 | } | ||
606 | } | ||
607 | public RESULT lookupPath(GUID id, out string path) | ||
608 | { | ||
609 | path = null; | ||
610 | |||
611 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
612 | { | ||
613 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
614 | int retrieved = 0; | ||
615 | RESULT result = FMOD_Studio_System_LookupPath(this.handle, ref id, stringMem, 256, out retrieved); | ||
616 | |||
617 | if (result == RESULT.ERR_TRUNCATED) | ||
618 | { | ||
619 | Marshal.FreeHGlobal(stringMem); | ||
620 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
621 | result = FMOD_Studio_System_LookupPath(this.handle, ref id, stringMem, retrieved, out retrieved); | ||
622 | } | ||
623 | |||
624 | if (result == RESULT.OK) | ||
625 | { | ||
626 | path = encoder.stringFromNative(stringMem); | ||
627 | } | ||
628 | Marshal.FreeHGlobal(stringMem); | ||
629 | return result; | ||
630 | } | ||
631 | } | ||
632 | public RESULT getNumListeners(out int numlisteners) | ||
633 | { | ||
634 | return FMOD_Studio_System_GetNumListeners(this.handle, out numlisteners); | ||
635 | } | ||
636 | public RESULT setNumListeners(int numlisteners) | ||
637 | { | ||
638 | return FMOD_Studio_System_SetNumListeners(this.handle, numlisteners); | ||
639 | } | ||
640 | public RESULT getListenerAttributes(int listener, out ATTRIBUTES_3D attributes) | ||
641 | { | ||
642 | return FMOD_Studio_System_GetListenerAttributes(this.handle, listener, out attributes, IntPtr.Zero); | ||
643 | } | ||
644 | public RESULT getListenerAttributes(int listener, out ATTRIBUTES_3D attributes, out VECTOR attenuationposition) | ||
645 | { | ||
646 | return FMOD_Studio_System_GetListenerAttributes(this.handle, listener, out attributes, out attenuationposition); | ||
647 | } | ||
648 | public RESULT setListenerAttributes(int listener, ATTRIBUTES_3D attributes) | ||
649 | { | ||
650 | return FMOD_Studio_System_SetListenerAttributes(this.handle, listener, ref attributes, IntPtr.Zero); | ||
651 | } | ||
652 | public RESULT setListenerAttributes(int listener, ATTRIBUTES_3D attributes, VECTOR attenuationposition) | ||
653 | { | ||
654 | return FMOD_Studio_System_SetListenerAttributes(this.handle, listener, ref attributes, ref attenuationposition); | ||
655 | } | ||
656 | public RESULT getListenerWeight(int listener, out float weight) | ||
657 | { | ||
658 | return FMOD_Studio_System_GetListenerWeight(this.handle, listener, out weight); | ||
659 | } | ||
660 | public RESULT setListenerWeight(int listener, float weight) | ||
661 | { | ||
662 | return FMOD_Studio_System_SetListenerWeight(this.handle, listener, weight); | ||
663 | } | ||
664 | public RESULT loadBankFile(string filename, LOAD_BANK_FLAGS flags, out Bank bank) | ||
665 | { | ||
666 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
667 | { | ||
668 | return FMOD_Studio_System_LoadBankFile(this.handle, encoder.byteFromStringUTF8(filename), flags, out bank.handle); | ||
669 | } | ||
670 | } | ||
671 | public RESULT loadBankMemory(byte[] buffer, LOAD_BANK_FLAGS flags, out Bank bank) | ||
672 | { | ||
673 | // Manually pin the byte array. It's what the marshaller should do anyway but don't leave it to chance. | ||
674 | GCHandle pinnedArray = GCHandle.Alloc(buffer, GCHandleType.Pinned); | ||
675 | IntPtr pointer = pinnedArray.AddrOfPinnedObject(); | ||
676 | RESULT result = FMOD_Studio_System_LoadBankMemory(this.handle, pointer, buffer.Length, LOAD_MEMORY_MODE.LOAD_MEMORY, flags, out bank.handle); | ||
677 | pinnedArray.Free(); | ||
678 | return result; | ||
679 | } | ||
680 | public RESULT loadBankCustom(BANK_INFO info, LOAD_BANK_FLAGS flags, out Bank bank) | ||
681 | { | ||
682 | info.size = MarshalHelper.SizeOf(typeof(BANK_INFO)); | ||
683 | return FMOD_Studio_System_LoadBankCustom(this.handle, ref info, flags, out bank.handle); | ||
684 | } | ||
685 | public RESULT unloadAll() | ||
686 | { | ||
687 | return FMOD_Studio_System_UnloadAll(this.handle); | ||
688 | } | ||
689 | public RESULT flushCommands() | ||
690 | { | ||
691 | return FMOD_Studio_System_FlushCommands(this.handle); | ||
692 | } | ||
693 | public RESULT flushSampleLoading() | ||
694 | { | ||
695 | return FMOD_Studio_System_FlushSampleLoading(this.handle); | ||
696 | } | ||
697 | public RESULT startCommandCapture(string filename, COMMANDCAPTURE_FLAGS flags) | ||
698 | { | ||
699 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
700 | { | ||
701 | return FMOD_Studio_System_StartCommandCapture(this.handle, encoder.byteFromStringUTF8(filename), flags); | ||
702 | } | ||
703 | } | ||
704 | public RESULT stopCommandCapture() | ||
705 | { | ||
706 | return FMOD_Studio_System_StopCommandCapture(this.handle); | ||
707 | } | ||
708 | public RESULT loadCommandReplay(string filename, COMMANDREPLAY_FLAGS flags, out CommandReplay replay) | ||
709 | { | ||
710 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
711 | { | ||
712 | return FMOD_Studio_System_LoadCommandReplay(this.handle, encoder.byteFromStringUTF8(filename), flags, out replay.handle); | ||
713 | } | ||
714 | } | ||
715 | public RESULT getBankCount(out int count) | ||
716 | { | ||
717 | return FMOD_Studio_System_GetBankCount(this.handle, out count); | ||
718 | } | ||
719 | public RESULT getBankList(out Bank[] array) | ||
720 | { | ||
721 | array = null; | ||
722 | |||
723 | RESULT result; | ||
724 | int capacity; | ||
725 | result = FMOD_Studio_System_GetBankCount(this.handle, out capacity); | ||
726 | if (result != RESULT.OK) | ||
727 | { | ||
728 | return result; | ||
729 | } | ||
730 | if (capacity == 0) | ||
731 | { | ||
732 | array = new Bank[0]; | ||
733 | return result; | ||
734 | } | ||
735 | |||
736 | IntPtr[] rawArray = new IntPtr[capacity]; | ||
737 | int actualCount; | ||
738 | result = FMOD_Studio_System_GetBankList(this.handle, rawArray, capacity, out actualCount); | ||
739 | if (result != RESULT.OK) | ||
740 | { | ||
741 | return result; | ||
742 | } | ||
743 | if (actualCount > capacity) // More items added since we queried just now? | ||
744 | { | ||
745 | actualCount = capacity; | ||
746 | } | ||
747 | array = new Bank[actualCount]; | ||
748 | for (int i = 0; i < actualCount; ++i) | ||
749 | { | ||
750 | array[i].handle = rawArray[i]; | ||
751 | } | ||
752 | return RESULT.OK; | ||
753 | } | ||
754 | public RESULT getParameterDescriptionCount(out int count) | ||
755 | { | ||
756 | return FMOD_Studio_System_GetParameterDescriptionCount(this.handle, out count); | ||
757 | } | ||
758 | public RESULT getParameterDescriptionList(out PARAMETER_DESCRIPTION[] array) | ||
759 | { | ||
760 | array = null; | ||
761 | |||
762 | int capacity; | ||
763 | RESULT result = FMOD_Studio_System_GetParameterDescriptionCount(this.handle, out capacity); | ||
764 | if (result != RESULT.OK) | ||
765 | { | ||
766 | return result; | ||
767 | } | ||
768 | if (capacity == 0) | ||
769 | { | ||
770 | array = new PARAMETER_DESCRIPTION[0]; | ||
771 | return RESULT.OK; | ||
772 | } | ||
773 | |||
774 | PARAMETER_DESCRIPTION[] tempArray = new PARAMETER_DESCRIPTION[capacity]; | ||
775 | int actualCount; | ||
776 | result = FMOD_Studio_System_GetParameterDescriptionList(this.handle, tempArray, capacity, out actualCount); | ||
777 | if (result != RESULT.OK) | ||
778 | { | ||
779 | return result; | ||
780 | } | ||
781 | |||
782 | if (actualCount != capacity) | ||
783 | { | ||
784 | Array.Resize(ref tempArray, actualCount); | ||
785 | } | ||
786 | |||
787 | array = tempArray; | ||
788 | |||
789 | return RESULT.OK; | ||
790 | } | ||
791 | public RESULT getCPUUsage(out CPU_USAGE usage, out FMOD.CPU_USAGE usage_core) | ||
792 | { | ||
793 | return FMOD_Studio_System_GetCPUUsage(this.handle, out usage, out usage_core); | ||
794 | } | ||
795 | public RESULT getBufferUsage(out BUFFER_USAGE usage) | ||
796 | { | ||
797 | return FMOD_Studio_System_GetBufferUsage(this.handle, out usage); | ||
798 | } | ||
799 | public RESULT resetBufferUsage() | ||
800 | { | ||
801 | return FMOD_Studio_System_ResetBufferUsage(this.handle); | ||
802 | } | ||
803 | |||
804 | public RESULT setCallback(SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask = SYSTEM_CALLBACK_TYPE.ALL) | ||
805 | { | ||
806 | return FMOD_Studio_System_SetCallback(this.handle, callback, callbackmask); | ||
807 | } | ||
808 | |||
809 | public RESULT getUserData(out IntPtr userdata) | ||
810 | { | ||
811 | return FMOD_Studio_System_GetUserData(this.handle, out userdata); | ||
812 | } | ||
813 | |||
814 | public RESULT setUserData(IntPtr userdata) | ||
815 | { | ||
816 | return FMOD_Studio_System_SetUserData(this.handle, userdata); | ||
817 | } | ||
818 | |||
819 | public RESULT getMemoryUsage(out MEMORY_USAGE memoryusage) | ||
820 | { | ||
821 | return FMOD_Studio_System_GetMemoryUsage(this.handle, out memoryusage); | ||
822 | } | ||
823 | |||
824 | #region importfunctions | ||
825 | [DllImport(STUDIO_VERSION.dll)] | ||
826 | private static extern RESULT FMOD_Studio_System_Create (out IntPtr system, uint headerversion); | ||
827 | [DllImport(STUDIO_VERSION.dll)] | ||
828 | private static extern bool FMOD_Studio_System_IsValid (IntPtr system); | ||
829 | [DllImport(STUDIO_VERSION.dll)] | ||
830 | private static extern RESULT FMOD_Studio_System_SetAdvancedSettings (IntPtr system, ref ADVANCEDSETTINGS settings); | ||
831 | [DllImport(STUDIO_VERSION.dll)] | ||
832 | private static extern RESULT FMOD_Studio_System_GetAdvancedSettings (IntPtr system, out ADVANCEDSETTINGS settings); | ||
833 | [DllImport(STUDIO_VERSION.dll)] | ||
834 | private static extern RESULT FMOD_Studio_System_Initialize (IntPtr system, int maxchannels, INITFLAGS studioflags, FMOD.INITFLAGS flags, IntPtr extradriverdata); | ||
835 | [DllImport(STUDIO_VERSION.dll)] | ||
836 | private static extern RESULT FMOD_Studio_System_Release (IntPtr system); | ||
837 | [DllImport(STUDIO_VERSION.dll)] | ||
838 | private static extern RESULT FMOD_Studio_System_Update (IntPtr system); | ||
839 | [DllImport(STUDIO_VERSION.dll)] | ||
840 | private static extern RESULT FMOD_Studio_System_GetCoreSystem (IntPtr system, out IntPtr coresystem); | ||
841 | [DllImport(STUDIO_VERSION.dll)] | ||
842 | private static extern RESULT FMOD_Studio_System_GetEvent (IntPtr system, byte[] path, out IntPtr _event); | ||
843 | [DllImport(STUDIO_VERSION.dll)] | ||
844 | private static extern RESULT FMOD_Studio_System_GetBus (IntPtr system, byte[] path, out IntPtr bus); | ||
845 | [DllImport(STUDIO_VERSION.dll)] | ||
846 | private static extern RESULT FMOD_Studio_System_GetVCA (IntPtr system, byte[] path, out IntPtr vca); | ||
847 | [DllImport(STUDIO_VERSION.dll)] | ||
848 | private static extern RESULT FMOD_Studio_System_GetBank (IntPtr system, byte[] path, out IntPtr bank); | ||
849 | [DllImport(STUDIO_VERSION.dll)] | ||
850 | private static extern RESULT FMOD_Studio_System_GetEventByID (IntPtr system, ref GUID id, out IntPtr _event); | ||
851 | [DllImport(STUDIO_VERSION.dll)] | ||
852 | private static extern RESULT FMOD_Studio_System_GetBusByID (IntPtr system, ref GUID id, out IntPtr bus); | ||
853 | [DllImport(STUDIO_VERSION.dll)] | ||
854 | private static extern RESULT FMOD_Studio_System_GetVCAByID (IntPtr system, ref GUID id, out IntPtr vca); | ||
855 | [DllImport(STUDIO_VERSION.dll)] | ||
856 | private static extern RESULT FMOD_Studio_System_GetBankByID (IntPtr system, ref GUID id, out IntPtr bank); | ||
857 | [DllImport(STUDIO_VERSION.dll)] | ||
858 | private static extern RESULT FMOD_Studio_System_GetSoundInfo (IntPtr system, byte[] key, out SOUND_INFO info); | ||
859 | [DllImport(STUDIO_VERSION.dll)] | ||
860 | private static extern RESULT FMOD_Studio_System_GetParameterDescriptionByName(IntPtr system, byte[] name, out PARAMETER_DESCRIPTION parameter); | ||
861 | [DllImport(STUDIO_VERSION.dll)] | ||
862 | private static extern RESULT FMOD_Studio_System_GetParameterDescriptionByID(IntPtr system, PARAMETER_ID id, out PARAMETER_DESCRIPTION parameter); | ||
863 | [DllImport(STUDIO_VERSION.dll)] | ||
864 | private static extern RESULT FMOD_Studio_System_GetParameterLabelByName (IntPtr system, byte[] name, int labelindex, IntPtr label, int size, out int retrieved); | ||
865 | [DllImport(STUDIO_VERSION.dll)] | ||
866 | private static extern RESULT FMOD_Studio_System_GetParameterLabelByID (IntPtr system, PARAMETER_ID id, int labelindex, IntPtr label, int size, out int retrieved); | ||
867 | [DllImport(STUDIO_VERSION.dll)] | ||
868 | private static extern RESULT FMOD_Studio_System_GetParameterByID (IntPtr system, PARAMETER_ID id, out float value, out float finalvalue); | ||
869 | [DllImport(STUDIO_VERSION.dll)] | ||
870 | private static extern RESULT FMOD_Studio_System_SetParameterByID (IntPtr system, PARAMETER_ID id, float value, bool ignoreseekspeed); | ||
871 | [DllImport(STUDIO_VERSION.dll)] | ||
872 | private static extern RESULT FMOD_Studio_System_SetParameterByIDWithLabel (IntPtr system, PARAMETER_ID id, byte[] label, bool ignoreseekspeed); | ||
873 | [DllImport(STUDIO_VERSION.dll)] | ||
874 | private static extern RESULT FMOD_Studio_System_SetParametersByIDs (IntPtr system, PARAMETER_ID[] ids, float[] values, int count, bool ignoreseekspeed); | ||
875 | [DllImport(STUDIO_VERSION.dll)] | ||
876 | private static extern RESULT FMOD_Studio_System_GetParameterByName (IntPtr system, byte[] name, out float value, out float finalvalue); | ||
877 | [DllImport(STUDIO_VERSION.dll)] | ||
878 | private static extern RESULT FMOD_Studio_System_SetParameterByName (IntPtr system, byte[] name, float value, bool ignoreseekspeed); | ||
879 | [DllImport(STUDIO_VERSION.dll)] | ||
880 | private static extern RESULT FMOD_Studio_System_SetParameterByNameWithLabel (IntPtr system, byte[] name, byte[] label, bool ignoreseekspeed); | ||
881 | [DllImport(STUDIO_VERSION.dll)] | ||
882 | private static extern RESULT FMOD_Studio_System_LookupID (IntPtr system, byte[] path, out GUID id); | ||
883 | [DllImport(STUDIO_VERSION.dll)] | ||
884 | private static extern RESULT FMOD_Studio_System_LookupPath (IntPtr system, ref GUID id, IntPtr path, int size, out int retrieved); | ||
885 | [DllImport(STUDIO_VERSION.dll)] | ||
886 | private static extern RESULT FMOD_Studio_System_GetNumListeners (IntPtr system, out int numlisteners); | ||
887 | [DllImport(STUDIO_VERSION.dll)] | ||
888 | private static extern RESULT FMOD_Studio_System_SetNumListeners (IntPtr system, int numlisteners); | ||
889 | [DllImport(STUDIO_VERSION.dll)] | ||
890 | private static extern RESULT FMOD_Studio_System_GetListenerAttributes (IntPtr system, int listener, out ATTRIBUTES_3D attributes, IntPtr zero); | ||
891 | [DllImport(STUDIO_VERSION.dll)] | ||
892 | private static extern RESULT FMOD_Studio_System_GetListenerAttributes (IntPtr system, int listener, out ATTRIBUTES_3D attributes, out VECTOR attenuationposition); | ||
893 | [DllImport(STUDIO_VERSION.dll)] | ||
894 | private static extern RESULT FMOD_Studio_System_SetListenerAttributes (IntPtr system, int listener, ref ATTRIBUTES_3D attributes, IntPtr zero); | ||
895 | [DllImport(STUDIO_VERSION.dll)] | ||
896 | private static extern RESULT FMOD_Studio_System_SetListenerAttributes (IntPtr system, int listener, ref ATTRIBUTES_3D attributes, ref VECTOR attenuationposition); | ||
897 | [DllImport(STUDIO_VERSION.dll)] | ||
898 | private static extern RESULT FMOD_Studio_System_GetListenerWeight (IntPtr system, int listener, out float weight); | ||
899 | [DllImport(STUDIO_VERSION.dll)] | ||
900 | private static extern RESULT FMOD_Studio_System_SetListenerWeight (IntPtr system, int listener, float weight); | ||
901 | [DllImport(STUDIO_VERSION.dll)] | ||
902 | private static extern RESULT FMOD_Studio_System_LoadBankFile (IntPtr system, byte[] filename, LOAD_BANK_FLAGS flags, out IntPtr bank); | ||
903 | [DllImport(STUDIO_VERSION.dll)] | ||
904 | private static extern RESULT FMOD_Studio_System_LoadBankMemory (IntPtr system, IntPtr buffer, int length, LOAD_MEMORY_MODE mode, LOAD_BANK_FLAGS flags, out IntPtr bank); | ||
905 | [DllImport(STUDIO_VERSION.dll)] | ||
906 | private static extern RESULT FMOD_Studio_System_LoadBankCustom (IntPtr system, ref BANK_INFO info, LOAD_BANK_FLAGS flags, out IntPtr bank); | ||
907 | [DllImport(STUDIO_VERSION.dll)] | ||
908 | private static extern RESULT FMOD_Studio_System_UnloadAll (IntPtr system); | ||
909 | [DllImport(STUDIO_VERSION.dll)] | ||
910 | private static extern RESULT FMOD_Studio_System_FlushCommands (IntPtr system); | ||
911 | [DllImport(STUDIO_VERSION.dll)] | ||
912 | private static extern RESULT FMOD_Studio_System_FlushSampleLoading (IntPtr system); | ||
913 | [DllImport(STUDIO_VERSION.dll)] | ||
914 | private static extern RESULT FMOD_Studio_System_StartCommandCapture (IntPtr system, byte[] filename, COMMANDCAPTURE_FLAGS flags); | ||
915 | [DllImport(STUDIO_VERSION.dll)] | ||
916 | private static extern RESULT FMOD_Studio_System_StopCommandCapture (IntPtr system); | ||
917 | [DllImport(STUDIO_VERSION.dll)] | ||
918 | private static extern RESULT FMOD_Studio_System_LoadCommandReplay (IntPtr system, byte[] filename, COMMANDREPLAY_FLAGS flags, out IntPtr replay); | ||
919 | [DllImport(STUDIO_VERSION.dll)] | ||
920 | private static extern RESULT FMOD_Studio_System_GetBankCount (IntPtr system, out int count); | ||
921 | [DllImport(STUDIO_VERSION.dll)] | ||
922 | private static extern RESULT FMOD_Studio_System_GetBankList (IntPtr system, IntPtr[] array, int capacity, out int count); | ||
923 | [DllImport(STUDIO_VERSION.dll)] | ||
924 | private static extern RESULT FMOD_Studio_System_GetParameterDescriptionCount(IntPtr system, out int count); | ||
925 | [DllImport(STUDIO_VERSION.dll)] | ||
926 | private static extern RESULT FMOD_Studio_System_GetParameterDescriptionList(IntPtr system, [Out] PARAMETER_DESCRIPTION[] array, int capacity, out int count); | ||
927 | [DllImport(STUDIO_VERSION.dll)] | ||
928 | private static extern RESULT FMOD_Studio_System_GetCPUUsage (IntPtr system, out CPU_USAGE usage, out FMOD.CPU_USAGE usage_core); | ||
929 | [DllImport(STUDIO_VERSION.dll)] | ||
930 | private static extern RESULT FMOD_Studio_System_GetBufferUsage (IntPtr system, out BUFFER_USAGE usage); | ||
931 | [DllImport(STUDIO_VERSION.dll)] | ||
932 | private static extern RESULT FMOD_Studio_System_ResetBufferUsage (IntPtr system); | ||
933 | [DllImport(STUDIO_VERSION.dll)] | ||
934 | private static extern RESULT FMOD_Studio_System_SetCallback (IntPtr system, SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask); | ||
935 | [DllImport(STUDIO_VERSION.dll)] | ||
936 | private static extern RESULT FMOD_Studio_System_GetUserData (IntPtr system, out IntPtr userdata); | ||
937 | [DllImport(STUDIO_VERSION.dll)] | ||
938 | private static extern RESULT FMOD_Studio_System_SetUserData (IntPtr system, IntPtr userdata); | ||
939 | [DllImport(STUDIO_VERSION.dll)] | ||
940 | private static extern RESULT FMOD_Studio_System_GetMemoryUsage (IntPtr system, out MEMORY_USAGE memoryusage); | ||
941 | #endregion | ||
942 | |||
943 | #region wrapperinternal | ||
944 | |||
945 | public IntPtr handle; | ||
946 | |||
947 | public System(IntPtr ptr) { this.handle = ptr; } | ||
948 | public bool hasHandle() { return this.handle != IntPtr.Zero; } | ||
949 | public void clearHandle() { this.handle = IntPtr.Zero; } | ||
950 | |||
951 | public bool isValid() | ||
952 | { | ||
953 | return hasHandle() && FMOD_Studio_System_IsValid(this.handle); | ||
954 | } | ||
955 | |||
956 | #endregion | ||
957 | } | ||
958 | |||
959 | public struct EventDescription | ||
960 | { | ||
961 | public RESULT getID(out GUID id) | ||
962 | { | ||
963 | return FMOD_Studio_EventDescription_GetID(this.handle, out id); | ||
964 | } | ||
965 | public RESULT getPath(out string path) | ||
966 | { | ||
967 | path = null; | ||
968 | |||
969 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
970 | { | ||
971 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
972 | int retrieved = 0; | ||
973 | RESULT result = FMOD_Studio_EventDescription_GetPath(this.handle, stringMem, 256, out retrieved); | ||
974 | |||
975 | if (result == RESULT.ERR_TRUNCATED) | ||
976 | { | ||
977 | Marshal.FreeHGlobal(stringMem); | ||
978 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
979 | result = FMOD_Studio_EventDescription_GetPath(this.handle, stringMem, retrieved, out retrieved); | ||
980 | } | ||
981 | |||
982 | if (result == RESULT.OK) | ||
983 | { | ||
984 | path = encoder.stringFromNative(stringMem); | ||
985 | } | ||
986 | Marshal.FreeHGlobal(stringMem); | ||
987 | return result; | ||
988 | } | ||
989 | } | ||
990 | public RESULT getParameterDescriptionCount(out int count) | ||
991 | { | ||
992 | return FMOD_Studio_EventDescription_GetParameterDescriptionCount(this.handle, out count); | ||
993 | } | ||
994 | public RESULT getParameterDescriptionByIndex(int index, out PARAMETER_DESCRIPTION parameter) | ||
995 | { | ||
996 | return FMOD_Studio_EventDescription_GetParameterDescriptionByIndex(this.handle, index, out parameter); | ||
997 | } | ||
998 | public RESULT getParameterDescriptionByName(string name, out PARAMETER_DESCRIPTION parameter) | ||
999 | { | ||
1000 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1001 | { | ||
1002 | return FMOD_Studio_EventDescription_GetParameterDescriptionByName(this.handle, encoder.byteFromStringUTF8(name), out parameter); | ||
1003 | } | ||
1004 | } | ||
1005 | public RESULT getParameterDescriptionByID(PARAMETER_ID id, out PARAMETER_DESCRIPTION parameter) | ||
1006 | { | ||
1007 | return FMOD_Studio_EventDescription_GetParameterDescriptionByID(this.handle, id, out parameter); | ||
1008 | } | ||
1009 | public RESULT getParameterLabelByIndex(int index, int labelindex, out string label) | ||
1010 | { | ||
1011 | label = null; | ||
1012 | |||
1013 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1014 | { | ||
1015 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
1016 | int retrieved = 0; | ||
1017 | RESULT result = FMOD_Studio_EventDescription_GetParameterLabelByIndex(this.handle, index, labelindex, stringMem, 256, out retrieved); | ||
1018 | |||
1019 | if (result == RESULT.ERR_TRUNCATED) | ||
1020 | { | ||
1021 | Marshal.FreeHGlobal(stringMem); | ||
1022 | result = FMOD_Studio_EventDescription_GetParameterLabelByIndex(this.handle, index, labelindex, IntPtr.Zero, 0, out retrieved); | ||
1023 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
1024 | result = FMOD_Studio_EventDescription_GetParameterLabelByIndex(this.handle, index, labelindex, stringMem, retrieved, out retrieved); | ||
1025 | } | ||
1026 | |||
1027 | if (result == RESULT.OK) | ||
1028 | { | ||
1029 | label = encoder.stringFromNative(stringMem); | ||
1030 | } | ||
1031 | Marshal.FreeHGlobal(stringMem); | ||
1032 | return result; | ||
1033 | } | ||
1034 | } | ||
1035 | public RESULT getParameterLabelByName(string name, int labelindex, out string label) | ||
1036 | { | ||
1037 | label = null; | ||
1038 | |||
1039 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1040 | { | ||
1041 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
1042 | int retrieved = 0; | ||
1043 | byte[] nameBytes = encoder.byteFromStringUTF8(name); | ||
1044 | RESULT result = FMOD_Studio_EventDescription_GetParameterLabelByName(this.handle, nameBytes, labelindex, stringMem, 256, out retrieved); | ||
1045 | |||
1046 | if (result == RESULT.ERR_TRUNCATED) | ||
1047 | { | ||
1048 | Marshal.FreeHGlobal(stringMem); | ||
1049 | result = FMOD_Studio_EventDescription_GetParameterLabelByName(this.handle, nameBytes, labelindex, IntPtr.Zero, 0, out retrieved); | ||
1050 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
1051 | result = FMOD_Studio_EventDescription_GetParameterLabelByName(this.handle, nameBytes, labelindex, stringMem, retrieved, out retrieved); | ||
1052 | } | ||
1053 | |||
1054 | if (result == RESULT.OK) | ||
1055 | { | ||
1056 | label = encoder.stringFromNative(stringMem); | ||
1057 | } | ||
1058 | Marshal.FreeHGlobal(stringMem); | ||
1059 | return result; | ||
1060 | } | ||
1061 | } | ||
1062 | public RESULT getParameterLabelByID(PARAMETER_ID id, int labelindex, out string label) | ||
1063 | { | ||
1064 | label = null; | ||
1065 | |||
1066 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1067 | { | ||
1068 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
1069 | int retrieved = 0; | ||
1070 | RESULT result = FMOD_Studio_EventDescription_GetParameterLabelByID(this.handle, id, labelindex, stringMem, 256, out retrieved); | ||
1071 | |||
1072 | if (result == RESULT.ERR_TRUNCATED) | ||
1073 | { | ||
1074 | Marshal.FreeHGlobal(stringMem); | ||
1075 | result = FMOD_Studio_EventDescription_GetParameterLabelByID(this.handle, id, labelindex, IntPtr.Zero, 0, out retrieved); | ||
1076 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
1077 | result = FMOD_Studio_EventDescription_GetParameterLabelByID(this.handle, id, labelindex, stringMem, retrieved, out retrieved); | ||
1078 | } | ||
1079 | |||
1080 | if (result == RESULT.OK) | ||
1081 | { | ||
1082 | label = encoder.stringFromNative(stringMem); | ||
1083 | } | ||
1084 | Marshal.FreeHGlobal(stringMem); | ||
1085 | return result; | ||
1086 | } | ||
1087 | } | ||
1088 | public RESULT getUserPropertyCount(out int count) | ||
1089 | { | ||
1090 | return FMOD_Studio_EventDescription_GetUserPropertyCount(this.handle, out count); | ||
1091 | } | ||
1092 | public RESULT getUserPropertyByIndex(int index, out USER_PROPERTY property) | ||
1093 | { | ||
1094 | return FMOD_Studio_EventDescription_GetUserPropertyByIndex(this.handle, index, out property); | ||
1095 | } | ||
1096 | public RESULT getUserProperty(string name, out USER_PROPERTY property) | ||
1097 | { | ||
1098 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1099 | { | ||
1100 | return FMOD_Studio_EventDescription_GetUserProperty(this.handle, encoder.byteFromStringUTF8(name), out property); | ||
1101 | } | ||
1102 | } | ||
1103 | public RESULT getLength(out int length) | ||
1104 | { | ||
1105 | return FMOD_Studio_EventDescription_GetLength(this.handle, out length); | ||
1106 | } | ||
1107 | public RESULT getMinMaxDistance(out float min, out float max) | ||
1108 | { | ||
1109 | return FMOD_Studio_EventDescription_GetMinMaxDistance(this.handle, out min, out max); | ||
1110 | } | ||
1111 | public RESULT getSoundSize(out float size) | ||
1112 | { | ||
1113 | return FMOD_Studio_EventDescription_GetSoundSize(this.handle, out size); | ||
1114 | } | ||
1115 | public RESULT isSnapshot(out bool snapshot) | ||
1116 | { | ||
1117 | return FMOD_Studio_EventDescription_IsSnapshot(this.handle, out snapshot); | ||
1118 | } | ||
1119 | public RESULT isOneshot(out bool oneshot) | ||
1120 | { | ||
1121 | return FMOD_Studio_EventDescription_IsOneshot(this.handle, out oneshot); | ||
1122 | } | ||
1123 | public RESULT isStream(out bool isStream) | ||
1124 | { | ||
1125 | return FMOD_Studio_EventDescription_IsStream(this.handle, out isStream); | ||
1126 | } | ||
1127 | public RESULT is3D(out bool is3D) | ||
1128 | { | ||
1129 | return FMOD_Studio_EventDescription_Is3D(this.handle, out is3D); | ||
1130 | } | ||
1131 | public RESULT isDopplerEnabled(out bool doppler) | ||
1132 | { | ||
1133 | return FMOD_Studio_EventDescription_IsDopplerEnabled(this.handle, out doppler); | ||
1134 | } | ||
1135 | public RESULT hasSustainPoint(out bool sustainPoint) | ||
1136 | { | ||
1137 | return FMOD_Studio_EventDescription_HasSustainPoint(this.handle, out sustainPoint); | ||
1138 | } | ||
1139 | |||
1140 | public RESULT createInstance(out EventInstance instance) | ||
1141 | { | ||
1142 | return FMOD_Studio_EventDescription_CreateInstance(this.handle, out instance.handle); | ||
1143 | } | ||
1144 | |||
1145 | public RESULT getInstanceCount(out int count) | ||
1146 | { | ||
1147 | return FMOD_Studio_EventDescription_GetInstanceCount(this.handle, out count); | ||
1148 | } | ||
1149 | public RESULT getInstanceList(out EventInstance[] array) | ||
1150 | { | ||
1151 | array = null; | ||
1152 | |||
1153 | RESULT result; | ||
1154 | int capacity; | ||
1155 | result = FMOD_Studio_EventDescription_GetInstanceCount(this.handle, out capacity); | ||
1156 | if (result != RESULT.OK) | ||
1157 | { | ||
1158 | return result; | ||
1159 | } | ||
1160 | if (capacity == 0) | ||
1161 | { | ||
1162 | array = new EventInstance[0]; | ||
1163 | return result; | ||
1164 | } | ||
1165 | |||
1166 | IntPtr[] rawArray = new IntPtr[capacity]; | ||
1167 | int actualCount; | ||
1168 | result = FMOD_Studio_EventDescription_GetInstanceList(this.handle, rawArray, capacity, out actualCount); | ||
1169 | if (result != RESULT.OK) | ||
1170 | { | ||
1171 | return result; | ||
1172 | } | ||
1173 | if (actualCount > capacity) // More items added since we queried just now? | ||
1174 | { | ||
1175 | actualCount = capacity; | ||
1176 | } | ||
1177 | array = new EventInstance[actualCount]; | ||
1178 | for (int i = 0; i < actualCount; ++i) | ||
1179 | { | ||
1180 | array[i].handle = rawArray[i]; | ||
1181 | } | ||
1182 | return RESULT.OK; | ||
1183 | } | ||
1184 | |||
1185 | public RESULT loadSampleData() | ||
1186 | { | ||
1187 | return FMOD_Studio_EventDescription_LoadSampleData(this.handle); | ||
1188 | } | ||
1189 | |||
1190 | public RESULT unloadSampleData() | ||
1191 | { | ||
1192 | return FMOD_Studio_EventDescription_UnloadSampleData(this.handle); | ||
1193 | } | ||
1194 | |||
1195 | public RESULT getSampleLoadingState(out LOADING_STATE state) | ||
1196 | { | ||
1197 | return FMOD_Studio_EventDescription_GetSampleLoadingState(this.handle, out state); | ||
1198 | } | ||
1199 | |||
1200 | public RESULT releaseAllInstances() | ||
1201 | { | ||
1202 | return FMOD_Studio_EventDescription_ReleaseAllInstances(this.handle); | ||
1203 | } | ||
1204 | public RESULT setCallback(EVENT_CALLBACK callback, EVENT_CALLBACK_TYPE callbackmask = EVENT_CALLBACK_TYPE.ALL) | ||
1205 | { | ||
1206 | return FMOD_Studio_EventDescription_SetCallback(this.handle, callback, callbackmask); | ||
1207 | } | ||
1208 | |||
1209 | public RESULT getUserData(out IntPtr userdata) | ||
1210 | { | ||
1211 | return FMOD_Studio_EventDescription_GetUserData(this.handle, out userdata); | ||
1212 | } | ||
1213 | |||
1214 | public RESULT setUserData(IntPtr userdata) | ||
1215 | { | ||
1216 | return FMOD_Studio_EventDescription_SetUserData(this.handle, userdata); | ||
1217 | } | ||
1218 | |||
1219 | #region importfunctions | ||
1220 | [DllImport(STUDIO_VERSION.dll)] | ||
1221 | private static extern bool FMOD_Studio_EventDescription_IsValid (IntPtr eventdescription); | ||
1222 | [DllImport(STUDIO_VERSION.dll)] | ||
1223 | private static extern RESULT FMOD_Studio_EventDescription_GetID (IntPtr eventdescription, out GUID id); | ||
1224 | [DllImport(STUDIO_VERSION.dll)] | ||
1225 | private static extern RESULT FMOD_Studio_EventDescription_GetPath (IntPtr eventdescription, IntPtr path, int size, out int retrieved); | ||
1226 | [DllImport(STUDIO_VERSION.dll)] | ||
1227 | private static extern RESULT FMOD_Studio_EventDescription_GetParameterDescriptionCount(IntPtr eventdescription, out int count); | ||
1228 | [DllImport(STUDIO_VERSION.dll)] | ||
1229 | private static extern RESULT FMOD_Studio_EventDescription_GetParameterDescriptionByIndex(IntPtr eventdescription, int index, out PARAMETER_DESCRIPTION parameter); | ||
1230 | [DllImport(STUDIO_VERSION.dll)] | ||
1231 | private static extern RESULT FMOD_Studio_EventDescription_GetParameterDescriptionByName(IntPtr eventdescription, byte[] name, out PARAMETER_DESCRIPTION parameter); | ||
1232 | [DllImport(STUDIO_VERSION.dll)] | ||
1233 | private static extern RESULT FMOD_Studio_EventDescription_GetParameterDescriptionByID(IntPtr eventdescription, PARAMETER_ID id, out PARAMETER_DESCRIPTION parameter); | ||
1234 | [DllImport(STUDIO_VERSION.dll)] | ||
1235 | private static extern RESULT FMOD_Studio_EventDescription_GetParameterLabelByIndex(IntPtr eventdescription, int index, int labelindex, IntPtr label, int size, out int retrieved); | ||
1236 | [DllImport(STUDIO_VERSION.dll)] | ||
1237 | private static extern RESULT FMOD_Studio_EventDescription_GetParameterLabelByName(IntPtr eventdescription, byte[] name, int labelindex, IntPtr label, int size, out int retrieved); | ||
1238 | [DllImport(STUDIO_VERSION.dll)] | ||
1239 | private static extern RESULT FMOD_Studio_EventDescription_GetParameterLabelByID (IntPtr eventdescription, PARAMETER_ID id, int labelindex, IntPtr label, int size, out int retrieved); | ||
1240 | [DllImport(STUDIO_VERSION.dll)] | ||
1241 | private static extern RESULT FMOD_Studio_EventDescription_GetUserPropertyCount (IntPtr eventdescription, out int count); | ||
1242 | [DllImport(STUDIO_VERSION.dll)] | ||
1243 | private static extern RESULT FMOD_Studio_EventDescription_GetUserPropertyByIndex(IntPtr eventdescription, int index, out USER_PROPERTY property); | ||
1244 | [DllImport(STUDIO_VERSION.dll)] | ||
1245 | private static extern RESULT FMOD_Studio_EventDescription_GetUserProperty (IntPtr eventdescription, byte[] name, out USER_PROPERTY property); | ||
1246 | [DllImport(STUDIO_VERSION.dll)] | ||
1247 | private static extern RESULT FMOD_Studio_EventDescription_GetLength (IntPtr eventdescription, out int length); | ||
1248 | [DllImport(STUDIO_VERSION.dll)] | ||
1249 | private static extern RESULT FMOD_Studio_EventDescription_GetMinMaxDistance (IntPtr eventdescription, out float min, out float max); | ||
1250 | [DllImport(STUDIO_VERSION.dll)] | ||
1251 | private static extern RESULT FMOD_Studio_EventDescription_GetSoundSize (IntPtr eventdescription, out float size); | ||
1252 | [DllImport(STUDIO_VERSION.dll)] | ||
1253 | private static extern RESULT FMOD_Studio_EventDescription_IsSnapshot (IntPtr eventdescription, out bool snapshot); | ||
1254 | [DllImport(STUDIO_VERSION.dll)] | ||
1255 | private static extern RESULT FMOD_Studio_EventDescription_IsOneshot (IntPtr eventdescription, out bool oneshot); | ||
1256 | [DllImport(STUDIO_VERSION.dll)] | ||
1257 | private static extern RESULT FMOD_Studio_EventDescription_IsStream (IntPtr eventdescription, out bool isStream); | ||
1258 | [DllImport(STUDIO_VERSION.dll)] | ||
1259 | private static extern RESULT FMOD_Studio_EventDescription_Is3D (IntPtr eventdescription, out bool is3D); | ||
1260 | [DllImport(STUDIO_VERSION.dll)] | ||
1261 | private static extern RESULT FMOD_Studio_EventDescription_IsDopplerEnabled (IntPtr eventdescription, out bool doppler); | ||
1262 | [DllImport(STUDIO_VERSION.dll)] | ||
1263 | private static extern RESULT FMOD_Studio_EventDescription_HasSustainPoint (IntPtr eventdescription, out bool sustainPoint); | ||
1264 | [DllImport(STUDIO_VERSION.dll)] | ||
1265 | private static extern RESULT FMOD_Studio_EventDescription_CreateInstance (IntPtr eventdescription, out IntPtr instance); | ||
1266 | [DllImport(STUDIO_VERSION.dll)] | ||
1267 | private static extern RESULT FMOD_Studio_EventDescription_GetInstanceCount (IntPtr eventdescription, out int count); | ||
1268 | [DllImport(STUDIO_VERSION.dll)] | ||
1269 | private static extern RESULT FMOD_Studio_EventDescription_GetInstanceList (IntPtr eventdescription, IntPtr[] array, int capacity, out int count); | ||
1270 | [DllImport(STUDIO_VERSION.dll)] | ||
1271 | private static extern RESULT FMOD_Studio_EventDescription_LoadSampleData (IntPtr eventdescription); | ||
1272 | [DllImport(STUDIO_VERSION.dll)] | ||
1273 | private static extern RESULT FMOD_Studio_EventDescription_UnloadSampleData (IntPtr eventdescription); | ||
1274 | [DllImport(STUDIO_VERSION.dll)] | ||
1275 | private static extern RESULT FMOD_Studio_EventDescription_GetSampleLoadingState (IntPtr eventdescription, out LOADING_STATE state); | ||
1276 | [DllImport(STUDIO_VERSION.dll)] | ||
1277 | private static extern RESULT FMOD_Studio_EventDescription_ReleaseAllInstances (IntPtr eventdescription); | ||
1278 | [DllImport(STUDIO_VERSION.dll)] | ||
1279 | private static extern RESULT FMOD_Studio_EventDescription_SetCallback (IntPtr eventdescription, EVENT_CALLBACK callback, EVENT_CALLBACK_TYPE callbackmask); | ||
1280 | [DllImport(STUDIO_VERSION.dll)] | ||
1281 | private static extern RESULT FMOD_Studio_EventDescription_GetUserData (IntPtr eventdescription, out IntPtr userdata); | ||
1282 | [DllImport(STUDIO_VERSION.dll)] | ||
1283 | private static extern RESULT FMOD_Studio_EventDescription_SetUserData (IntPtr eventdescription, IntPtr userdata); | ||
1284 | #endregion | ||
1285 | #region wrapperinternal | ||
1286 | |||
1287 | public IntPtr handle; | ||
1288 | |||
1289 | public EventDescription(IntPtr ptr) { this.handle = ptr; } | ||
1290 | public bool hasHandle() { return this.handle != IntPtr.Zero; } | ||
1291 | public void clearHandle() { this.handle = IntPtr.Zero; } | ||
1292 | |||
1293 | public bool isValid() | ||
1294 | { | ||
1295 | return hasHandle() && FMOD_Studio_EventDescription_IsValid(this.handle); | ||
1296 | } | ||
1297 | |||
1298 | #endregion | ||
1299 | } | ||
1300 | |||
1301 | public struct EventInstance | ||
1302 | { | ||
1303 | public RESULT getDescription(out EventDescription description) | ||
1304 | { | ||
1305 | return FMOD_Studio_EventInstance_GetDescription(this.handle, out description.handle); | ||
1306 | } | ||
1307 | public RESULT getVolume(out float volume) | ||
1308 | { | ||
1309 | return FMOD_Studio_EventInstance_GetVolume(this.handle, out volume, IntPtr.Zero); | ||
1310 | } | ||
1311 | public RESULT getVolume(out float volume, out float finalvolume) | ||
1312 | { | ||
1313 | return FMOD_Studio_EventInstance_GetVolume(this.handle, out volume, out finalvolume); | ||
1314 | } | ||
1315 | public RESULT setVolume(float volume) | ||
1316 | { | ||
1317 | return FMOD_Studio_EventInstance_SetVolume(this.handle, volume); | ||
1318 | } | ||
1319 | public RESULT getPitch(out float pitch) | ||
1320 | { | ||
1321 | return FMOD_Studio_EventInstance_GetPitch(this.handle, out pitch, IntPtr.Zero); | ||
1322 | } | ||
1323 | public RESULT getPitch(out float pitch, out float finalpitch) | ||
1324 | { | ||
1325 | return FMOD_Studio_EventInstance_GetPitch(this.handle, out pitch, out finalpitch); | ||
1326 | } | ||
1327 | public RESULT setPitch(float pitch) | ||
1328 | { | ||
1329 | return FMOD_Studio_EventInstance_SetPitch(this.handle, pitch); | ||
1330 | } | ||
1331 | public RESULT get3DAttributes(out ATTRIBUTES_3D attributes) | ||
1332 | { | ||
1333 | return FMOD_Studio_EventInstance_Get3DAttributes(this.handle, out attributes); | ||
1334 | } | ||
1335 | public RESULT set3DAttributes(ATTRIBUTES_3D attributes) | ||
1336 | { | ||
1337 | return FMOD_Studio_EventInstance_Set3DAttributes(this.handle, ref attributes); | ||
1338 | } | ||
1339 | public RESULT getListenerMask(out uint mask) | ||
1340 | { | ||
1341 | return FMOD_Studio_EventInstance_GetListenerMask(this.handle, out mask); | ||
1342 | } | ||
1343 | public RESULT setListenerMask(uint mask) | ||
1344 | { | ||
1345 | return FMOD_Studio_EventInstance_SetListenerMask(this.handle, mask); | ||
1346 | } | ||
1347 | public RESULT getProperty(EVENT_PROPERTY index, out float value) | ||
1348 | { | ||
1349 | return FMOD_Studio_EventInstance_GetProperty(this.handle, index, out value); | ||
1350 | } | ||
1351 | public RESULT setProperty(EVENT_PROPERTY index, float value) | ||
1352 | { | ||
1353 | return FMOD_Studio_EventInstance_SetProperty(this.handle, index, value); | ||
1354 | } | ||
1355 | public RESULT getReverbLevel(int index, out float level) | ||
1356 | { | ||
1357 | return FMOD_Studio_EventInstance_GetReverbLevel(this.handle, index, out level); | ||
1358 | } | ||
1359 | public RESULT setReverbLevel(int index, float level) | ||
1360 | { | ||
1361 | return FMOD_Studio_EventInstance_SetReverbLevel(this.handle, index, level); | ||
1362 | } | ||
1363 | public RESULT getPaused(out bool paused) | ||
1364 | { | ||
1365 | return FMOD_Studio_EventInstance_GetPaused(this.handle, out paused); | ||
1366 | } | ||
1367 | public RESULT setPaused(bool paused) | ||
1368 | { | ||
1369 | return FMOD_Studio_EventInstance_SetPaused(this.handle, paused); | ||
1370 | } | ||
1371 | public RESULT start() | ||
1372 | { | ||
1373 | return FMOD_Studio_EventInstance_Start(this.handle); | ||
1374 | } | ||
1375 | public RESULT stop(STOP_MODE mode) | ||
1376 | { | ||
1377 | return FMOD_Studio_EventInstance_Stop(this.handle, mode); | ||
1378 | } | ||
1379 | public RESULT getTimelinePosition(out int position) | ||
1380 | { | ||
1381 | return FMOD_Studio_EventInstance_GetTimelinePosition(this.handle, out position); | ||
1382 | } | ||
1383 | public RESULT setTimelinePosition(int position) | ||
1384 | { | ||
1385 | return FMOD_Studio_EventInstance_SetTimelinePosition(this.handle, position); | ||
1386 | } | ||
1387 | public RESULT getPlaybackState(out PLAYBACK_STATE state) | ||
1388 | { | ||
1389 | return FMOD_Studio_EventInstance_GetPlaybackState(this.handle, out state); | ||
1390 | } | ||
1391 | public RESULT getChannelGroup(out FMOD.ChannelGroup group) | ||
1392 | { | ||
1393 | return FMOD_Studio_EventInstance_GetChannelGroup(this.handle, out group.handle); | ||
1394 | } | ||
1395 | public RESULT getMinMaxDistance(out float min, out float max) | ||
1396 | { | ||
1397 | return FMOD_Studio_EventInstance_GetMinMaxDistance(this.handle, out min, out max); | ||
1398 | } | ||
1399 | public RESULT release() | ||
1400 | { | ||
1401 | return FMOD_Studio_EventInstance_Release(this.handle); | ||
1402 | } | ||
1403 | public RESULT isVirtual(out bool virtualstate) | ||
1404 | { | ||
1405 | return FMOD_Studio_EventInstance_IsVirtual(this.handle, out virtualstate); | ||
1406 | } | ||
1407 | public RESULT getParameterByID(PARAMETER_ID id, out float value) | ||
1408 | { | ||
1409 | float finalvalue; | ||
1410 | return getParameterByID(id, out value, out finalvalue); | ||
1411 | } | ||
1412 | public RESULT getParameterByID(PARAMETER_ID id, out float value, out float finalvalue) | ||
1413 | { | ||
1414 | return FMOD_Studio_EventInstance_GetParameterByID(this.handle, id, out value, out finalvalue); | ||
1415 | } | ||
1416 | public RESULT setParameterByID(PARAMETER_ID id, float value, bool ignoreseekspeed = false) | ||
1417 | { | ||
1418 | return FMOD_Studio_EventInstance_SetParameterByID(this.handle, id, value, ignoreseekspeed); | ||
1419 | } | ||
1420 | public RESULT setParameterByIDWithLabel(PARAMETER_ID id, string label, bool ignoreseekspeed = false) | ||
1421 | { | ||
1422 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1423 | { | ||
1424 | return FMOD_Studio_EventInstance_SetParameterByIDWithLabel(this.handle, id, encoder.byteFromStringUTF8(label), ignoreseekspeed); | ||
1425 | } | ||
1426 | } | ||
1427 | public RESULT setParametersByIDs(PARAMETER_ID[] ids, float[] values, int count, bool ignoreseekspeed = false) | ||
1428 | { | ||
1429 | return FMOD_Studio_EventInstance_SetParametersByIDs(this.handle, ids, values, count, ignoreseekspeed); | ||
1430 | } | ||
1431 | public RESULT getParameterByName(string name, out float value) | ||
1432 | { | ||
1433 | float finalValue; | ||
1434 | return getParameterByName(name, out value, out finalValue); | ||
1435 | } | ||
1436 | public RESULT getParameterByName(string name, out float value, out float finalvalue) | ||
1437 | { | ||
1438 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1439 | { | ||
1440 | return FMOD_Studio_EventInstance_GetParameterByName(this.handle, encoder.byteFromStringUTF8(name), out value, out finalvalue); | ||
1441 | } | ||
1442 | } | ||
1443 | public RESULT setParameterByName(string name, float value, bool ignoreseekspeed = false) | ||
1444 | { | ||
1445 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1446 | { | ||
1447 | return FMOD_Studio_EventInstance_SetParameterByName(this.handle, encoder.byteFromStringUTF8(name), value, ignoreseekspeed); | ||
1448 | } | ||
1449 | } | ||
1450 | public RESULT setParameterByNameWithLabel(string name, string label, bool ignoreseekspeed = false) | ||
1451 | { | ||
1452 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper(), | ||
1453 | labelEncoder = StringHelper.GetFreeHelper()) | ||
1454 | { | ||
1455 | return FMOD_Studio_EventInstance_SetParameterByNameWithLabel(this.handle, encoder.byteFromStringUTF8(name), labelEncoder.byteFromStringUTF8(label), ignoreseekspeed); | ||
1456 | } | ||
1457 | } | ||
1458 | public RESULT keyOff() | ||
1459 | { | ||
1460 | return FMOD_Studio_EventInstance_KeyOff(this.handle); | ||
1461 | } | ||
1462 | public RESULT setCallback(EVENT_CALLBACK callback, EVENT_CALLBACK_TYPE callbackmask = EVENT_CALLBACK_TYPE.ALL) | ||
1463 | { | ||
1464 | return FMOD_Studio_EventInstance_SetCallback(this.handle, callback, callbackmask); | ||
1465 | } | ||
1466 | public RESULT getUserData(out IntPtr userdata) | ||
1467 | { | ||
1468 | return FMOD_Studio_EventInstance_GetUserData(this.handle, out userdata); | ||
1469 | } | ||
1470 | public RESULT setUserData(IntPtr userdata) | ||
1471 | { | ||
1472 | return FMOD_Studio_EventInstance_SetUserData(this.handle, userdata); | ||
1473 | } | ||
1474 | public RESULT getCPUUsage(out uint exclusive, out uint inclusive) | ||
1475 | { | ||
1476 | return FMOD_Studio_EventInstance_GetCPUUsage(this.handle, out exclusive, out inclusive); | ||
1477 | } | ||
1478 | public RESULT getMemoryUsage(out MEMORY_USAGE memoryusage) | ||
1479 | { | ||
1480 | return FMOD_Studio_EventInstance_GetMemoryUsage(this.handle, out memoryusage); | ||
1481 | } | ||
1482 | #region importfunctions | ||
1483 | [DllImport(STUDIO_VERSION.dll)] | ||
1484 | private static extern bool FMOD_Studio_EventInstance_IsValid (IntPtr _event); | ||
1485 | [DllImport(STUDIO_VERSION.dll)] | ||
1486 | private static extern RESULT FMOD_Studio_EventInstance_GetDescription (IntPtr _event, out IntPtr description); | ||
1487 | [DllImport(STUDIO_VERSION.dll)] | ||
1488 | private static extern RESULT FMOD_Studio_EventInstance_GetVolume (IntPtr _event, out float volume, IntPtr zero); | ||
1489 | [DllImport(STUDIO_VERSION.dll)] | ||
1490 | private static extern RESULT FMOD_Studio_EventInstance_GetVolume (IntPtr _event, out float volume, out float finalvolume); | ||
1491 | [DllImport(STUDIO_VERSION.dll)] | ||
1492 | private static extern RESULT FMOD_Studio_EventInstance_SetVolume (IntPtr _event, float volume); | ||
1493 | [DllImport(STUDIO_VERSION.dll)] | ||
1494 | private static extern RESULT FMOD_Studio_EventInstance_GetPitch (IntPtr _event, out float pitch, IntPtr zero); | ||
1495 | [DllImport(STUDIO_VERSION.dll)] | ||
1496 | private static extern RESULT FMOD_Studio_EventInstance_GetPitch (IntPtr _event, out float pitch, out float finalpitch); | ||
1497 | [DllImport(STUDIO_VERSION.dll)] | ||
1498 | private static extern RESULT FMOD_Studio_EventInstance_SetPitch (IntPtr _event, float pitch); | ||
1499 | [DllImport(STUDIO_VERSION.dll)] | ||
1500 | private static extern RESULT FMOD_Studio_EventInstance_Get3DAttributes (IntPtr _event, out ATTRIBUTES_3D attributes); | ||
1501 | [DllImport(STUDIO_VERSION.dll)] | ||
1502 | private static extern RESULT FMOD_Studio_EventInstance_Set3DAttributes (IntPtr _event, ref ATTRIBUTES_3D attributes); | ||
1503 | [DllImport(STUDIO_VERSION.dll)] | ||
1504 | private static extern RESULT FMOD_Studio_EventInstance_GetListenerMask (IntPtr _event, out uint mask); | ||
1505 | [DllImport(STUDIO_VERSION.dll)] | ||
1506 | private static extern RESULT FMOD_Studio_EventInstance_SetListenerMask (IntPtr _event, uint mask); | ||
1507 | [DllImport(STUDIO_VERSION.dll)] | ||
1508 | private static extern RESULT FMOD_Studio_EventInstance_GetProperty (IntPtr _event, EVENT_PROPERTY index, out float value); | ||
1509 | [DllImport(STUDIO_VERSION.dll)] | ||
1510 | private static extern RESULT FMOD_Studio_EventInstance_SetProperty (IntPtr _event, EVENT_PROPERTY index, float value); | ||
1511 | [DllImport(STUDIO_VERSION.dll)] | ||
1512 | private static extern RESULT FMOD_Studio_EventInstance_GetReverbLevel (IntPtr _event, int index, out float level); | ||
1513 | [DllImport(STUDIO_VERSION.dll)] | ||
1514 | private static extern RESULT FMOD_Studio_EventInstance_SetReverbLevel (IntPtr _event, int index, float level); | ||
1515 | [DllImport(STUDIO_VERSION.dll)] | ||
1516 | private static extern RESULT FMOD_Studio_EventInstance_GetPaused (IntPtr _event, out bool paused); | ||
1517 | [DllImport(STUDIO_VERSION.dll)] | ||
1518 | private static extern RESULT FMOD_Studio_EventInstance_SetPaused (IntPtr _event, bool paused); | ||
1519 | [DllImport(STUDIO_VERSION.dll)] | ||
1520 | private static extern RESULT FMOD_Studio_EventInstance_Start (IntPtr _event); | ||
1521 | [DllImport(STUDIO_VERSION.dll)] | ||
1522 | private static extern RESULT FMOD_Studio_EventInstance_Stop (IntPtr _event, STOP_MODE mode); | ||
1523 | [DllImport(STUDIO_VERSION.dll)] | ||
1524 | private static extern RESULT FMOD_Studio_EventInstance_GetTimelinePosition (IntPtr _event, out int position); | ||
1525 | [DllImport(STUDIO_VERSION.dll)] | ||
1526 | private static extern RESULT FMOD_Studio_EventInstance_SetTimelinePosition (IntPtr _event, int position); | ||
1527 | [DllImport(STUDIO_VERSION.dll)] | ||
1528 | private static extern RESULT FMOD_Studio_EventInstance_GetPlaybackState (IntPtr _event, out PLAYBACK_STATE state); | ||
1529 | [DllImport(STUDIO_VERSION.dll)] | ||
1530 | private static extern RESULT FMOD_Studio_EventInstance_GetChannelGroup (IntPtr _event, out IntPtr group); | ||
1531 | [DllImport(STUDIO_VERSION.dll)] | ||
1532 | private static extern RESULT FMOD_Studio_EventInstance_GetMinMaxDistance (IntPtr _event, out float min, out float max); | ||
1533 | [DllImport(STUDIO_VERSION.dll)] | ||
1534 | private static extern RESULT FMOD_Studio_EventInstance_Release (IntPtr _event); | ||
1535 | [DllImport(STUDIO_VERSION.dll)] | ||
1536 | private static extern RESULT FMOD_Studio_EventInstance_IsVirtual (IntPtr _event, out bool virtualstate); | ||
1537 | [DllImport(STUDIO_VERSION.dll)] | ||
1538 | private static extern RESULT FMOD_Studio_EventInstance_GetParameterByName (IntPtr _event, byte[] name, out float value, out float finalvalue); | ||
1539 | [DllImport(STUDIO_VERSION.dll)] | ||
1540 | private static extern RESULT FMOD_Studio_EventInstance_SetParameterByName (IntPtr _event, byte[] name, float value, bool ignoreseekspeed); | ||
1541 | [DllImport(STUDIO_VERSION.dll)] | ||
1542 | private static extern RESULT FMOD_Studio_EventInstance_SetParameterByNameWithLabel (IntPtr _event, byte[] name, byte[] label, bool ignoreseekspeed); | ||
1543 | [DllImport(STUDIO_VERSION.dll)] | ||
1544 | private static extern RESULT FMOD_Studio_EventInstance_GetParameterByID (IntPtr _event, PARAMETER_ID id, out float value, out float finalvalue); | ||
1545 | [DllImport(STUDIO_VERSION.dll)] | ||
1546 | private static extern RESULT FMOD_Studio_EventInstance_SetParameterByID (IntPtr _event, PARAMETER_ID id, float value, bool ignoreseekspeed); | ||
1547 | [DllImport(STUDIO_VERSION.dll)] | ||
1548 | private static extern RESULT FMOD_Studio_EventInstance_SetParameterByIDWithLabel (IntPtr _event, PARAMETER_ID id, byte[] label, bool ignoreseekspeed); | ||
1549 | [DllImport(STUDIO_VERSION.dll)] | ||
1550 | private static extern RESULT FMOD_Studio_EventInstance_SetParametersByIDs (IntPtr _event, PARAMETER_ID[] ids, float[] values, int count, bool ignoreseekspeed); | ||
1551 | [DllImport(STUDIO_VERSION.dll)] | ||
1552 | private static extern RESULT FMOD_Studio_EventInstance_KeyOff (IntPtr _event); | ||
1553 | [DllImport(STUDIO_VERSION.dll)] | ||
1554 | private static extern RESULT FMOD_Studio_EventInstance_SetCallback (IntPtr _event, EVENT_CALLBACK callback, EVENT_CALLBACK_TYPE callbackmask); | ||
1555 | [DllImport (STUDIO_VERSION.dll)] | ||
1556 | private static extern RESULT FMOD_Studio_EventInstance_GetUserData (IntPtr _event, out IntPtr userdata); | ||
1557 | [DllImport (STUDIO_VERSION.dll)] | ||
1558 | private static extern RESULT FMOD_Studio_EventInstance_SetUserData (IntPtr _event, IntPtr userdata); | ||
1559 | [DllImport (STUDIO_VERSION.dll)] | ||
1560 | private static extern RESULT FMOD_Studio_EventInstance_GetCPUUsage (IntPtr _event, out uint exclusive, out uint inclusive); | ||
1561 | [DllImport(STUDIO_VERSION.dll)] | ||
1562 | private static extern RESULT FMOD_Studio_EventInstance_GetMemoryUsage (IntPtr _event, out MEMORY_USAGE memoryusage); | ||
1563 | #endregion | ||
1564 | |||
1565 | #region wrapperinternal | ||
1566 | |||
1567 | public IntPtr handle; | ||
1568 | |||
1569 | public EventInstance(IntPtr ptr) { this.handle = ptr; } | ||
1570 | public bool hasHandle() { return this.handle != IntPtr.Zero; } | ||
1571 | public void clearHandle() { this.handle = IntPtr.Zero; } | ||
1572 | |||
1573 | public bool isValid() | ||
1574 | { | ||
1575 | return hasHandle() && FMOD_Studio_EventInstance_IsValid(this.handle); | ||
1576 | } | ||
1577 | |||
1578 | #endregion | ||
1579 | } | ||
1580 | |||
1581 | public struct Bus | ||
1582 | { | ||
1583 | public RESULT getID(out GUID id) | ||
1584 | { | ||
1585 | return FMOD_Studio_Bus_GetID(this.handle, out id); | ||
1586 | } | ||
1587 | public RESULT getPath(out string path) | ||
1588 | { | ||
1589 | path = null; | ||
1590 | |||
1591 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1592 | { | ||
1593 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
1594 | int retrieved = 0; | ||
1595 | RESULT result = FMOD_Studio_Bus_GetPath(this.handle, stringMem, 256, out retrieved); | ||
1596 | |||
1597 | if (result == RESULT.ERR_TRUNCATED) | ||
1598 | { | ||
1599 | Marshal.FreeHGlobal(stringMem); | ||
1600 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
1601 | result = FMOD_Studio_Bus_GetPath(this.handle, stringMem, retrieved, out retrieved); | ||
1602 | } | ||
1603 | |||
1604 | if (result == RESULT.OK) | ||
1605 | { | ||
1606 | path = encoder.stringFromNative(stringMem); | ||
1607 | } | ||
1608 | Marshal.FreeHGlobal(stringMem); | ||
1609 | return result; | ||
1610 | } | ||
1611 | |||
1612 | } | ||
1613 | public RESULT getVolume(out float volume) | ||
1614 | { | ||
1615 | float finalVolume; | ||
1616 | return getVolume(out volume, out finalVolume); | ||
1617 | } | ||
1618 | public RESULT getVolume(out float volume, out float finalvolume) | ||
1619 | { | ||
1620 | return FMOD_Studio_Bus_GetVolume(this.handle, out volume, out finalvolume); | ||
1621 | } | ||
1622 | public RESULT setVolume(float volume) | ||
1623 | { | ||
1624 | return FMOD_Studio_Bus_SetVolume(this.handle, volume); | ||
1625 | } | ||
1626 | public RESULT getPaused(out bool paused) | ||
1627 | { | ||
1628 | return FMOD_Studio_Bus_GetPaused(this.handle, out paused); | ||
1629 | } | ||
1630 | public RESULT setPaused(bool paused) | ||
1631 | { | ||
1632 | return FMOD_Studio_Bus_SetPaused(this.handle, paused); | ||
1633 | } | ||
1634 | public RESULT getMute(out bool mute) | ||
1635 | { | ||
1636 | return FMOD_Studio_Bus_GetMute(this.handle, out mute); | ||
1637 | } | ||
1638 | public RESULT setMute(bool mute) | ||
1639 | { | ||
1640 | return FMOD_Studio_Bus_SetMute(this.handle, mute); | ||
1641 | } | ||
1642 | public RESULT stopAllEvents(STOP_MODE mode) | ||
1643 | { | ||
1644 | return FMOD_Studio_Bus_StopAllEvents(this.handle, mode); | ||
1645 | } | ||
1646 | public RESULT lockChannelGroup() | ||
1647 | { | ||
1648 | return FMOD_Studio_Bus_LockChannelGroup(this.handle); | ||
1649 | } | ||
1650 | public RESULT unlockChannelGroup() | ||
1651 | { | ||
1652 | return FMOD_Studio_Bus_UnlockChannelGroup(this.handle); | ||
1653 | } | ||
1654 | public RESULT getChannelGroup(out FMOD.ChannelGroup group) | ||
1655 | { | ||
1656 | return FMOD_Studio_Bus_GetChannelGroup(this.handle, out group.handle); | ||
1657 | } | ||
1658 | public RESULT getCPUUsage(out uint exclusive, out uint inclusive) | ||
1659 | { | ||
1660 | return FMOD_Studio_Bus_GetCPUUsage(this.handle, out exclusive, out inclusive); | ||
1661 | } | ||
1662 | public RESULT getMemoryUsage(out MEMORY_USAGE memoryusage) | ||
1663 | { | ||
1664 | return FMOD_Studio_Bus_GetMemoryUsage(this.handle, out memoryusage); | ||
1665 | } | ||
1666 | public RESULT getPortIndex(out ulong index) | ||
1667 | { | ||
1668 | return FMOD_Studio_Bus_GetPortIndex(this.handle, out index); | ||
1669 | } | ||
1670 | public RESULT setPortIndex(ulong index) | ||
1671 | { | ||
1672 | return FMOD_Studio_Bus_SetPortIndex(this.handle, index); | ||
1673 | } | ||
1674 | |||
1675 | #region importfunctions | ||
1676 | [DllImport(STUDIO_VERSION.dll)] | ||
1677 | private static extern bool FMOD_Studio_Bus_IsValid (IntPtr bus); | ||
1678 | [DllImport(STUDIO_VERSION.dll)] | ||
1679 | private static extern RESULT FMOD_Studio_Bus_GetID (IntPtr bus, out GUID id); | ||
1680 | [DllImport(STUDIO_VERSION.dll)] | ||
1681 | private static extern RESULT FMOD_Studio_Bus_GetPath (IntPtr bus, IntPtr path, int size, out int retrieved); | ||
1682 | [DllImport(STUDIO_VERSION.dll)] | ||
1683 | private static extern RESULT FMOD_Studio_Bus_GetVolume (IntPtr bus, out float volume, out float finalvolume); | ||
1684 | [DllImport(STUDIO_VERSION.dll)] | ||
1685 | private static extern RESULT FMOD_Studio_Bus_SetVolume (IntPtr bus, float volume); | ||
1686 | [DllImport(STUDIO_VERSION.dll)] | ||
1687 | private static extern RESULT FMOD_Studio_Bus_GetPaused (IntPtr bus, out bool paused); | ||
1688 | [DllImport(STUDIO_VERSION.dll)] | ||
1689 | private static extern RESULT FMOD_Studio_Bus_SetPaused (IntPtr bus, bool paused); | ||
1690 | [DllImport(STUDIO_VERSION.dll)] | ||
1691 | private static extern RESULT FMOD_Studio_Bus_GetMute (IntPtr bus, out bool mute); | ||
1692 | [DllImport(STUDIO_VERSION.dll)] | ||
1693 | private static extern RESULT FMOD_Studio_Bus_SetMute (IntPtr bus, bool mute); | ||
1694 | [DllImport(STUDIO_VERSION.dll)] | ||
1695 | private static extern RESULT FMOD_Studio_Bus_StopAllEvents (IntPtr bus, STOP_MODE mode); | ||
1696 | [DllImport(STUDIO_VERSION.dll)] | ||
1697 | private static extern RESULT FMOD_Studio_Bus_LockChannelGroup (IntPtr bus); | ||
1698 | [DllImport(STUDIO_VERSION.dll)] | ||
1699 | private static extern RESULT FMOD_Studio_Bus_UnlockChannelGroup (IntPtr bus); | ||
1700 | [DllImport(STUDIO_VERSION.dll)] | ||
1701 | private static extern RESULT FMOD_Studio_Bus_GetChannelGroup (IntPtr bus, out IntPtr group); | ||
1702 | [DllImport(STUDIO_VERSION.dll)] | ||
1703 | private static extern RESULT FMOD_Studio_Bus_GetCPUUsage (IntPtr bus, out uint exclusive, out uint inclusive); | ||
1704 | [DllImport(STUDIO_VERSION.dll)] | ||
1705 | private static extern RESULT FMOD_Studio_Bus_GetMemoryUsage (IntPtr bus, out MEMORY_USAGE memoryusage); | ||
1706 | [DllImport(STUDIO_VERSION.dll)] | ||
1707 | private static extern RESULT FMOD_Studio_Bus_GetPortIndex (IntPtr bus, out ulong index); | ||
1708 | [DllImport(STUDIO_VERSION.dll)] | ||
1709 | private static extern RESULT FMOD_Studio_Bus_SetPortIndex (IntPtr bus, ulong index); | ||
1710 | #endregion | ||
1711 | |||
1712 | #region wrapperinternal | ||
1713 | |||
1714 | public IntPtr handle; | ||
1715 | |||
1716 | public Bus(IntPtr ptr) { this.handle = ptr; } | ||
1717 | public bool hasHandle() { return this.handle != IntPtr.Zero; } | ||
1718 | public void clearHandle() { this.handle = IntPtr.Zero; } | ||
1719 | |||
1720 | public bool isValid() | ||
1721 | { | ||
1722 | return hasHandle() && FMOD_Studio_Bus_IsValid(this.handle); | ||
1723 | } | ||
1724 | |||
1725 | #endregion | ||
1726 | } | ||
1727 | |||
1728 | public struct VCA | ||
1729 | { | ||
1730 | public RESULT getID(out GUID id) | ||
1731 | { | ||
1732 | return FMOD_Studio_VCA_GetID(this.handle, out id); | ||
1733 | } | ||
1734 | public RESULT getPath(out string path) | ||
1735 | { | ||
1736 | path = null; | ||
1737 | |||
1738 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1739 | { | ||
1740 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
1741 | int retrieved = 0; | ||
1742 | RESULT result = FMOD_Studio_VCA_GetPath(this.handle, stringMem, 256, out retrieved); | ||
1743 | |||
1744 | if (result == RESULT.ERR_TRUNCATED) | ||
1745 | { | ||
1746 | Marshal.FreeHGlobal(stringMem); | ||
1747 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
1748 | result = FMOD_Studio_VCA_GetPath(this.handle, stringMem, retrieved, out retrieved); | ||
1749 | } | ||
1750 | |||
1751 | if (result == RESULT.OK) | ||
1752 | { | ||
1753 | path = encoder.stringFromNative(stringMem); | ||
1754 | } | ||
1755 | Marshal.FreeHGlobal(stringMem); | ||
1756 | return result; | ||
1757 | } | ||
1758 | } | ||
1759 | public RESULT getVolume(out float volume) | ||
1760 | { | ||
1761 | float finalVolume; | ||
1762 | return getVolume(out volume, out finalVolume); | ||
1763 | } | ||
1764 | public RESULT getVolume(out float volume, out float finalvolume) | ||
1765 | { | ||
1766 | return FMOD_Studio_VCA_GetVolume(this.handle, out volume, out finalvolume); | ||
1767 | } | ||
1768 | public RESULT setVolume(float volume) | ||
1769 | { | ||
1770 | return FMOD_Studio_VCA_SetVolume(this.handle, volume); | ||
1771 | } | ||
1772 | |||
1773 | #region importfunctions | ||
1774 | [DllImport(STUDIO_VERSION.dll)] | ||
1775 | private static extern bool FMOD_Studio_VCA_IsValid (IntPtr vca); | ||
1776 | [DllImport(STUDIO_VERSION.dll)] | ||
1777 | private static extern RESULT FMOD_Studio_VCA_GetID (IntPtr vca, out GUID id); | ||
1778 | [DllImport(STUDIO_VERSION.dll)] | ||
1779 | private static extern RESULT FMOD_Studio_VCA_GetPath (IntPtr vca, IntPtr path, int size, out int retrieved); | ||
1780 | [DllImport(STUDIO_VERSION.dll)] | ||
1781 | private static extern RESULT FMOD_Studio_VCA_GetVolume (IntPtr vca, out float volume, out float finalvolume); | ||
1782 | [DllImport(STUDIO_VERSION.dll)] | ||
1783 | private static extern RESULT FMOD_Studio_VCA_SetVolume (IntPtr vca, float volume); | ||
1784 | #endregion | ||
1785 | |||
1786 | #region wrapperinternal | ||
1787 | |||
1788 | public IntPtr handle; | ||
1789 | |||
1790 | public VCA(IntPtr ptr) { this.handle = ptr; } | ||
1791 | public bool hasHandle() { return this.handle != IntPtr.Zero; } | ||
1792 | public void clearHandle() { this.handle = IntPtr.Zero; } | ||
1793 | |||
1794 | public bool isValid() | ||
1795 | { | ||
1796 | return hasHandle() && FMOD_Studio_VCA_IsValid(this.handle); | ||
1797 | } | ||
1798 | |||
1799 | #endregion | ||
1800 | } | ||
1801 | |||
1802 | public struct Bank | ||
1803 | { | ||
1804 | // Property access | ||
1805 | |||
1806 | public RESULT getID(out GUID id) | ||
1807 | { | ||
1808 | return FMOD_Studio_Bank_GetID(this.handle, out id); | ||
1809 | } | ||
1810 | public RESULT getPath(out string path) | ||
1811 | { | ||
1812 | path = null; | ||
1813 | |||
1814 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1815 | { | ||
1816 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
1817 | int retrieved = 0; | ||
1818 | RESULT result = FMOD_Studio_Bank_GetPath(this.handle, stringMem, 256, out retrieved); | ||
1819 | |||
1820 | if (result == RESULT.ERR_TRUNCATED) | ||
1821 | { | ||
1822 | Marshal.FreeHGlobal(stringMem); | ||
1823 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
1824 | result = FMOD_Studio_Bank_GetPath(this.handle, stringMem, retrieved, out retrieved); | ||
1825 | } | ||
1826 | |||
1827 | if (result == RESULT.OK) | ||
1828 | { | ||
1829 | path = encoder.stringFromNative(stringMem); | ||
1830 | } | ||
1831 | Marshal.FreeHGlobal(stringMem); | ||
1832 | return result; | ||
1833 | } | ||
1834 | } | ||
1835 | public RESULT unload() | ||
1836 | { | ||
1837 | return FMOD_Studio_Bank_Unload(this.handle); | ||
1838 | } | ||
1839 | public RESULT loadSampleData() | ||
1840 | { | ||
1841 | return FMOD_Studio_Bank_LoadSampleData(this.handle); | ||
1842 | } | ||
1843 | public RESULT unloadSampleData() | ||
1844 | { | ||
1845 | return FMOD_Studio_Bank_UnloadSampleData(this.handle); | ||
1846 | } | ||
1847 | public RESULT getLoadingState(out LOADING_STATE state) | ||
1848 | { | ||
1849 | return FMOD_Studio_Bank_GetLoadingState(this.handle, out state); | ||
1850 | } | ||
1851 | public RESULT getSampleLoadingState(out LOADING_STATE state) | ||
1852 | { | ||
1853 | return FMOD_Studio_Bank_GetSampleLoadingState(this.handle, out state); | ||
1854 | } | ||
1855 | |||
1856 | // Enumeration | ||
1857 | public RESULT getStringCount(out int count) | ||
1858 | { | ||
1859 | return FMOD_Studio_Bank_GetStringCount(this.handle, out count); | ||
1860 | } | ||
1861 | public RESULT getStringInfo(int index, out GUID id, out string path) | ||
1862 | { | ||
1863 | path = null; | ||
1864 | id = new GUID(); | ||
1865 | |||
1866 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
1867 | { | ||
1868 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
1869 | int retrieved = 0; | ||
1870 | RESULT result = FMOD_Studio_Bank_GetStringInfo(this.handle, index, out id, stringMem, 256, out retrieved); | ||
1871 | |||
1872 | if (result == RESULT.ERR_TRUNCATED) | ||
1873 | { | ||
1874 | Marshal.FreeHGlobal(stringMem); | ||
1875 | stringMem = Marshal.AllocHGlobal(retrieved); | ||
1876 | result = FMOD_Studio_Bank_GetStringInfo(this.handle, index, out id, stringMem, retrieved, out retrieved); | ||
1877 | } | ||
1878 | |||
1879 | if (result == RESULT.OK) | ||
1880 | { | ||
1881 | path = encoder.stringFromNative(stringMem); | ||
1882 | } | ||
1883 | Marshal.FreeHGlobal(stringMem); | ||
1884 | return result; | ||
1885 | } | ||
1886 | } | ||
1887 | |||
1888 | public RESULT getEventCount(out int count) | ||
1889 | { | ||
1890 | return FMOD_Studio_Bank_GetEventCount(this.handle, out count); | ||
1891 | } | ||
1892 | public RESULT getEventList(out EventDescription[] array) | ||
1893 | { | ||
1894 | array = null; | ||
1895 | |||
1896 | RESULT result; | ||
1897 | int capacity; | ||
1898 | result = FMOD_Studio_Bank_GetEventCount(this.handle, out capacity); | ||
1899 | if (result != RESULT.OK) | ||
1900 | { | ||
1901 | return result; | ||
1902 | } | ||
1903 | if (capacity == 0) | ||
1904 | { | ||
1905 | array = new EventDescription[0]; | ||
1906 | return result; | ||
1907 | } | ||
1908 | |||
1909 | IntPtr[] rawArray = new IntPtr[capacity]; | ||
1910 | int actualCount; | ||
1911 | result = FMOD_Studio_Bank_GetEventList(this.handle, rawArray, capacity, out actualCount); | ||
1912 | if (result != RESULT.OK) | ||
1913 | { | ||
1914 | return result; | ||
1915 | } | ||
1916 | if (actualCount > capacity) // More items added since we queried just now? | ||
1917 | { | ||
1918 | actualCount = capacity; | ||
1919 | } | ||
1920 | array = new EventDescription[actualCount]; | ||
1921 | for (int i = 0; i < actualCount; ++i) | ||
1922 | { | ||
1923 | array[i].handle = rawArray[i]; | ||
1924 | } | ||
1925 | return RESULT.OK; | ||
1926 | } | ||
1927 | public RESULT getBusCount(out int count) | ||
1928 | { | ||
1929 | return FMOD_Studio_Bank_GetBusCount(this.handle, out count); | ||
1930 | } | ||
1931 | public RESULT getBusList(out Bus[] array) | ||
1932 | { | ||
1933 | array = null; | ||
1934 | |||
1935 | RESULT result; | ||
1936 | int capacity; | ||
1937 | result = FMOD_Studio_Bank_GetBusCount(this.handle, out capacity); | ||
1938 | if (result != RESULT.OK) | ||
1939 | { | ||
1940 | return result; | ||
1941 | } | ||
1942 | if (capacity == 0) | ||
1943 | { | ||
1944 | array = new Bus[0]; | ||
1945 | return result; | ||
1946 | } | ||
1947 | |||
1948 | IntPtr[] rawArray = new IntPtr[capacity]; | ||
1949 | int actualCount; | ||
1950 | result = FMOD_Studio_Bank_GetBusList(this.handle, rawArray, capacity, out actualCount); | ||
1951 | if (result != RESULT.OK) | ||
1952 | { | ||
1953 | return result; | ||
1954 | } | ||
1955 | if (actualCount > capacity) // More items added since we queried just now? | ||
1956 | { | ||
1957 | actualCount = capacity; | ||
1958 | } | ||
1959 | array = new Bus[actualCount]; | ||
1960 | for (int i = 0; i < actualCount; ++i) | ||
1961 | { | ||
1962 | array[i].handle = rawArray[i]; | ||
1963 | } | ||
1964 | return RESULT.OK; | ||
1965 | } | ||
1966 | public RESULT getVCACount(out int count) | ||
1967 | { | ||
1968 | return FMOD_Studio_Bank_GetVCACount(this.handle, out count); | ||
1969 | } | ||
1970 | public RESULT getVCAList(out VCA[] array) | ||
1971 | { | ||
1972 | array = null; | ||
1973 | |||
1974 | RESULT result; | ||
1975 | int capacity; | ||
1976 | result = FMOD_Studio_Bank_GetVCACount(this.handle, out capacity); | ||
1977 | if (result != RESULT.OK) | ||
1978 | { | ||
1979 | return result; | ||
1980 | } | ||
1981 | if (capacity == 0) | ||
1982 | { | ||
1983 | array = new VCA[0]; | ||
1984 | return result; | ||
1985 | } | ||
1986 | |||
1987 | IntPtr[] rawArray = new IntPtr[capacity]; | ||
1988 | int actualCount; | ||
1989 | result = FMOD_Studio_Bank_GetVCAList(this.handle, rawArray, capacity, out actualCount); | ||
1990 | if (result != RESULT.OK) | ||
1991 | { | ||
1992 | return result; | ||
1993 | } | ||
1994 | if (actualCount > capacity) // More items added since we queried just now? | ||
1995 | { | ||
1996 | actualCount = capacity; | ||
1997 | } | ||
1998 | array = new VCA[actualCount]; | ||
1999 | for (int i = 0; i < actualCount; ++i) | ||
2000 | { | ||
2001 | array[i].handle = rawArray[i]; | ||
2002 | } | ||
2003 | return RESULT.OK; | ||
2004 | } | ||
2005 | |||
2006 | public RESULT getUserData(out IntPtr userdata) | ||
2007 | { | ||
2008 | return FMOD_Studio_Bank_GetUserData(this.handle, out userdata); | ||
2009 | } | ||
2010 | |||
2011 | public RESULT setUserData(IntPtr userdata) | ||
2012 | { | ||
2013 | return FMOD_Studio_Bank_SetUserData(this.handle, userdata); | ||
2014 | } | ||
2015 | |||
2016 | #region importfunctions | ||
2017 | [DllImport(STUDIO_VERSION.dll)] | ||
2018 | private static extern bool FMOD_Studio_Bank_IsValid (IntPtr bank); | ||
2019 | [DllImport(STUDIO_VERSION.dll)] | ||
2020 | private static extern RESULT FMOD_Studio_Bank_GetID (IntPtr bank, out GUID id); | ||
2021 | [DllImport(STUDIO_VERSION.dll)] | ||
2022 | private static extern RESULT FMOD_Studio_Bank_GetPath (IntPtr bank, IntPtr path, int size, out int retrieved); | ||
2023 | [DllImport(STUDIO_VERSION.dll)] | ||
2024 | private static extern RESULT FMOD_Studio_Bank_Unload (IntPtr bank); | ||
2025 | [DllImport(STUDIO_VERSION.dll)] | ||
2026 | private static extern RESULT FMOD_Studio_Bank_LoadSampleData (IntPtr bank); | ||
2027 | [DllImport(STUDIO_VERSION.dll)] | ||
2028 | private static extern RESULT FMOD_Studio_Bank_UnloadSampleData (IntPtr bank); | ||
2029 | [DllImport(STUDIO_VERSION.dll)] | ||
2030 | private static extern RESULT FMOD_Studio_Bank_GetLoadingState (IntPtr bank, out LOADING_STATE state); | ||
2031 | [DllImport(STUDIO_VERSION.dll)] | ||
2032 | private static extern RESULT FMOD_Studio_Bank_GetSampleLoadingState (IntPtr bank, out LOADING_STATE state); | ||
2033 | [DllImport(STUDIO_VERSION.dll)] | ||
2034 | private static extern RESULT FMOD_Studio_Bank_GetStringCount (IntPtr bank, out int count); | ||
2035 | [DllImport(STUDIO_VERSION.dll)] | ||
2036 | private static extern RESULT FMOD_Studio_Bank_GetStringInfo (IntPtr bank, int index, out GUID id, IntPtr path, int size, out int retrieved); | ||
2037 | [DllImport(STUDIO_VERSION.dll)] | ||
2038 | private static extern RESULT FMOD_Studio_Bank_GetEventCount (IntPtr bank, out int count); | ||
2039 | [DllImport(STUDIO_VERSION.dll)] | ||
2040 | private static extern RESULT FMOD_Studio_Bank_GetEventList (IntPtr bank, IntPtr[] array, int capacity, out int count); | ||
2041 | [DllImport(STUDIO_VERSION.dll)] | ||
2042 | private static extern RESULT FMOD_Studio_Bank_GetBusCount (IntPtr bank, out int count); | ||
2043 | [DllImport(STUDIO_VERSION.dll)] | ||
2044 | private static extern RESULT FMOD_Studio_Bank_GetBusList (IntPtr bank, IntPtr[] array, int capacity, out int count); | ||
2045 | [DllImport(STUDIO_VERSION.dll)] | ||
2046 | private static extern RESULT FMOD_Studio_Bank_GetVCACount (IntPtr bank, out int count); | ||
2047 | [DllImport(STUDIO_VERSION.dll)] | ||
2048 | private static extern RESULT FMOD_Studio_Bank_GetVCAList (IntPtr bank, IntPtr[] array, int capacity, out int count); | ||
2049 | [DllImport(STUDIO_VERSION.dll)] | ||
2050 | private static extern RESULT FMOD_Studio_Bank_GetUserData (IntPtr bank, out IntPtr userdata); | ||
2051 | [DllImport(STUDIO_VERSION.dll)] | ||
2052 | private static extern RESULT FMOD_Studio_Bank_SetUserData (IntPtr bank, IntPtr userdata); | ||
2053 | #endregion | ||
2054 | |||
2055 | #region wrapperinternal | ||
2056 | |||
2057 | public IntPtr handle; | ||
2058 | |||
2059 | public Bank(IntPtr ptr) { this.handle = ptr; } | ||
2060 | public bool hasHandle() { return this.handle != IntPtr.Zero; } | ||
2061 | public void clearHandle() { this.handle = IntPtr.Zero; } | ||
2062 | |||
2063 | public bool isValid() | ||
2064 | { | ||
2065 | return hasHandle() && FMOD_Studio_Bank_IsValid(this.handle); | ||
2066 | } | ||
2067 | |||
2068 | #endregion | ||
2069 | } | ||
2070 | |||
2071 | public struct CommandReplay | ||
2072 | { | ||
2073 | // Information query | ||
2074 | public RESULT getSystem(out System system) | ||
2075 | { | ||
2076 | return FMOD_Studio_CommandReplay_GetSystem(this.handle, out system.handle); | ||
2077 | } | ||
2078 | |||
2079 | public RESULT getLength(out float length) | ||
2080 | { | ||
2081 | return FMOD_Studio_CommandReplay_GetLength(this.handle, out length); | ||
2082 | } | ||
2083 | public RESULT getCommandCount(out int count) | ||
2084 | { | ||
2085 | return FMOD_Studio_CommandReplay_GetCommandCount(this.handle, out count); | ||
2086 | } | ||
2087 | public RESULT getCommandInfo(int commandIndex, out COMMAND_INFO info) | ||
2088 | { | ||
2089 | return FMOD_Studio_CommandReplay_GetCommandInfo(this.handle, commandIndex, out info); | ||
2090 | } | ||
2091 | |||
2092 | public RESULT getCommandString(int commandIndex, out string buffer) | ||
2093 | { | ||
2094 | buffer = null; | ||
2095 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
2096 | { | ||
2097 | int stringLength = 256; | ||
2098 | IntPtr stringMem = Marshal.AllocHGlobal(256); | ||
2099 | RESULT result = FMOD_Studio_CommandReplay_GetCommandString(this.handle, commandIndex, stringMem, stringLength); | ||
2100 | |||
2101 | while (result == RESULT.ERR_TRUNCATED) | ||
2102 | { | ||
2103 | Marshal.FreeHGlobal(stringMem); | ||
2104 | stringLength *= 2; | ||
2105 | stringMem = Marshal.AllocHGlobal(stringLength); | ||
2106 | result = FMOD_Studio_CommandReplay_GetCommandString(this.handle, commandIndex, stringMem, stringLength); | ||
2107 | } | ||
2108 | |||
2109 | if (result == RESULT.OK) | ||
2110 | { | ||
2111 | buffer = encoder.stringFromNative(stringMem); | ||
2112 | } | ||
2113 | Marshal.FreeHGlobal(stringMem); | ||
2114 | return result; | ||
2115 | } | ||
2116 | } | ||
2117 | public RESULT getCommandAtTime(float time, out int commandIndex) | ||
2118 | { | ||
2119 | return FMOD_Studio_CommandReplay_GetCommandAtTime(this.handle, time, out commandIndex); | ||
2120 | } | ||
2121 | // Playback | ||
2122 | public RESULT setBankPath(string bankPath) | ||
2123 | { | ||
2124 | using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) | ||
2125 | { | ||
2126 | return FMOD_Studio_CommandReplay_SetBankPath(this.handle, encoder.byteFromStringUTF8(bankPath)); | ||
2127 | } | ||
2128 | } | ||
2129 | public RESULT start() | ||
2130 | { | ||
2131 | return FMOD_Studio_CommandReplay_Start(this.handle); | ||
2132 | } | ||
2133 | public RESULT stop() | ||
2134 | { | ||
2135 | return FMOD_Studio_CommandReplay_Stop(this.handle); | ||
2136 | } | ||
2137 | public RESULT seekToTime(float time) | ||
2138 | { | ||
2139 | return FMOD_Studio_CommandReplay_SeekToTime(this.handle, time); | ||
2140 | } | ||
2141 | public RESULT seekToCommand(int commandIndex) | ||
2142 | { | ||
2143 | return FMOD_Studio_CommandReplay_SeekToCommand(this.handle, commandIndex); | ||
2144 | } | ||
2145 | public RESULT getPaused(out bool paused) | ||
2146 | { | ||
2147 | return FMOD_Studio_CommandReplay_GetPaused(this.handle, out paused); | ||
2148 | } | ||
2149 | public RESULT setPaused(bool paused) | ||
2150 | { | ||
2151 | return FMOD_Studio_CommandReplay_SetPaused(this.handle, paused); | ||
2152 | } | ||
2153 | public RESULT getPlaybackState(out PLAYBACK_STATE state) | ||
2154 | { | ||
2155 | return FMOD_Studio_CommandReplay_GetPlaybackState(this.handle, out state); | ||
2156 | } | ||
2157 | public RESULT getCurrentCommand(out int commandIndex, out float currentTime) | ||
2158 | { | ||
2159 | return FMOD_Studio_CommandReplay_GetCurrentCommand(this.handle, out commandIndex, out currentTime); | ||
2160 | } | ||
2161 | // Release | ||
2162 | public RESULT release() | ||
2163 | { | ||
2164 | return FMOD_Studio_CommandReplay_Release(this.handle); | ||
2165 | } | ||
2166 | // Callbacks | ||
2167 | public RESULT setFrameCallback(COMMANDREPLAY_FRAME_CALLBACK callback) | ||
2168 | { | ||
2169 | return FMOD_Studio_CommandReplay_SetFrameCallback(this.handle, callback); | ||
2170 | } | ||
2171 | public RESULT setLoadBankCallback(COMMANDREPLAY_LOAD_BANK_CALLBACK callback) | ||
2172 | { | ||
2173 | return FMOD_Studio_CommandReplay_SetLoadBankCallback(this.handle, callback); | ||
2174 | } | ||
2175 | public RESULT setCreateInstanceCallback(COMMANDREPLAY_CREATE_INSTANCE_CALLBACK callback) | ||
2176 | { | ||
2177 | return FMOD_Studio_CommandReplay_SetCreateInstanceCallback(this.handle, callback); | ||
2178 | } | ||
2179 | public RESULT getUserData(out IntPtr userdata) | ||
2180 | { | ||
2181 | return FMOD_Studio_CommandReplay_GetUserData(this.handle, out userdata); | ||
2182 | } | ||
2183 | public RESULT setUserData(IntPtr userdata) | ||
2184 | { | ||
2185 | return FMOD_Studio_CommandReplay_SetUserData(this.handle, userdata); | ||
2186 | } | ||
2187 | |||
2188 | #region importfunctions | ||
2189 | [DllImport(STUDIO_VERSION.dll)] | ||
2190 | private static extern bool FMOD_Studio_CommandReplay_IsValid (IntPtr replay); | ||
2191 | [DllImport(STUDIO_VERSION.dll)] | ||
2192 | private static extern RESULT FMOD_Studio_CommandReplay_GetSystem (IntPtr replay, out IntPtr system); | ||
2193 | [DllImport(STUDIO_VERSION.dll)] | ||
2194 | private static extern RESULT FMOD_Studio_CommandReplay_GetLength (IntPtr replay, out float length); | ||
2195 | [DllImport(STUDIO_VERSION.dll)] | ||
2196 | private static extern RESULT FMOD_Studio_CommandReplay_GetCommandCount (IntPtr replay, out int count); | ||
2197 | [DllImport(STUDIO_VERSION.dll)] | ||
2198 | private static extern RESULT FMOD_Studio_CommandReplay_GetCommandInfo (IntPtr replay, int commandindex, out COMMAND_INFO info); | ||
2199 | [DllImport(STUDIO_VERSION.dll)] | ||
2200 | private static extern RESULT FMOD_Studio_CommandReplay_GetCommandString (IntPtr replay, int commandIndex, IntPtr buffer, int length); | ||
2201 | [DllImport(STUDIO_VERSION.dll)] | ||
2202 | private static extern RESULT FMOD_Studio_CommandReplay_GetCommandAtTime (IntPtr replay, float time, out int commandIndex); | ||
2203 | [DllImport(STUDIO_VERSION.dll)] | ||
2204 | private static extern RESULT FMOD_Studio_CommandReplay_SetBankPath (IntPtr replay, byte[] bankPath); | ||
2205 | [DllImport(STUDIO_VERSION.dll)] | ||
2206 | private static extern RESULT FMOD_Studio_CommandReplay_Start (IntPtr replay); | ||
2207 | [DllImport(STUDIO_VERSION.dll)] | ||
2208 | private static extern RESULT FMOD_Studio_CommandReplay_Stop (IntPtr replay); | ||
2209 | [DllImport(STUDIO_VERSION.dll)] | ||
2210 | private static extern RESULT FMOD_Studio_CommandReplay_SeekToTime (IntPtr replay, float time); | ||
2211 | [DllImport(STUDIO_VERSION.dll)] | ||
2212 | private static extern RESULT FMOD_Studio_CommandReplay_SeekToCommand (IntPtr replay, int commandIndex); | ||
2213 | [DllImport(STUDIO_VERSION.dll)] | ||
2214 | private static extern RESULT FMOD_Studio_CommandReplay_GetPaused (IntPtr replay, out bool paused); | ||
2215 | [DllImport(STUDIO_VERSION.dll)] | ||
2216 | private static extern RESULT FMOD_Studio_CommandReplay_SetPaused (IntPtr replay, bool paused); | ||
2217 | [DllImport(STUDIO_VERSION.dll)] | ||
2218 | private static extern RESULT FMOD_Studio_CommandReplay_GetPlaybackState (IntPtr replay, out PLAYBACK_STATE state); | ||
2219 | [DllImport(STUDIO_VERSION.dll)] | ||
2220 | private static extern RESULT FMOD_Studio_CommandReplay_GetCurrentCommand (IntPtr replay, out int commandIndex, out float currentTime); | ||
2221 | [DllImport(STUDIO_VERSION.dll)] | ||
2222 | private static extern RESULT FMOD_Studio_CommandReplay_Release (IntPtr replay); | ||
2223 | [DllImport(STUDIO_VERSION.dll)] | ||
2224 | private static extern RESULT FMOD_Studio_CommandReplay_SetFrameCallback (IntPtr replay, COMMANDREPLAY_FRAME_CALLBACK callback); | ||
2225 | [DllImport(STUDIO_VERSION.dll)] | ||
2226 | private static extern RESULT FMOD_Studio_CommandReplay_SetLoadBankCallback (IntPtr replay, COMMANDREPLAY_LOAD_BANK_CALLBACK callback); | ||
2227 | [DllImport(STUDIO_VERSION.dll)] | ||
2228 | private static extern RESULT FMOD_Studio_CommandReplay_SetCreateInstanceCallback(IntPtr replay, COMMANDREPLAY_CREATE_INSTANCE_CALLBACK callback); | ||
2229 | [DllImport(STUDIO_VERSION.dll)] | ||
2230 | private static extern RESULT FMOD_Studio_CommandReplay_GetUserData (IntPtr replay, out IntPtr userdata); | ||
2231 | [DllImport(STUDIO_VERSION.dll)] | ||
2232 | private static extern RESULT FMOD_Studio_CommandReplay_SetUserData (IntPtr replay, IntPtr userdata); | ||
2233 | #endregion | ||
2234 | |||
2235 | #region wrapperinternal | ||
2236 | |||
2237 | public IntPtr handle; | ||
2238 | |||
2239 | public CommandReplay(IntPtr ptr) { this.handle = ptr; } | ||
2240 | public bool hasHandle() { return this.handle != IntPtr.Zero; } | ||
2241 | public void clearHandle() { this.handle = IntPtr.Zero; } | ||
2242 | |||
2243 | public bool isValid() | ||
2244 | { | ||
2245 | return hasHandle() && FMOD_Studio_CommandReplay_IsValid(this.handle); | ||
2246 | } | ||
2247 | |||
2248 | #endregion | ||
2249 | } | ||
2250 | } // FMOD | ||