save multiline text in preset

For general discussion related FlowStone
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: save multiline text in preset

Post by tulamide »

adamszabo wrote:The easiest and most simplest solution is to convert your multiline string to hexadecimal then convert it back. The problem is that the string preset only holds 255 (i think) characters and you can only write a small description, but it does the job

That's a cool idea! Also, it stays within the VST definitions. And yes, as I said earlier in another post, there still is the 255 char limit. You have to take care of it, or else the text will be cut.
"There lies the dog buried" (German saying translated literally)
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: save multiline text in preset

Post by Spogg »

adamszabo wrote:The easiest and most simplest solution is to convert your multiline string to hexadecimal then convert it back. The problem is that the string preset only holds 255 (i think) characters and you can only write a small description, but it does the job


Excellent Adam! Straight into my toolbox.

Simple and effective solution and using none of that magic Ruby stuff! ;)

255 characters should be sufficient for notes and bits of help text I would say.

Thanks for sharing!

Spogg
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: save multiline text in preset

Post by RJHollins »

Thanks Adam .... works nice !
8-)
FlowStoner
Posts: 24
Joined: Tue Aug 01, 2017 2:03 pm

Re: save multiline text in preset

Post by FlowStoner »

Base64 encoding

Code: Select all

str = ["\x31"*186].pack('m')
watch 'str', s = str.unpack('m').first
watch 'size', [str.size, s.size]


you can store max 186 char ascii, included special control.
User avatar
gvalletto
Posts: 117
Joined: Fri Jul 09, 2010 10:15 pm
Location: Argentina
Contact:

Re: save multiline text in preset

Post by gvalletto »

Thaks Adam! great work with simple resources.

I attempted to double the number of characters in this new attached scheme.
This scheme stores the text in 2 presets, since 500 characters it is enough for my needs.
There´s 2 box. The idea is to accommodate them graphically so they look like a single box.
If you type in the upper box, when it reaches 255 characters, the cursor will automatically switch to the box below. This system works fine, but if after writing in the box below I click on the upper one, it allows me to write more than 255 characters (obviously them will be not saved correctly). I have tried several things to limit text input to a maximum of 255 characters but I have not succeeded. any idea?
Attachments
text in 2 presets.fsm
(29 KiB) Downloaded 997 times
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: save multiline text in preset

Post by tulamide »

Had just a quick look, since I'm on something else currently, but the issue is the bool to trigger prim. This fires one trigger only when the boolean changes to true. Since on re-entering the boolean still is true, no trigger is sent this time. You might want to find a way to "reset" the comparison prim to false on leave (which is what I will also try later), so that the prim can send a trigger again on re-entering.
"There lies the dog buried" (German saying translated literally)
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: save multiline text in preset

Post by adamszabo »

Also, right now you are counting the actual strings before they get converted into hex and thats not accurate. You need to put the length after the String to Hex, because thats the actual values that go into the preset text.
User avatar
gvalletto
Posts: 117
Joined: Fri Jul 09, 2010 10:15 pm
Location: Argentina
Contact:

Re: save multiline text in preset

Post by gvalletto »

adamszabo wrote:Also, right now you are counting the actual strings before they get converted into hex and thats not accurate. You need to put the length after the String to Hex, because thats the actual values that go into the preset text.

Please see this image. There is the reason by which I connected the counter before the conversion: I prefer to see the real quantity of chars.
In addition, although 255 characters of text mean 510 characters in hexadecimal, the presets work fine, which caught my attention ...
Attachments
snap.jpg
snap.jpg (20.57 KiB) Viewed 27115 times
Youlean
Posts: 176
Joined: Mon Jun 09, 2014 2:49 pm

Re: save multiline text in preset

Post by Youlean »

tulamide wrote:
Youlean wrote:Can you save array in preset? (Haven't used a Flowstone for a while). If so, just cast every char to int and save is as int array...
That also is not a solution. While you can indeed save an array in a preset, it again is limited. This time to a single precision float and only in the range 0-1. So, even if you'd convert the ints to floats in that range, due to the imprecise single precision floats it would come to decryption errors.

Not true. You only need to store 256 different values in range 0-1 which is enough precise for float.
User avatar
gvalletto
Posts: 117
Joined: Fri Jul 09, 2010 10:15 pm
Location: Argentina
Contact:

Re: save multiline text in preset

Post by gvalletto »

FlowStoner wrote:Base64 encoding

Code: Select all

str = ["\x31"*186].pack('m')
watch 'str', s = str.unpack('m').first
watch 'size', [str.size, s.size]


you can store max 186 char ascii, included special control.


Hi Flowstoner, excuse my ignorance, can You explain about that? I just use Flowstone DSP code...
Post Reply