AudioNet / node-core-audio

Bindings for PortAudio giving JavaScript access to sound card samples (mostly unmaintained)
MIT License
330 stars 67 forks source link

AudioEngine object unavailable #32

Closed brentjanderson closed 6 years ago

brentjanderson commented 10 years ago

I'm experimenting with Node-Core-Audio and am very impressed with its potential, however I'm running into issues working with the AudioEngine object. Specifically, audio engine methods are totally unavailable within the NodeJS runtime. Here's a sample error:

input :0
output :1
rate :44100
format :1
size :4
inputChannels :1
outputChannels :2
interleaved :0

node_modules/node-core-audio/node-core-audio.js:255
    return this.audioEngine.setOutputDevice( deviceId );
                            ^
TypeError: Object #<AudioEngine> has no method 'setOutputDevice'
    at AudioEngine.setOutputDevice (node_modules/node-core-audio/node-core-audio.js:255:26)
    at Object.<anonymous> (app.js:21:8)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

audioEngine.setOutputDevice is shown here, however any other method of audioEngine is simply not there.

I'm not familiar enough with Node C++ bindings to really be able to give a shot at fixing this myself, although it seems to be executing the C++ code just fine - in fact, the initializer in C++ for the AudioEngine is definitely triggered (Since you see the block of input/output information at the top of the output above). The result of that initializer function doesn't seem to be making it back to Node, where it should be available to AudioEngine under this.audioEngine. The lines where things seem to break down in JS are at 49 of node-core-audio.js:

// This line does not return anything but a bare object {}
this.audioEngine = audioEngineImpl.createAudioEngine( this.options, callback );

Any ideas?