vectrixdevelops / audio-mpg123

A native node binding to write raw PCM data to an OS driver.
MIT License
5 stars 0 forks source link

N-API #10

Closed jamen closed 4 years ago

jamen commented 7 years ago

A work in progress branch of N-API refactor

It includes some breaking API changes that take a more simple approach. e.g.

  1. There is no more finis(success) callbacks, we just return booleans or objects.
  2. The pointer is a plain object using napi_create_external instead of the old pointer_wrapper.h
  3. The formats are shorter, at mpg123.<S8,S16,S32,U8,U16,U32,F32,F64>, for signed, unsigned, and floats

Currently working on mpg123.write and mpg123.flush. Will be tricky because I have to learn their async system! I am not that experienced with C++ so we will see how this goes, might take a bit longer. Help wanted.

vectrixdevelops commented 7 years ago

This could be merged after NAPI reaches a more mature and stable state in Node. Currently master and NAPI can be used as a test comparison to assist NAPI with development too. Keep up the good work!

jamen commented 7 years ago

Not bothered with Travis atm cuz I dont even have teste written. Also mpg123.write still needs work, still learning how to do their async.

vectrixdevelops commented 7 years ago

Just for when you get around to it.

dy commented 6 years ago

Hey @jamen what's the status of the issue? How do you think is the NAPI strong enough to go on with that instead of nan?

jamen commented 6 years ago

Hey @dfcreative. I pushed some changes and I'm gonna keep hacking at this branch. Replied to your email for more details.

About the stability of N-API. I think it is stable enough. It is no longer hidden behind a flag, but the API did change a bit since I last used it (nothing really complicated). One downside is that it outputs this:

(node:24955) Warning: N-API is an experimental feature and could change at any time.

Maybe there is a flag we can compile with in binding.gyp to disable this?

jamen commented 6 years ago

I'll be busy next few weeks. Here are resources I've used if anyone is interested in continuing this:

Some extra thoughts:

jamen commented 6 years ago

N-API is no longer experimental in Node v10