Welcome to %s forums

BrainModular Users Forum

Login Register

how to reorder an array?

I need help on a Patch
Post Reply
Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 21 Jul 2011, 14:15

for example, I have been working on a patch using the pianoroll's array: a huge amount of 5 different values (position, duration, note value, data1, data2).

I'm planning to create an event list, something like this:
Image

that list is editable, I can change any displayed value.

but, once I change, for example, the position of a note, it gets out of place:
Image

how can I automatically reorder the array and put the 5 set values in place? :)

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 21 Jul 2011, 22:06

it reminds me something we did already in another thread, it was about 'sorting slaves', i think ive lost the script but it's somewhere on the forum, try to have a look, ill try too, but i must go now.. basically it sort a master array, and several slaves will follow.


Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 22 Jul 2011, 05:04

Thanks 23fx23 and nay!
Right now I`m reading that topic and looks really useful for me!

Btw the above midi event list panel should be a nice example to the use of sorting a masters array :)

It will take many days but probably at the end of next week I will have a basic patch ready. The more delicate part is related to the fact that this patch directly writes to the pianoroll array, so if done wrongly , then the pianoroll module will behave like crazy until cleared. And the resulting saved midi file will be unusable without warning.

Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 23 Jul 2011, 04:49

ok, I have readed the thread and downloaded the examples. and...it really works! :)
For now I´m just trying to modify parts of the code to make use of an array larger than 511 values and the use of non-integer values.

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 23 Jul 2011, 12:57

Well done nay, thats the one indeed ;)
To extend length, it can be done via the command
Setlength(arrayname,1023);
But normally the output size is defined by input array length, and it should work if you extend it externally no? Or maybe some variable in the script as been maxed to 511, track this nb and extend as you wish.

For the non integer, its probably to replace an integer declared variable as 'single' instead of integer, and check and remove any 'trunc' or 'round' being used.

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests