vectrixdevelops / audio-mpg123

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

Remove `length` argument from `write` method? #12

Open dy opened 7 years ago

dy commented 7 years ago

Why can't we just detect length from the buffer?

mpg.write(pointer, buf, buf.length, onend)mpg.write(pointer, buf, onend)

vectrixdevelops commented 7 years ago

The buffers are pointers on C++ and pointers don't keep track of their size. We need to keep track of their size manually. I believe this will be changed on NAPI as buffers will be an object that has a method to get the data size.

jamen commented 7 years ago

Shouldn't we leave it open until it is patched? I can make a commit on the NAPI branch that will close this when we merge it. (Edit: Just so I don't forget!)