AudioNet / node-core-audio

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

no overloaded function takes 2 arguments #72

Closed ztzven closed 5 years ago

ztzven commented 5 years ago

I get the error when trying to install (and build)

..\NodeCoreAudio\AudioEngine.cpp(473): error C2661: 'v8::Function::NewInstance': no overloaded function takes 2 arguments [...\node_mo
dules\node-core-audio\build\NodeCoreAudio.vcxproj
icyJoseph commented 5 years ago

Argh, same. Have you tried cloning and building locally?

icyJoseph commented 5 years ago

@ztzven I've fixed this :)!

  1. Clone the repo
  2. Go inside AudioEngine.cpp,
  3. Go to void Audio::AudioEngine::NewInstance,
  4. And modify it to the following:
void Audio::AudioEngine::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info) {
    Nan::HandleScope scope;
    //HandleScope scope;

    unsigned argc = info.Length();

    if( argc > 2 )
        argc = 2;

    Handle<Value>* argv = new Handle<Value>[argc];

    argv[0] = info[0];
    if( argc > 1 )
        argv[1] = info[1];

    v8::Local<v8::Function> cons = Nan::New(constructor); // -> This is new
    //Local<Object> instance = constructor->NewInstance( argc, argv );
    //Local<Object> instance = constructor->NewInstance(argc, argv);

    info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); // Also new!
} // end AudioEngine::NewInstance()
  1. Run npm install and you are good to go!
ztzven commented 5 years ago

Thanks for the patch!! I'll give it a go when home later. However... any idea why the build error made it into a release?

ztzven commented 5 years ago

Ahh.. I see, it is a node v10 constraint :)