1 module libwasm.bindings.OfflineAudioContext;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 import libwasm.bindings.AudioBuffer;
7 import libwasm.bindings.BaseAudioContext;
8 import libwasm.bindings.EventHandler;
9 
10 @safe:
11 nothrow:
12 
13 struct OfflineAudioContext {
14   nothrow:
15   libwasm.bindings.BaseAudioContext.BaseAudioContext _parent;
16   alias _parent this;
17   this(Handle h) {
18     _parent = .BaseAudioContext(h);
19   }
20   auto startRendering()() {
21     return JsPromise!(AudioBuffer)(Object_Getter__Handle(this._parent, "startRendering"));
22   }
23   uint length()() {
24     return Object_Getter__uint(this._parent, "length");
25   }
26   void oncomplete(T0)(scope auto ref Optional!(T0) oncomplete) if (isTOrPointer!(T0, EventHandlerNonNull)) {
27     Object_Call_EventHandler__void(this._parent, "oncomplete", !oncomplete.empty, oncomplete.front);
28   }
29   EventHandler oncomplete()() {
30     return Object_Getter__EventHandler(this._parent, "oncomplete");
31   }
32 }
33 struct OfflineAudioContextOptions {
34   nothrow:
35   JsHandle handle;
36   alias handle this;
37   this(Handle h) {
38     this.handle = JsHandle(h);
39   }
40   static auto create() {
41     return OfflineAudioContextOptions(libwasm_add__object());
42   }
43   void numberOfChannels()(uint numberOfChannels) {
44     Object_Call_uint__void(this.handle, "numberOfChannels", numberOfChannels);
45   }
46   uint numberOfChannels()() {
47     return Object_Getter__uint(this.handle, "numberOfChannels");
48   }
49   void length()(uint length) {
50     Object_Call_uint__void(this.handle, "length", length);
51   }
52   uint length()() {
53     return Object_Getter__uint(this.handle, "length");
54   }
55   void sampleRate()(float sampleRate) {
56     Object_Call_float__void(this.handle, "sampleRate", sampleRate);
57   }
58   float sampleRate()() {
59     return Object_Getter__float(this.handle, "sampleRate");
60   }
61 }
62 
63