1 module libwasm.bindings.OscillatorNode; 2 3 import libwasm.types; 4 5 import memutils.ct: tuple; 6 import libwasm.bindings.AudioNode; 7 import libwasm.bindings.AudioParam; 8 import libwasm.bindings.AudioScheduledSourceNode; 9 import libwasm.bindings.PeriodicWave; 10 11 @safe: 12 nothrow: 13 14 struct OscillatorNode { 15 nothrow: 16 libwasm.bindings.AudioScheduledSourceNode.AudioScheduledSourceNode _parent; 17 alias _parent this; 18 this(Handle h) { 19 _parent = .AudioScheduledSourceNode(h); 20 } 21 void type()(OscillatorType type) { 22 Object_Call_int__void(this._parent, "type", type); 23 } 24 OscillatorType type()() { 25 return Object_Getter__int(this._parent, "type"); 26 } 27 auto frequency()() { 28 return AudioParam(Object_Getter__Handle(this._parent, "frequency")); 29 } 30 auto detune()() { 31 return AudioParam(Object_Getter__Handle(this._parent, "detune")); 32 } 33 void setPeriodicWave()(scope ref PeriodicWave periodicWave) { 34 Object_Call_Handle__void(this._parent, "setPeriodicWave", periodicWave.handle); 35 } 36 void passThrough()(bool passThrough) { 37 Object_Call_bool__void(this._parent, "passThrough", passThrough); 38 } 39 bool passThrough()() { 40 return Object_Getter__bool(this._parent, "passThrough"); 41 } 42 } 43 struct OscillatorOptions { 44 nothrow: 45 libwasm.bindings.AudioNode.AudioNodeOptions _parent; 46 alias _parent this; 47 this(Handle h) { 48 _parent = .AudioNodeOptions(h); 49 } 50 static auto create() { 51 return OscillatorOptions(libwasm_add__object()); 52 } 53 void type()(OscillatorType type) { 54 Object_Call_int__void(this._parent, "type", type); 55 } 56 OscillatorType type()() { 57 return Object_Getter__int(this._parent, "type"); 58 } 59 void frequency()(float frequency) { 60 Object_Call_float__void(this._parent, "frequency", frequency); 61 } 62 float frequency()() { 63 return Object_Getter__float(this._parent, "frequency"); 64 } 65 void detune()(float detune) { 66 Object_Call_float__void(this._parent, "detune", detune); 67 } 68 float detune()() { 69 return Object_Getter__float(this._parent, "detune"); 70 } 71 void periodicWave()(scope ref PeriodicWave periodicWave) { 72 Object_Call_Handle__void(this._parent, "periodicWave", periodicWave.handle); 73 } 74 auto periodicWave()() { 75 return PeriodicWave(Object_Getter__Handle(this._parent, "periodicWave")); 76 } 77 } 78 enum OscillatorType { 79 sine, 80 square, 81 sawtooth, 82 triangle, 83 custom 84 } 85 86