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

make array-access 64bit safe #1

Merged
merged 3 commits into from
Nov 9, 2018

Conversation

umlaeute
Copy link
Contributor

@umlaeute umlaeute commented Nov 8, 2018

and minor help-patch improvements.

note: this was done on a machine without audio out. so please test before merging :-)

@umlaeute
Copy link
Contributor Author

umlaeute commented Nov 8, 2018

just a side-note on the implementation: the proposed solution indeed creates a copy of the table before passing it to setBuffer.

if you change the content of the table, this buffer will contain stale data, and the object will not be aware of any changes to the table after the set message.
if you need to be able to update the table on the fly, this won't work, and you will indeed need to break the API for your C++ library (probably just introducing a stride argument to allow for arbitrary spacing of the table elements).

also note, that with double-precision (#2), you will face a similar problem.

@josephlarralde
Copy link
Owner

Ach, I was too slow answering :)
Yes, I noticed there was a copy made when the set message was received, which in addition to the issues you mention, makes me fear that when switching large amounts of table references at the same time during a live performance you could get some drop outs, especially if the buffers are large.

Thanks a lot for pointing me to the stride solution. If I understand correctly, you mean the w_float is an attribute of a struct (t_word ?), and I could use the stride to grab only the relevant parts of the structs because they are all aligned in memory in the array ?
This sounds perfect, I'll investigate this way. I already have stride arguments in my c++ lib so it shouldn't take too many modifications.

BTW, just tested your fix, it's working perfectly (on my osx 32bit pd) !

@josephlarralde josephlarralde merged commit a259515 into josephlarralde:master Nov 9, 2018
@josephlarralde
Copy link
Owner

I pulled your branch locally and implemented the stride approach on top of it, which only took me to write a new interpolation function and change a few lines in jl.cpp.lib. I just merged and pushed our modifications to master. Thanks for your help !

@umlaeute umlaeute deleted the array64 branch November 9, 2018 14:02
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

Successfully merging this pull request may close these issues.

None yet

2 participants