problem: deleting waves form middle of wave array

For general discussion related FlowStone
Post Reply
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

problem: deleting waves form middle of wave array

Post by KG_is_back »

I'm working on a sampler and I came across a problem regarding sample indexing. Let's say I have 7 samples loaded and couple of parameters (array-parameters - one value for each sample per parameter). If I want to delete value form end of an array, that's no problem. However when I want to delete sample somewhere form the middle, let's say sample at index 4. It is no problem with the parameter arrays to delete value at index 4 leaving only 6 values in the array. However that doesn't work for wave array - you can only clear the wave leaving empty wave at that index (so the array will still have 7 waves with the 4th being empty).

Is there a way around it?

Apparently, reloading the whole array every time I delete a wave is stupid idea. I was thinking of creating an integer array, that would hold indexes of the actual samples related to parameters. So when I delete the wave at index 4, the int array would say [0,1,2,3,5,6]. However I have problem achieving that. Can anyone help me?
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: problem: deleting waves form middle of wave array

Post by Nubeat7 »

delete_if in ruby should do it..
Attachments
delete_if.fsm
(368 Bytes) Downloaded 850 times
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: problem: deleting waves form middle of wave array

Post by KG_is_back »

That is not what I was looking for - this can easily be done in intArray primitive. I'm trying to do this relative to wave array, so the IntArray will hold indexes of where that particular sample is in the wave array. I have problem adding new "sample" to new slot in wave array while adding index of that wave to the new value in int Array.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: problem: deleting waves form middle of wave array

Post by KG_is_back »

Actually I was thinking of using ruby to pack the wave index, velocity and key rages and couple of other parameters as a ruby array and create an array of arrays for the samples and all to them related data. However my ruby skills are quite low, so I might need help with that.
stw
Posts: 111
Joined: Tue Jul 13, 2010 11:09 am
Contact:

Re: problem: deleting waves form middle of wave array

Post by stw »

Did you already try the SetArray prim form the R&D components for reindexing?
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: problem: deleting waves form middle of wave array

Post by KG_is_back »

Thats not actually a bad idea! copy the last wave onto the place of the deleted and then resize array. Saves place! Reindexing full array would probably be on overshot.
Post Reply