Int Array Help

For general discussion related FlowStone
User avatar
TrojakEW
Posts: 111
Joined: Sat Dec 25, 2010 10:12 am
Location: Slovakia

Int Array Help

Post by TrojakEW »

Hello guys. Can somebody help me with small problem? I need to swap values in integer arrays. I know ho to easilly do this in ruby but i need solution with green primitives since i dont want to use ruby at all.

I need this for module/effect ordering. So for example I have array with six integers 0,1,2,3,4,5 and i need to swap two choosen values. For example 0 with 3. I have tried to do it by myself but no good working soluton.
Exo
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK
Contact:

Re: Int Array Help

Post by Exo »

Inside the Developer toolkit in the Array section is a "Sort integer array" module, have a look at that it uses swapping to sort the array. Maybe you can learn from or modify it for your needs.
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
Youlean
Posts: 176
Joined: Mon Jun 09, 2014 2:49 pm

Re: Int Array Help

Post by Youlean »

Here you go...
Attachments
Swap.fsm
(433 Bytes) Downloaded 820 times
User avatar
TrojakEW
Posts: 111
Joined: Sat Dec 25, 2010 10:12 am
Location: Slovakia

Re: Int Array Help

Post by TrojakEW »

Thanks you guys. I will check booth and see what is best for me.
User avatar
TrojakEW
Posts: 111
Joined: Sat Dec 25, 2010 10:12 am
Location: Slovakia

Re: Int Array Help

Post by TrojakEW »

Well I found the same problem in booth version and in my own attempt too while swaping the array. Problem is when I want to use array from output again for another swap. Look in attached file - I used Yoleen example. Try to change index few time and you will see the problem. It will add same value to two indexes after 2 or more changes. How to fix that?
Attachments
Swap_loop.fsm
(488 Bytes) Downloaded 823 times
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Int Array Help

Post by martinvicanek »

Hmm, perhaps a trigger order issue? Here is an alternative using code instead of green.
Attachments
SwapIntArray.fsm
(766 Bytes) Downloaded 856 times
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: Int Array Help

Post by Nubeat7 »

here is a green version which should work correct
Attachments
Swap_array_elements_green.fsm
(578 Bytes) Downloaded 818 times
Youlean
Posts: 176
Joined: Mon Jun 09, 2014 2:49 pm

Re: Int Array Help

Post by Youlean »

This should work correctly now in loop.
Attachments
Swap V2.fsm
(486 Bytes) Downloaded 821 times
User avatar
TrojakEW
Posts: 111
Joined: Sat Dec 25, 2010 10:12 am
Location: Slovakia

Re: Int Array Help

Post by TrojakEW »

Thanks. Going to test them today.
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Int Array Help

Post by MyCo »

My version is quite similar to Nubeat7's...
Attachments
Swap (MyCo).fsm
(1.24 KiB) Downloaded 802 times
Post Reply