Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bufferSetn not working as expected #115

Open
relativeflux opened this issue Jan 22, 2022 · 0 comments
Open

bufferSetn not working as expected #115

relativeflux opened this issue Jan 22, 2022 · 0 comments

Comments

@relativeflux
Copy link

relativeflux commented Jan 22, 2022

I am attempting to use bufferSetn to set samples into a pre-allocated buffer, but it's not working for me. I allocate the buffer like this:

await server.buffer(10);

Then I try to set it like this:

const payload = [
  -0.000732421875,
  0.00103759765625,
  -0.000823974609375,
  0.00103759765625,
  -0.00103759765625,
  0.000732421875,
  -0.000732421875,
  0.000823974609375,
  -0.000732421875,
  0.000823974609375
];

sc.server.msg.bufferSetn(0, 0, payload);

But when I subsequently use bufferGetn to interrogate the buffer contents it shows it to be still empty:

console.log(await server.callAndResponse(sc.server.msg.bufferGetn(0, 0, 10)));

Using readBuffer works fine, in that case bufferGetn shows me that the contents of the buffer have been set (readBuffer allocates it's own buffer, though).

What am I doing wrong? Is this the expected result?

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

No branches or pull requests

1 participant