Array string extraction / String Switch

A place for developers to share ideas and assist each other in solving problems.
User avatar
faxinadu
Posts: 1215
Joined: Wed Nov 01, 2006 3:12 am
Location: israel
Contact:

Array string extraction / String Switch

Post by faxinadu » Fri Dec 01, 2017 7:42 am

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?

w_ellis
Posts: 425
Joined: Wed Nov 07, 2001 4:00 pm
Location: London, U.K.

Re: Array string extraction / String Switch

Post by w_ellis » Sat Dec 02, 2017 8:43 am

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!

User avatar
faxinadu
Posts: 1215
Joined: Wed Nov 01, 2006 3:12 am
Location: israel
Contact:

Re: Array string extraction / String Switch

Post by faxinadu » Sun Dec 03, 2017 10:38 pm

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.

w_ellis
Posts: 425
Joined: Wed Nov 07, 2001 4:00 pm
Location: London, U.K.

Re: Array string extraction / String Switch

Post by w_ellis » Mon Dec 04, 2017 1:00 am

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.

User avatar
faxinadu
Posts: 1215
Joined: Wed Nov 01, 2006 3:12 am
Location: israel
Contact:

Re: Array string extraction / String Switch

Post by faxinadu » Mon Dec 04, 2017 1:19 am

yah just to program it is very simple. hmmm ok back to thinking :)

w_ellis
Posts: 425
Joined: Wed Nov 07, 2001 4:00 pm
Location: London, U.K.

Re: Array string extraction / String Switch

Post by w_ellis » Mon Dec 04, 2017 1:22 am

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?

User avatar
RA
Posts: 305
Joined: Fri Aug 18, 2006 4:00 pm
Contact:

Re: Array string extraction / String Switch

Post by RA » Mon Dec 04, 2017 1:43 pm

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 14 times
- We're freaks about gearz and methods -
More on dNa: http://dnamusic.nl

User avatar
faxinadu
Posts: 1215
Joined: Wed Nov 01, 2006 3:12 am
Location: israel
Contact:

Re: Array string extraction / String Switch

Post by faxinadu » Mon Dec 04, 2017 10:12 pm

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 :)

User avatar
RA
Posts: 305
Joined: Fri Aug 18, 2006 4:00 pm
Contact:

Re: Array string extraction / String Switch

Post by RA » Mon Dec 04, 2017 10:47 pm

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
- We're freaks about gearz and methods -
More on dNa: http://dnamusic.nl

User avatar
faxinadu
Posts: 1215
Joined: Wed Nov 01, 2006 3:12 am
Location: israel
Contact:

Re: Array string extraction / String Switch

Post by faxinadu » Mon Dec 04, 2017 10:47 pm

yes thanks a bunch, i would love to have a look!

User avatar
sharc
Posts: 638
Joined: Mon Oct 29, 2001 4:00 pm
Location: No idea. All looks the same down here

Re: Array string extraction / String Switch

Post by sharc » Mon Dec 11, 2017 7:07 am

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

User avatar
sharc
Posts: 638
Joined: Mon Oct 29, 2001 4:00 pm
Location: No idea. All looks the same down here

Re: Array string extraction / String Switch

Post by sharc » Mon Dec 11, 2017 7:47 am

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 11 times

User avatar
faxinadu
Posts: 1215
Joined: Wed Nov 01, 2006 3:12 am
Location: israel
Contact:

Re: Array string extraction / String Switch

Post by faxinadu » Mon Dec 11, 2017 7:49 am

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!! :D nice <3

User avatar
sharc
Posts: 638
Joined: Mon Oct 29, 2001 4:00 pm
Location: No idea. All looks the same down here

Re: Array string extraction / String Switch

Post by sharc » Mon Dec 11, 2017 8:10 am

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 11 times
If you want to switch between string arrays you can either use presets or a Routing Recorder.mdl

User avatar
faxinadu
Posts: 1215
Joined: Wed Nov 01, 2006 3:12 am
Location: israel
Contact:

Re: Array string extraction / String Switch

Post by faxinadu » Mon Dec 11, 2017 12:21 pm

you just made a device possible! thank you so much :)

User avatar
JoPo
Posts: 1903
Joined: Wed Jun 05, 2002 4:00 pm
Location: VRRAAaaooOôOooommmh
Contact:

Re: Array string extraction / String Switch

Post by JoPo » Mon Dec 11, 2017 5:20 pm

Shark ! I thought you went on another world !

Glad to see you still there ! :)
> > > > > > > > > > > > --- Musica --> here ! ---< < < < < < < < < < < <

User avatar
faxinadu
Posts: 1215
Joined: Wed Nov 01, 2006 3:12 am
Location: israel
Contact:

Re: Array string extraction / String Switch

Post by faxinadu » Tue Dec 12, 2017 4:21 am

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.

User avatar
sharc
Posts: 638
Joined: Mon Oct 29, 2001 4:00 pm
Location: No idea. All looks the same down here

Re: Array string extraction / String Switch

Post by sharc » Tue Dec 12, 2017 11:20 am

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 3 times

User avatar
faxinadu
Posts: 1215
Joined: Wed Nov 01, 2006 3:12 am
Location: israel
Contact:

Re: Array string extraction / String Switch

Post by faxinadu » 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

DragonSF
Posts: 251
Joined: Sun Nov 08, 2015 4:28 pm

Re: Array string extraction / String Switch

Post by DragonSF » Wed Dec 13, 2017 1:51 am

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,;

Post Reply