## Array string extraction / String Switch

Scope and XITE Development

Original topic on PlanetZ: https://forums.scopeusers.com/viewtopic.php?t=35216

#### Array string extraction / String Switch

Posted: Fri Dec 01, 2017 7:42 am
by faxinadu
Looking for a way to manipulate some data. i can start with either an array or a collection of strings and what i want to do is end up with one string out of the choices presented in the array or collection of sources.
So, either an ability to be able to extract strings from an array based on index location or a switch that can handle strings.
any ideas?

#### Re: Array string extraction / String Switch

Posted: Sat Dec 02, 2017 8:43 am
by w_ellis
I never had too much fun working with Strings or Arrays, but I think that was due to my limited C++ skills. There was a discussion here that could start pointing in the right direction, but I never had time to follow up on it. http://bcmodular.co.uk/forum/viewtopic. ... rray#p1130
I'm hoping that with SDK v7 the tools for building DLLs etc will get a bit of love!

#### Re: Array string extraction / String Switch

Posted: Sun Dec 03, 2017 10:38 pm
by faxinadu
indeed quite annoying :0
another somewhat related question - any ideas how to add two strings (ammend a string)?
for example take "hello" from one module and add "world" from another to form "hello world"
been looking a bit at the pep files but no hint so far.

#### Re: Array string extraction / String Switch

Posted: Mon Dec 04, 2017 1:00 am
by w_ellis
Again, with a C++ DLL would be super easy, but I'm not exactly sure how you'd go about it using the raw modules in SDK. You might have to do some clever stuff with bit shifting, or conversions back and forth from arrays, but I can't see any obvious PEP or DSP modules that would help.
Perhaps Roy would have an idea, as I know he played with String stuff in the past. tgstgs would also know, but I've not seen him around for a long time.

#### Re: Array string extraction / String Switch

Posted: Mon Dec 04, 2017 1:19 am
by faxinadu
yah just to program it is very simple. hmmm ok back to thinking

#### Re: Array string extraction / String Switch

Posted: Mon Dec 04, 2017 1:22 am
by w_ellis
If I ever get any time (two very young kids and a busy job!) then I'll try to get the code that DragonSF suggested working in a DLL... perhaps that will help.
Have you invested any time in building DLL modules for Scope?

#### Re: Array string extraction / String Switch

Posted: Mon Dec 04, 2017 1:43 pm
by RA
It is possible to sent the text value of an array to one of the text fields. One of them has text as a pad/var....
use two of them next to each other sending out HELLO world would do the trick.
Is this what you meant?

dNa Text Switcher.zip
  (16.77 KiB) Downloaded 307 times

#### Re: Array string extraction / String Switch

Posted: Mon Dec 04, 2017 10:12 pm
by faxinadu
kinda, but the thing is you used two yeah? one for each value.... actually for one of the things i wanted to do this might work thanks

#### Re: Array string extraction / String Switch

Posted: Mon Dec 04, 2017 10:47 pm
by RA
Yep. Let me know if you need it open. Those arrays can be powerfull. Yes it is two, but they dont take up any dsp so you can easily use them for this kind of stuff
Cheers nate

#### Re: Array string extraction / String Switch

Posted: Mon Dec 04, 2017 10:47 pm
by faxinadu
yes thanks a bunch, i would love to have a look!

#### Re: Array string extraction / String Switch

Posted: Mon Dec 11, 2017 7:07 am
by sharc
1 - The TableTextFader.mdl from the SDK Circuit Design\Circuit Controls folder will work
2 - The Script Adder.mdl from the SDK Circuit Design\Logical\Math Operators folder does what it says on the tin

#### Re: Array string extraction / String Switch

Posted: Mon Dec 11, 2017 7:47 am
by sharc
With the Script Adder module you might want to set 'Type' to 'String', delete the panel and save a new String Adder module...

String Adder.zip
  (2.94 KiB) Downloaded 334 times

#### Re: Array string extraction / String Switch

Posted: Mon Dec 11, 2017 7:49 am
by faxinadu

> sharc wrote:With the Script Adder module you might want to set 'Type' to 'String', delete the panel and save a new String Adder module...
> String Adder.zip

doh!! nice <3

#### Re: Array string extraction / String Switch

Posted: Mon Dec 11, 2017 8:10 am
by sharc
Here's a Hex Array module I built a while back for using with the TableText fader in circuit view. I've created pads for the arrays in case you want to connect other arrays.

Hex Array.zip
  (3.51 KiB) Downloaded 321 times

If you want to switch between string arrays you can either use presets or a Routing Recorder.mdl

#### Re: Array string extraction / String Switch

Posted: Mon Dec 11, 2017 12:21 pm
by faxinadu
you just made a device possible! thank you so much

#### Re: Array string extraction / String Switch

Posted: Mon Dec 11, 2017 5:20 pm
by JoPo
Shark ! I thought you went on another world !
Glad to see you still there !

#### Re: Array string extraction / String Switch

Posted: Tue Dec 12, 2017 4:21 am
by faxinadu
oh now i see this is actually not what i wanted to do. this array module lets me look inside THIS array, but what if i have another module that has an array inside and does not have selvalue output separated from the array parameter. so i would need to take the entire array (count and value) and strip the count away to retain the value if that makes sense.

#### Re: Array string extraction / String Switch

Posted: Tue Dec 12, 2017 11:20 am
by sharc
You can copy the contents of an array from one module to another by connecting the array pads.
Here's an example of switching between two external string arrays via a button. You'll need to move the slider to see the result.

Array Switch Example.zip
  (13.2 KiB) Downloaded 344 times

#### Re: Array string extraction / String Switch

Posted: Tue Dec 12, 2017 10:44 pm
by faxinadu
yes i know you can do that and have been trying but this module i'm using gives me incompatible pads message

#### Re: Array string extraction / String Switch

Posted: Wed Dec 13, 2017 1:51 am
by DragonSF
Please define what module do you need (inputs, operation and outputs) and I'll create a dll for you:
Example:
Module=<name of the module>
AInput=<para name short>,<para name long>,<type>,<length>;<next para>;
AOutput=<para name short>,<para name long>,<type>,<length>;
type can be one of:
int =>"{ DTYPE_INT, FRAC_MIN, FRAC_MAX },"
frac=>"{ DTYPE_INT, FRAC_MIN, FRAC_MAX },"
midi=>"{ DTYPE_MIDI, 0, 0xFFFFFFFF },"
str=>"{ DTYPE_STRING, 0, 0xFFFFFFFF },"
midi array=>"{ DTYPE_MIDI, 0, 0xFFFFFFFF,xxx },"
int array=>"{ DTYPE_INT,FRAC_MIN, FRAC_MAX,xxx },"
string array=>"{ DTYPE_STRING,FRAC_MIN, FRAC_MAX,xxx },"
To concatenate 2 strings:
Module=AddString
AInput=Str1,,str,;Str2,,str,;
AOutput=Ostr,,str,;

#### Re: Array string extraction / String Switch

Posted: Wed Dec 13, 2017 6:57 am
by sharc

> faxinadu wrote: ↑Tue Dec 12, 2017 10:44 pm yes i know you can do that and have been trying but this module i'm using gives me incompatible pads message

When you check the attributes do the pad types match - ie both string array?.
The arrays normally resize to match when connected but this may not work with some modules, so it's better to resize before connecting.

#### Re: Array string extraction / String Switch

Posted: Wed Dec 13, 2017 7:06 am
by faxinadu
nice thought about the resize, will try this!