1 module libwasm.bindings.AudioNode; 2 3 import libwasm.types; 4 5 import memutils.ct: tuple; 6 import libwasm.bindings.AudioParam; 7 import libwasm.bindings.BaseAudioContext; 8 import libwasm.bindings.EventTarget; 9 10 @safe: 11 nothrow: 12 13 struct AudioNode { 14 nothrow: 15 libwasm.bindings.EventTarget.EventTarget _parent; 16 alias _parent this; 17 this(Handle h) { 18 _parent = .EventTarget(h); 19 } 20 auto connect()(scope ref AudioNode destination, uint output /* = 0 */, uint input /* = 0 */) { 21 return AudioNode(Serialize_Object_VarArgCall!Handle(this._parent, "connect", "Handle;uint;uint", tuple(cast(Handle)destination._parent, output, input))); 22 } 23 auto connect()(scope ref AudioNode destination, uint output /* = 0 */) { 24 return AudioNode(Serialize_Object_VarArgCall!Handle(this._parent, "connect", "Handle;uint", tuple(cast(Handle)destination._parent, output))); 25 } 26 auto connect()(scope ref AudioNode destination) { 27 return AudioNode(Object_Call_Handle__Handle(this._parent, "connect", destination._parent)); 28 } 29 void connect()(scope ref AudioParam destination, uint output /* = 0 */) { 30 Serialize_Object_VarArgCall!void(this._parent, "connect", "Handle;uint", tuple(cast(Handle)destination.handle, output)); 31 } 32 void connect()(scope ref AudioParam destination) { 33 Object_Call_Handle__void(this._parent, "connect", destination.handle); 34 } 35 void disconnect()() { 36 Object_Call__void(this._parent, "disconnect"); 37 } 38 void disconnect()(uint output) { 39 Object_Call_uint__void(this._parent, "disconnect", output); 40 } 41 void disconnect()(scope ref AudioNode destination) { 42 Object_Call_Handle__void(this._parent, "disconnect", destination._parent); 43 } 44 void disconnect()(scope ref AudioNode destination, uint output) { 45 Serialize_Object_VarArgCall!void(this._parent, "disconnect", "Handle;uint", tuple(cast(Handle)destination._parent, output)); 46 } 47 void disconnect()(scope ref AudioNode destination, uint output, uint input) { 48 Serialize_Object_VarArgCall!void(this._parent, "disconnect", "Handle;uint;uint", tuple(cast(Handle)destination._parent, output, input)); 49 } 50 void disconnect()(scope ref AudioParam destination) { 51 Object_Call_Handle__void(this._parent, "disconnect", destination.handle); 52 } 53 void disconnect()(scope ref AudioParam destination, uint output) { 54 Serialize_Object_VarArgCall!void(this._parent, "disconnect", "Handle;uint", tuple(cast(Handle)destination.handle, output)); 55 } 56 auto context()() { 57 return BaseAudioContext(Object_Getter__Handle(this._parent, "context")); 58 } 59 uint numberOfInputs()() { 60 return Object_Getter__uint(this._parent, "numberOfInputs"); 61 } 62 uint numberOfOutputs()() { 63 return Object_Getter__uint(this._parent, "numberOfOutputs"); 64 } 65 void channelCount()(uint channelCount) { 66 Object_Call_uint__void(this._parent, "channelCount", channelCount); 67 } 68 uint channelCount()() { 69 return Object_Getter__uint(this._parent, "channelCount"); 70 } 71 void channelCountMode()(ChannelCountMode channelCountMode) { 72 Object_Call_int__void(this._parent, "channelCountMode", channelCountMode); 73 } 74 ChannelCountMode channelCountMode()() { 75 return Object_Getter__int(this._parent, "channelCountMode"); 76 } 77 void channelInterpretation()(ChannelInterpretation channelInterpretation) { 78 Object_Call_int__void(this._parent, "channelInterpretation", channelInterpretation); 79 } 80 ChannelInterpretation channelInterpretation()() { 81 return Object_Getter__int(this._parent, "channelInterpretation"); 82 } 83 uint id()() { 84 return Object_Getter__uint(this._parent, "id"); 85 } 86 } 87 struct AudioNodeOptions { 88 nothrow: 89 JsHandle handle; 90 alias handle this; 91 this(Handle h) { 92 this.handle = JsHandle(h); 93 } 94 static auto create() { 95 return AudioNodeOptions(libwasm_add__object()); 96 } 97 void channelCount()(uint channelCount) { 98 Object_Call_uint__void(this.handle, "channelCount", channelCount); 99 } 100 uint channelCount()() { 101 return Object_Getter__uint(this.handle, "channelCount"); 102 } 103 void channelCountMode()(ChannelCountMode channelCountMode) { 104 Object_Call_int__void(this.handle, "channelCountMode", channelCountMode); 105 } 106 ChannelCountMode channelCountMode()() { 107 return Object_Getter__int(this.handle, "channelCountMode"); 108 } 109 void channelInterpretation()(ChannelInterpretation channelInterpretation) { 110 Object_Call_int__void(this.handle, "channelInterpretation", channelInterpretation); 111 } 112 ChannelInterpretation channelInterpretation()() { 113 return Object_Getter__int(this.handle, "channelInterpretation"); 114 } 115 } 116 struct AudioNodePassThrough { 117 nothrow: 118 JsHandle handle; 119 alias handle this; 120 this(Handle h) { 121 this.handle = JsHandle(h); 122 } 123 void passThrough()(bool passThrough) { 124 Object_Call_bool__void(this.handle, "passThrough", passThrough); 125 } 126 bool passThrough()() { 127 return Object_Getter__bool(this.handle, "passThrough"); 128 } 129 } 130 enum ChannelCountMode { 131 max, 132 clamped_max, 133 explicit 134 } 135 enum ChannelInterpretation { 136 speakers, 137 discrete 138 } 139 140