Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

questions on buffer handling #3

Open
mreinstein opened this issue May 3, 2019 · 1 comment
Open

questions on buffer handling #3

mreinstein opened this issue May 3, 2019 · 1 comment

Comments

@mreinstein
Copy link

mreinstein commented May 3, 2019

Hey @alexmoon, thanks for writing this module! Been a great learning resource. :)

I'm curious about some of the logic in your _write() call. This line:

https://github.com/alexmoon/pv-porcupine/blob/master/index.ts#L133

we return, but there might still be leftover data in chunk. Is this intentional?

Similarly on line 144 we return, and there might be data in chunk that hasn't been copied to the buffer.

are we intentionally only processing the first full frame of data and then returning, or is this by accident?

@mreinstein
Copy link
Author

mreinstein commented May 3, 2019

I'm also curious about line 105:

this.frameSize = porcupine.frameLength() * 2;

What is the 2 in this case? Is this because chunk is a byte array, and porcupine.frameLength() is the number of int16 values that are desired?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant