Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion deps/exokit-bindings/bindings/src/bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,39 +101,77 @@ Local<Object> makeAudio() {
Local<Object> exports = Nan::New<Object>();

exports->Set(JS_STR("Audio"), webaudio::Audio::Initialize(isolate));

Local<Value> audioParamCons = webaudio::AudioParam::Initialize(isolate);
exports->Set(JS_STR("AudioParam"), audioParamCons);

Local<Value> fakeAudioParamCons = webaudio::FakeAudioParam::Initialize(isolate);
exports->Set(JS_STR("FakeAudioParam"), fakeAudioParamCons);

Local<Value> audioListenerCons = webaudio::AudioListener::Initialize(isolate, fakeAudioParamCons);
exports->Set(JS_STR("AudioListener"), audioListenerCons);

Local<Value> audioSourceNodeCons = webaudio::AudioSourceNode::Initialize(isolate);
exports->Set(JS_STR("AudioSourceNode"), audioSourceNodeCons);

Local<Value> audioDestinationNodeCons = webaudio::AudioDestinationNode::Initialize(isolate);
exports->Set(JS_STR("AudioDestinationNode"), audioDestinationNodeCons);

Local<Value> gainNodeCons = webaudio::GainNode::Initialize(isolate, audioParamCons);
exports->Set(JS_STR("GainNode"), gainNodeCons);

Local<Value> analyserNodeCons = webaudio::AnalyserNode::Initialize(isolate);
exports->Set(JS_STR("AnalyserNode"), analyserNodeCons);

Local<Value> biquadFilterNodeCons = webaudio::BiquadFilterNode::Initialize(isolate, audioParamCons);
exports->Set(JS_STR("BiquadFilterNode"), biquadFilterNodeCons);

Local<Value> channelMergerNodeCons = webaudio::ChannelMergerNode::Initialize(isolate);
exports->Set(JS_STR("ChannelMergerNode"), channelMergerNodeCons);

Local<Value> channelSplitterNodeCons = webaudio::ChannelSplitterNode::Initialize(isolate);
exports->Set(JS_STR("ChannelSplitterNode"), channelSplitterNodeCons);

Local<Value> convolverNodeCons = webaudio::ConvolverNode::Initialize(isolate);
exports->Set(JS_STR("ConvolverNode"), convolverNodeCons);

Local<Value> delayNodeCons = webaudio::DelayNode::Initialize(isolate, audioParamCons);
exports->Set(JS_STR("DelayNode"), delayNodeCons);

Local<Value> dynamicsCompressorNodeCons = webaudio::DynamicsCompressorNode::Initialize(isolate, audioParamCons);
exports->Set(JS_STR("DynamicsCompressorNode"), dynamicsCompressorNodeCons);

Local<Value> pannerNodeCons = webaudio::PannerNode::Initialize(isolate, fakeAudioParamCons);
exports->Set(JS_STR("PannerNode"), pannerNodeCons);

Local<Value> stereoPannerNodeCons = webaudio::StereoPannerNode::Initialize(isolate, audioParamCons);
exports->Set(JS_STR("StereoPannerNode"), stereoPannerNodeCons);

Local<Value> oscillatorNodeCons = webaudio::OscillatorNode::Initialize(isolate, audioParamCons);
exports->Set(JS_STR("OscillatorNode"), oscillatorNodeCons);

Local<Value> audioBufferCons = webaudio::AudioBuffer::Initialize(isolate);
exports->Set(JS_STR("AudioBuffer"), audioBufferCons);

Local<Value> audioBufferSourceNodeCons = webaudio::AudioBufferSourceNode::Initialize(isolate, audioParamCons);
exports->Set(JS_STR("AudioBufferSourceNode"), audioBufferSourceNodeCons);

Local<Value> audioProcessingEventCons = webaudio::AudioProcessingEvent::Initialize(isolate);
exports->Set(JS_STR("AudioProcessingEvent"), audioProcessingEventCons);

Local<Value> scriptProcessorNodeCons = webaudio::ScriptProcessorNode::Initialize(isolate, audioBufferCons, audioProcessingEventCons);
exports->Set(JS_STR("ScriptProcessorNode"), scriptProcessorNodeCons);

Local<Value> waveShaperNodeCons = webaudio::WaveShaperNode::Initialize(isolate);
exports->Set(JS_STR("WaveShaperNode"), waveShaperNodeCons);

Local<Value> mediaStreamTrackCons = webaudio::MediaStreamTrack::Initialize(isolate);
exports->Set(JS_STR("MediaStreamTrack"), mediaStreamTrackCons);

Local<Value> microphoneMediaStreamCons = webaudio::MicrophoneMediaStream::Initialize(isolate, mediaStreamTrackCons);
exports->Set(JS_STR("MicrophoneMediaStream"), microphoneMediaStreamCons);
exports->Set(JS_STR("AudioContext"), webaudio::AudioContext::Initialize(isolate, audioListenerCons, audioSourceNodeCons, audioDestinationNodeCons, gainNodeCons, analyserNodeCons, pannerNodeCons, audioBufferCons, audioBufferSourceNodeCons, audioProcessingEventCons, stereoPannerNodeCons, oscillatorNodeCons, scriptProcessorNodeCons, mediaStreamTrackCons, microphoneMediaStreamCons));

exports->Set(JS_STR("AudioContext"), webaudio::AudioContext::Initialize(isolate, audioListenerCons, audioSourceNodeCons, audioDestinationNodeCons, gainNodeCons, analyserNodeCons, biquadFilterNodeCons, channelMergerNodeCons, channelSplitterNodeCons, convolverNodeCons, delayNodeCons, dynamicsCompressorNodeCons, pannerNodeCons, audioBufferCons, audioBufferSourceNodeCons, audioProcessingEventCons, stereoPannerNodeCons, oscillatorNodeCons, scriptProcessorNodeCons, waveShaperNodeCons, mediaStreamTrackCons, microphoneMediaStreamCons));

return scope.Escape(exports);
}
Expand Down
1 change: 1 addition & 0 deletions deps/exokit-bindings/webaudiocontext/include/AudioBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class AudioBuffer : public ObjectWrap {

friend class AudioBufferSourceNode;
friend class ScriptProcessorNode;
friend class ConvolverNode;
};

