node-midi icon indicating copy to clipboard operation
node-midi copied to clipboard

can node-midi become "Context Aware" ?

Open ossandust opened this issue 5 years ago • 8 comments

I intend to use node-midi in an Electron app. I bumped upon following Electron discussion : https://github.com/electron/electron/issues/18397 and I wonder what will happen when Electron 9 is released. Will node-midi require changes to make it context aware? If so are there plans to do so? Thanks.

ossandust avatar Apr 22 '20 15:04 ossandust

I have submitted a PR #213. @justinlatimer Can you please review, test, and publish at your earliest convenience? Thanks!

wookayin avatar Nov 10 '21 05:11 wookayin

@wookayin Ha:) Sorry, it seems like we made quite the same thing. Did you test your implementation? My first attempts with NAN_MODULE_WORKER_ENABLED was failed. Also, there is a necessity to support the previous version of node.js so you need to add conditional init of the module I guess.

Anyway, here is my request #214

@justinlatimer now it's your turn :)

1pxone avatar Nov 12 '21 23:11 1pxone

Definitely need this one. I'd like to use the library in Electron. A bunch of other packages are also restricted on the basis that they use this one.

Mister-SOSA avatar Jan 20 '22 21:01 Mister-SOSA

Can this please be merged? Having the same problem as @Mister-SOSA :(

EDIT: I've tried to use some of the forks listed here and none have worked so far. Does anyone know why? (running Electron 16)

D3visionNL avatar May 03 '22 08:05 D3visionNL

Any movement on this? Looks like the lib author @justinlatimer has been inactive on this repo for just about a year now, with his recent commits while he was active looking closer to maintenance than working on new features such as this

bdotsamir avatar Jul 16 '22 02:07 bdotsamir

I'd really like to contribute and help here. I also need to run midi in a worker thread. The PR #213 as well as #214 fixes the initial loading for me, however once I close and recreate the worker thread, Node crashes completely. Either, I get no stack trace or something like

FATAL ERROR: v8::Object::SetAlignedPointerInInternalField() Internal field out of bounds
 1: 00007FF73F3E401F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+112511
 2: 00007FF73F373146 DSA_meth_get_flags+65542
 3: 00007FF73F373FFD node::OnFatalError+301
 4: 00007FF73FC9B0E4 v8::ObjectTemplate::InternalFieldCount+212
 5: 00007FF73FCA84E3 v8::Object::SetAlignedPointerInInternalField+35
 6: 00007FF73F1F0B16 v8::internal::RegExpMacroAssemblerX64::stack_limit_slack+5126
 7: 00007FF73F37CF25 node::OnFatalError+36949
 8: 00007FF73F3E280C v8::internal::CodeObjectRegistry::~CodeObjectRegistry+106348
 9: 00007FF73F40F1E0 node::FreeEnvironment+112
10: 00007FF73F2AC2D5 v8::internal::wasm::SignatureMap::Freeze+35861
11: 00007FF73F2A78D8 v8::internal::wasm::SignatureMap::Freeze+16920
12: 00007FF73F43324D uv_poll_stop+557
13: 00007FF740244D60 v8::internal::compiler::RepresentationChanger::Uint32OverflowOperatorFor+146416
14: 00007FFB73A27034 BaseThreadInitThunk+20
15: 00007FFB74B22651 RtlUserThreadStart+33
npm ERR! Lifecycle script `start` failed with error: 
npm ERR! Error: command failed
npm ERR!   in workspace: [email protected]
npm ERR!   at location: A:\_Source\GLUE\packages\Glue

any idea?

hrueger avatar Aug 08 '22 17:08 hrueger

for those that are using this in electron, you should know that the web already has a midi API. https://developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API.

bdotsamir avatar Aug 08 '22 18:08 bdotsamir

I have opened a PR to do an overhaul of this library which includes solving this (#228) As it doesn't look like there are any maintainers around to merge it, I shall be maintaining a fork which is 100% api compatible https://www.npmjs.com/package/@julusian/midi

Julusian avatar Oct 01 '22 10:10 Julusian