chugins icon indicating copy to clipboard operation
chugins copied to clipboard

Wavetable | issues when changing array size

Open mariobuoninfante opened this issue 5 years ago • 4 comments

Tested on Ubuntu Studio 16.04 64bit - ChucK 1.4.0.0

Hi, I found out that once the size of the array in Wavetable has been increased, there's no way to use an array smaller than the last one in use without having issues. Let's say Wavetable is initialized using an array of size 512, then in the program you pass to setTable() an array of 1024, then going back to an array of 512 doesn't scale back properly (if that makes sense).

I think the issue could be the following, in Wavetable.cpp on line 156 we have: table_size = (int)userArray->capacity();

while it should probably be: table_size = (int)userArray->size();

mariobuoninfante avatar Jan 04 '20 22:01 mariobuoninfante

Thanks Mario. Do you have a short example of ChucK code that demonstrates this bug?

jwmatthys avatar Jan 13 '20 17:01 jwmatthys

I had to do a little research on capacity vs size, and yes, you're right. Pushing the change ASAP.

jwmatthys avatar Jan 13 '20 18:01 jwmatthys

Presumably this issue can be closed as fixed by pull request #42?

heuermh avatar Sep 11 '20 20:09 heuermh

Yes, I think this can be closed.

jwmatthys avatar Jan 12 '21 19:01 jwmatthys

excellent! thank you all!

gewang avatar May 16 '23 04:05 gewang