class AudioBufferSourceNode : public AudioNode {
Expand Down
45 changes: 44 additions & 1 deletion deps/exokit-bindings/webaudiocontext/include/AudioContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@
#include <AudioDestinationNode.h>
#include <GainNode.h>
#include <AnalyserNode.h>
#include <BiquadFilterNode.h>
#include <ChannelMergerNode.h>
#include <ChannelSplitterNode.h>
#include <ConvolverNode.h>
#include <DelayNode.h>
#include <DynamicsCompressorNode.h>
#include <PannerNode.h>
#include <OscillatorNode.h>
#include <StereoPannerNode.h>
#include <AudioBuffer.h>
#include <ScriptProcessorNode.h>
#include <WaveShaperNode.h>
#include <AudioListener.h>
#include <MediaStreamTrack.h>
#include <MicrophoneMediaStream.h>
Expand All @@ -37,21 +44,50 @@ lab::AudioContext *getDefaultAudioContext(float sampleRate = lab::DefaultSampleR

class AudioContext : public ObjectWrap {
public:
static Local<Object> Initialize(Isolate *isolate, Local<Value> audioListenerCons, Local<Value> audioSourceNodeCons, Local<Value> audioDestinationNodeCons, Local<Value> gainNodeCons, Local<Value> analyserNodeCons, Local<Value> pannerNodeCons, Local<Value> audioBufferCons, Local<Value> audioBufferSourceNodeCons, Local<Value> audioProcessingEventCons, Local<Value> stereoPannerNodeCons, Local<Value> oscillatorNodeCons, Local<Value> scriptProcessorNodeCons, Local<Value> mediaStreamTrackCons, Local<Value> microphoneMediaStreamCons);
static Local<Object> Initialize(
Isolate *isolate,
Local<Value> audioListenerCons,
Local<Value> audioSourceNodeCons,
Local<Value> audioDestinationNodeCons,
Local<Value> gainNodeCons,
Local<Value> analyserNodeCons,
Local<Value> biquadFilterNodeCons,
Local<Value> ChannelMergerNodeCons,
Local<Value> ChannelSplitterNodeCons,
Local<Value> ConvolverNodeCons,
Local<Value> DelayNodeCons,
Local<Value> dynamicsCompressorNodeCons,
Local<Value> pannerNodeCons,
Local<Value> audioBufferCons,
Local<Value> audioBufferSourceNodeCons,
Local<Value> audioProcessingEventCons,
Local<Value> stereoPannerNodeCons,
Local<Value> oscillatorNodeCons,
Local<Value> scriptProcessorNodeCons,
Local<Value> waveShaperCons,
Local<Value> mediaStreamTrackCons,
Local<Value> microphoneMediaStreamCons);
void Close();
Local<Object> CreateMediaElementSource(Local<Function> audioDestinationNodeConstructor, Local<Object> mediaElement, Local<Object> audioContextObj);
Local<Object> CreateMediaStreamSource(Local<Function> audioSourceNodeConstructor, Local<Object> mediaStream, Local<Object> audioContextObj);
void CreateMediaStreamDestination();
void CreateMediaStreamTrackSource();
Local<Object> CreateGain(Local<Function> gainNodeConstructor, Local<Object> audioContextObj);
Local<Object> CreateAnalyser(Local<Function> analyserNodeConstructor, Local<Object> audioContextObj);
Local<Object> CreateBiquadFilter(Local<Function> biquadFilterNodeConstructor, Local<Object> audioContextObj);
Local<Object> CreateChannelMerger(Local<Function> ChannelMergerNodeConstructor, uint32_t numberOfInputs, Local<Object> audioContextObj);
Local<Object> CreateChannelSplitter(Local<Function> ChannelSplitterNodeConstructor, uint32_t numberOfOutputs, Local<Object> audioContextObj);
Local<Object> CreateConvolver(Local<Function> ConvolverNodeConstructor, Local<Object> audioContextObj);
Local<Object> CreateDelay(Local<Function> DelayNodeConstructor, double maxDelayTime, float sampleRate, Local<Object> audioContextObj);
Local<Object> CreateDynamicsCompressor(Local<Function> dynamicsCompressorNodeConstructor, Local<Object> audioContextObj);
Local<Object> CreatePanner(Local<Function> pannerNodeConstructor, Local<Object> audioContextObj);
Local<Object> CreateStereoPanner(Local<Function> stereoPannerNodeConstructor, Local<Object> audioContextObj);
Local<Object> CreateOscillator(Local<Function> oscillatorNodeConstructor, Local<Object> audioContextObj);
Local<Object> CreateBuffer(Local<Function> audioBufferConstructor, uint32_t numOfChannels, uint32_t length, uint32_t sampleRate);
Local<Object> CreateEmptyBuffer(Local<Function> audioBufferConstructor, uint32_t sampleRate);
Local<Object> CreateBufferSource(Local<Function> audioBufferSourceNodeConstructor, Local<Object> audioContextObj);
Local<Object> CreateScriptProcessor(Local<Function> scriptProcessorNodeConstructor, uint32_t bufferSize, uint32_t numberOfInputChannels, uint32_t numberOfOutputChannels, Local<Object> audioContextObj);
Local<Object> CreateWaveShaper(Local<Function> WaveShaperNodeConstructor, Local<Object> audioContextObj);
void Suspend();
void Resume();

Expand All @@ -64,13 +100,20 @@ class AudioContext : public ObjectWrap {
static NAN_METHOD(CreateMediaStreamTrackSource);
static NAN_METHOD(CreateGain);
static NAN_METHOD(CreateAnalyser);
static NAN_METHOD(CreateBiquadFilter);
static NAN_METHOD(CreateChannelMerger);
static NAN_METHOD(CreateChannelSplitter);
static NAN_METHOD(CreateConvolver);
static NAN_METHOD(CreateDelay);
static NAN_METHOD(CreateDynamicsCompressor);
static NAN_METHOD(CreatePanner);
static NAN_METHOD(CreateStereoPanner);
static NAN_METHOD(CreateOscillator);
static NAN_METHOD(CreateBuffer);
static NAN_METHOD(CreateEmptyBuffer);
static NAN_METHOD(CreateBufferSource);
static NAN_METHOD(CreateScriptProcessor);
static NAN_METHOD(CreateWaveShaper);
static NAN_METHOD(Suspend);
static NAN_METHOD(Resume);
static NAN_GETTER(CurrentTimeGetter);
Expand Down
3 changes: 3 additions & 0 deletions deps/exokit-bindings/webaudiocontext/include/AudioParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ class AudioParam : public ObjectWrap {
friend class StereoPannerNode;
friend class OscillatorNode;
friend class AudioBufferSourceNode;
friend class DynamicsCompressorNode;
friend class BiquadFilterNode;
friend class DelayNode;
};

}
Expand Down
37 changes: 37 additions & 0 deletions deps/exokit-bindings/webaudiocontext/include/BiquadFilterNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef _BIQUAD_FILTER_NODE_H_
#define _BIQUAD_FILTER_NODE_H_

#include <v8.h>
#include <node.h>
#include <nan.h>
#include "LabSound/extended/LabSound.h"
#include <defines.h>
#include <AudioNode.h>
#include <AudioParam.h>

using namespace std;
using namespace v8;
using namespace node;

namespace webaudio {

class BiquadFilterNode : public AudioNode {
public:
static Local<Object> Initialize(Isolate *isolate, Local<Value> audioParamCons);
static void InitializePrototype(Local<ObjectTemplate> proto);

protected:
static NAN_METHOD(New);
static NAN_METHOD(GetFrequencyResponse);
static NAN_GETTER(TypeGetter);
static NAN_SETTER(TypeSetter);

BiquadFilterNode();
~BiquadFilterNode();

protected:
};

}

#endif
33 changes: 33 additions & 0 deletions deps/exokit-bindings/webaudiocontext/include/ChannelMergerNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef _CHANNEL_MERGER_NODE_H_
#define _CHANNEL_MERGER_NODE_H_

#include <v8.h>
#include <node.h>
#include <nan.h>
#include "LabSound/extended/LabSound.h"
#include <defines.h>
#include <AudioNode.h>

using namespace std;
using namespace v8;
using namespace node;

namespace webaudio {

class ChannelMergerNode : public AudioNode {
public:
static Local<Object> Initialize(Isolate *isolate);
static void InitializePrototype(Local<ObjectTemplate> proto);

protected:
static NAN_METHOD(New);

ChannelMergerNode(uint32_t numberOfInputs);
~ChannelMergerNode();

protected:
};

}

#endif
33 changes: 33 additions & 0 deletions deps/exokit-bindings/webaudiocontext/include/ChannelSplitterNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef _CHANNEL_SPLITTER_NODE_H_
#define _CHANNEL_SPLITTER_NODE_H_

#include <v8.h>
#include <node.h>
#include <nan.h>
#include "LabSound/extended/LabSound.h"
#include <defines.h>
#include <AudioNode.h>

using namespace std;
using namespace v8;
using namespace node;

namespace webaudio {

class ChannelSplitterNode : public AudioNode {
public:
static Local<Object> Initialize(Isolate *isolate);
static void InitializePrototype(Local<ObjectTemplate> proto);

protected:
static NAN_METHOD(New);

ChannelSplitterNode(uint32_t numberOfOutputs);
~ChannelSplitterNode();

protected:
};

}

#endif
40 changes: 40 additions & 0 deletions deps/exokit-bindings/webaudiocontext/include/ConvolverNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef _CONVOLVER_NODE_H_
#define _CONVOLVER_NODE_H_

#include <v8.h>
#include <node.h>
#include <nan.h>
#include <string>
#include "LabSound/extended/LabSound.h"
#include <defines.h>
#include <AudioNode.h>
#include <AudioBuffer.h>

using namespace std;
using namespace v8;
using namespace node;

namespace webaudio {

class ConvolverNode : public AudioNode {
public:
static Local<Object> Initialize(Isolate *isolate);
static void InitializePrototype(Local<ObjectTemplate> proto);

protected:
static NAN_METHOD(New);
static NAN_GETTER(BufferGetter);
static NAN_SETTER(BufferSetter);
static NAN_GETTER(NormalizeGetter);
static NAN_SETTER(NormalizeSetter);

ConvolverNode();
~ConvolverNode();

protected:
Nan::Persistent<Object> audioBuffer;
};

}

#endif
33 changes: 33 additions & 0 deletions deps/exokit-bindings/webaudiocontext/include/DelayNode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef _DELAY_NODE_H_
#define _DELAY_NODE_H_

#include <v8.h>
#include <node.h>
#include <nan.h>
#include "LabSound/extended/LabSound.h"
#include <defines.h>
#include <AudioNode.h>

using namespace std;
using namespace v8;
using namespace node;

namespace webaudio {

class DelayNode : public AudioNode {
public:
static Local<Object> Initialize(Isolate *isolate, Local<Value> audioParamCons);
static void InitializePrototype(Local<ObjectTemplate> proto);

protected:
static NAN_METHOD(New);

DelayNode();
~DelayNode();

protected:
};

}

#endif
Loading