ArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2011-03-12T03:56:37+02:00 https://brainmodular.com/forums/app.php/feed/topic/2756 2011-03-12T03:56:37+02:00 2011-03-12T03:56:37+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18608#p18608 <![CDATA[Storing and recalling preset according to list text]]> Statistics: Posted by gthibert — 12 Mar 2011, 02:56


]]>
2011-03-06T21:54:25+02:00 2011-03-06T21:54:25+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18511#p18511 <![CDATA[Storing and recalling preset according to list text]]>
Maybe it's a bug...

Statistics: Posted by gthibert — 06 Mar 2011, 20:54


]]>
2011-03-06T04:16:05+02:00 2011-03-06T04:16:05+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18482#p18482 <![CDATA[Storing and recalling preset according to list text]]> Statistics: Posted by gthibert — 06 Mar 2011, 03:16


]]>
2011-03-06T03:11:30+02:00 2011-03-06T03:11:30+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18481#p18481 <![CDATA[Storing and recalling preset according to list text]]>
i just don't understand why there is 2 times the check, couldn't it be only once?

if presetIndex = -1 then begin
presetIndex := presetsList.indexOf('free');
if presetIndex = -1 then begin

edit: oh, i had just copied the script, didn't saw the patch link. will check with the comma text

Statistics: Posted by 23fx23 — 06 Mar 2011, 02:11


]]>
2011-03-06T03:01:53+02:00 2011-03-06T03:01:53+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18480#p18480 <![CDATA[Storing and recalling preset according to list text]]>
But do you think the script in efficient ? Is there a better solution ?

Statistics: Posted by gthibert — 06 Mar 2011, 02:01


]]>
2011-03-06T02:46:57+02:00 2011-03-06T02:46:57+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18478#p18478 <![CDATA[Storing and recalling preset according to list text]]>
don't find something wrong. maybe try to display the pttexfield as output used to store and look if the commatext is full and correct..

Statistics: Posted by 23fx23 — 06 Mar 2011, 01:46


]]>
2011-03-06T02:36:29+02:00 2011-03-06T02:36:29+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18477#p18477 <![CDATA[Storing and recalling preset according to list text]]> Statistics: Posted by gthibert — 06 Mar 2011, 01:36


]]>
2011-03-05T10:47:19+02:00 2011-03-05T10:47:19+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18442#p18442 <![CDATA[Storing and recalling preset according to list text]]>
I've got a problem with a patch and I need help. I can't figure out where's the problem.

I built a patch that allows me to store and recall presets according to a selected item in a list. This is not simply based on the list index, but on the text itself. The idea is to be able to change the order of items in the list and keep the preset associated. My goal is to store in a preset all the parameters linked to a sample in the sampler file list.

My patch is based on a script. I tryed several things, but the easiest and most effective way I've found is by using comma separated text and TStringList. If someone have a better idea...

In facts, my patch works A1... as long as I don't save and reload the workspace. Then, the script only recalls the first 8-10 elements saved in the comma text list. And I can't figure out why...maybe it's simply a Usine bug. Maybe the comma text I try to save is too long for a ptTextfield.

So, I've prepared an exemple patch :

preset_manager.pat

And here is the script :

CODE:

//////////////////////////// /////////////////////////// parameters declarationvar inPresetName&#58; Tparameter;var inStore&#58; Tparameter;var inRecall&#58; Tparameter;var inCleanup&#58; Tparameter;var inClear&#58; Tparameter;var inCommaList&#58; Tparameter;var presetsComma &#58; Tparameter;var filesList&#58; TStringList;var presetsList &#58; TStringList;// initialisation &#58; create parametersprocedure init;begin  inPresetName &#58;= CreateParam&#40;'preset name',ptTextfield&#41;; SetIsOutPut&#40;inPresetName,false&#41;;inCommaList &#58;= CreateParam&#40;'comma text',ptTextfield&#41;; SetIsOutPut&#40;inCommaList,false&#41;;presetsComma &#58;= CreateParam&#40;'preset comma',ptTextfield&#41;; SetIsOutPut&#40;presetsComma,false&#41;;SetIsInput&#40;presetsComma,false&#41;;SetDontSave&#40;presetsComma, false&#41;;inStore &#58;= CreateParam&#40;'store',ptButton&#41;; SetIsOutPut&#40;inStore,false&#41;;inRecall &#58;= CreateParam&#40;'recall',ptButton&#41;; SetIsOutPut&#40;inRecall,false&#41;;inCleanup &#58;= CreateParam&#40;'cleanup',ptButton&#41;; SetIsOutPut&#40;inCleanup,false&#41;;inClear &#58;= CreateParam&#40;'clear',ptButton&#41;; SetIsOutPut&#40;inClear,false&#41;;filesList &#58;= tStringList.create;presetsList &#58;= tStringList.create;presetsList.capacity &#58;= 64;end;Procedure savePresets&#40;&#41;;beginsetStringValue&#40;presetsComma, presetsList.commatext&#41;;end;Procedure clearPresets&#40;&#41;;var x&#58;Integer;beginstrace&#40;'Clearing presetsList'&#41;;presetsList.clear;for x &#58;= 0 to 63 do beginpresetsList.add&#40;'free'&#41;;end;savePresets&#40;&#41;;end;Procedure loadPresets;var x&#58;Integer;beginstrace&#40;'Loading presetsList.'&#41;;presetsList.commatext &#58;= getStringValue&#40;presetsComma&#41;;if presetsList.count = 0 then clearPresets&#40;&#41;;end;Procedure cleanupPresets&#40;&#41;;var x&#58;Integer;beginstrace&#40;'Clean up'&#41;;filesList.commatext &#58;= getStringValue&#40;inCommaList&#41;;for x &#58;= 0 to presetsList.count do beginif filesList.indexOf&#40;presetsList&#91;x&#93;&#41; = -1 then beginpresetsList&#91;x&#93; &#58;= 'free';end;end;end;Procedure recallPreset&#40;presetIndex&#58;Integer&#41;;var pmName&#58;String;var pmNum&#58;String;beginpmName&#58;= 'Preset' + intToStr&#40;presetIndex div 16 + 1&#41;;pmNum &#58;= intToStr&#40;presetIndex mod 16&#41;;SendInternalMsg&#40;'SET_TARGET_PATCH','SENDER_PATCH'&#41;;SendInternalMsg&#40;'SET_VALUE', pmName, 'num', pmNum&#41;;end;Procedure storePreset&#40;presetIndex&#58;Integer&#41;;var pmName&#58;String;var pmNum&#58;String;beginpmName&#58;= 'Preset' + intToStr&#40;presetIndex div 16 + 1&#41;;pmNum &#58;= intToStr&#40;presetIndex mod 16&#41;;SendInternalMsg&#40;'SET_TARGET_PATCH','SENDER_PATCH'&#41;;SendInternalMsg&#40;'SET_VALUE', pmName, 'store', '1'&#41;;SendInternalMsg&#40;'SET_VALUE', pmName, 'num', pmNum&#41;;end;Procedure Callback&#40;N&#58;integer&#41;; var x&#58;integer;var pmName&#58;String;var pmNum&#58;String;var presetIndex&#58;integer;begin// Storeif &#40;n=inStore&#41; and &#40;getValue&#40;inStore&#41;=1&#41; then beginif presetsList.count = 0 then loadPresets&#40;&#41;;presetIndex &#58;= presetsList.indexOf&#40;getStringValue&#40;inPresetName&#41;&#41;;if presetIndex = -1 then begin presetIndex &#58;= presetsList.indexOf&#40;'free'&#41;;if presetIndex = -1 then begincleanupPresets&#40;&#41;;presetIndex &#58;= presetsList.indexOf&#40;'free'&#41;;end;presetsList&#91;presetIndex&#93; &#58;= getStringValue&#40;inPresetName&#41;;end;storePreset&#40;presetIndex&#41;;savePresets&#40;&#41;;end;// Recallif &#40;n=inRecall&#41; and &#40;getValue&#40;inRecall&#41; = 1&#41; then beginif presetsList.count = 0 then loadPresets&#40;&#41;;presetIndex &#58;= presetsList.indexOf&#40;getStringValue&#40;inPresetName&#41;&#41;;if presetIndex <> -1 then begin strace&#40;'Recalling'&#41;;recallPreset&#40;presetIndex&#41;;end;end;// Clearif &#40;n=inClear&#41; and &#40;getValue&#40;inClear&#41;=1&#41; then beginstrace&#40;'Clear'&#41;;clearPresets&#40;&#41;;end;// Cleanupif &#40;&#40;n=inCleanUp&#41; and &#40;getValue&#40;inCleanUp&#41;=1&#41;&#41; then begincleanupPresets&#40;&#41;;end;end;//////////////////////////////// main proc//////////////////////////////Procedure Process;beginend;

Statistics: Posted by gthibert — 05 Mar 2011, 09:47


]]>
BrainModular BrainModular Users Forum 2011-03-12T03:56:37+02:00 https://brainmodular.com/forums/app.php/feed/topic/2756 2011-03-12T03:56:37+02:00 2011-03-12T03:56:37+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18608#p18608 <![CDATA[Storing and recalling preset according to list text]]> Statistics: Posted by gthibert — 12 Mar 2011, 02:56


]]>
2011-03-06T21:54:25+02:00 2011-03-06T21:54:25+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18511#p18511 <![CDATA[Storing and recalling preset according to list text]]>
Maybe it's a bug...

Statistics: Posted by gthibert — 06 Mar 2011, 20:54


]]>
2011-03-06T04:16:05+02:00 2011-03-06T04:16:05+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18482#p18482 <![CDATA[Storing and recalling preset according to list text]]> Statistics: Posted by gthibert — 06 Mar 2011, 03:16


]]>
2011-03-06T03:11:30+02:00 2011-03-06T03:11:30+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18481#p18481 <![CDATA[Storing and recalling preset according to list text]]>
i just don't understand why there is 2 times the check, couldn't it be only once?

if presetIndex = -1 then begin
presetIndex := presetsList.indexOf('free');
if presetIndex = -1 then begin

edit: oh, i had just copied the script, didn't saw the patch link. will check with the comma text

Statistics: Posted by 23fx23 — 06 Mar 2011, 02:11


]]>
2011-03-06T03:01:53+02:00 2011-03-06T03:01:53+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18480#p18480 <![CDATA[Storing and recalling preset according to list text]]>
But do you think the script in efficient ? Is there a better solution ?

Statistics: Posted by gthibert — 06 Mar 2011, 02:01


]]>
2011-03-06T02:46:57+02:00 2011-03-06T02:46:57+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18478#p18478 <![CDATA[Storing and recalling preset according to list text]]>
don't find something wrong. maybe try to display the pttexfield as output used to store and look if the commatext is full and correct..

Statistics: Posted by 23fx23 — 06 Mar 2011, 01:46


]]>
2011-03-06T02:36:29+02:00 2011-03-06T02:36:29+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18477#p18477 <![CDATA[Storing and recalling preset according to list text]]> Statistics: Posted by gthibert — 06 Mar 2011, 01:36


]]>
2011-03-05T10:47:19+02:00 2011-03-05T10:47:19+02:00 https://brainmodular.com/forums/viewtopic.php?t=2756&p=18442#p18442 <![CDATA[Storing and recalling preset according to list text]]>
I've got a problem with a patch and I need help. I can't figure out where's the problem.

I built a patch that allows me to store and recall presets according to a selected item in a list. This is not simply based on the list index, but on the text itself. The idea is to be able to change the order of items in the list and keep the preset associated. My goal is to store in a preset all the parameters linked to a sample in the sampler file list.

My patch is based on a script. I tryed several things, but the easiest and most effective way I've found is by using comma separated text and TStringList. If someone have a better idea...

In facts, my patch works A1... as long as I don't save and reload the workspace. Then, the script only recalls the first 8-10 elements saved in the comma text list. And I can't figure out why...maybe it's simply a Usine bug. Maybe the comma text I try to save is too long for a ptTextfield.

So, I've prepared an exemple patch :

preset_manager.pat

And here is the script :

CODE:

//////////////////////////// /////////////////////////// parameters declarationvar inPresetName&#58; Tparameter;var inStore&#58; Tparameter;var inRecall&#58; Tparameter;var inCleanup&#58; Tparameter;var inClear&#58; Tparameter;var inCommaList&#58; Tparameter;var presetsComma &#58; Tparameter;var filesList&#58; TStringList;var presetsList &#58; TStringList;// initialisation &#58; create parametersprocedure init;begin  inPresetName &#58;= CreateParam&#40;'preset name',ptTextfield&#41;; SetIsOutPut&#40;inPresetName,false&#41;;inCommaList &#58;= CreateParam&#40;'comma text',ptTextfield&#41;; SetIsOutPut&#40;inCommaList,false&#41;;presetsComma &#58;= CreateParam&#40;'preset comma',ptTextfield&#41;; SetIsOutPut&#40;presetsComma,false&#41;;SetIsInput&#40;presetsComma,false&#41;;SetDontSave&#40;presetsComma, false&#41;;inStore &#58;= CreateParam&#40;'store',ptButton&#41;; SetIsOutPut&#40;inStore,false&#41;;inRecall &#58;= CreateParam&#40;'recall',ptButton&#41;; SetIsOutPut&#40;inRecall,false&#41;;inCleanup &#58;= CreateParam&#40;'cleanup',ptButton&#41;; SetIsOutPut&#40;inCleanup,false&#41;;inClear &#58;= CreateParam&#40;'clear',ptButton&#41;; SetIsOutPut&#40;inClear,false&#41;;filesList &#58;= tStringList.create;presetsList &#58;= tStringList.create;presetsList.capacity &#58;= 64;end;Procedure savePresets&#40;&#41;;beginsetStringValue&#40;presetsComma, presetsList.commatext&#41;;end;Procedure clearPresets&#40;&#41;;var x&#58;Integer;beginstrace&#40;'Clearing presetsList'&#41;;presetsList.clear;for x &#58;= 0 to 63 do beginpresetsList.add&#40;'free'&#41;;end;savePresets&#40;&#41;;end;Procedure loadPresets;var x&#58;Integer;beginstrace&#40;'Loading presetsList.'&#41;;presetsList.commatext &#58;= getStringValue&#40;presetsComma&#41;;if presetsList.count = 0 then clearPresets&#40;&#41;;end;Procedure cleanupPresets&#40;&#41;;var x&#58;Integer;beginstrace&#40;'Clean up'&#41;;filesList.commatext &#58;= getStringValue&#40;inCommaList&#41;;for x &#58;= 0 to presetsList.count do beginif filesList.indexOf&#40;presetsList&#91;x&#93;&#41; = -1 then beginpresetsList&#91;x&#93; &#58;= 'free';end;end;end;Procedure recallPreset&#40;presetIndex&#58;Integer&#41;;var pmName&#58;String;var pmNum&#58;String;beginpmName&#58;= 'Preset' + intToStr&#40;presetIndex div 16 + 1&#41;;pmNum &#58;= intToStr&#40;presetIndex mod 16&#41;;SendInternalMsg&#40;'SET_TARGET_PATCH','SENDER_PATCH'&#41;;SendInternalMsg&#40;'SET_VALUE', pmName, 'num', pmNum&#41;;end;Procedure storePreset&#40;presetIndex&#58;Integer&#41;;var pmName&#58;String;var pmNum&#58;String;beginpmName&#58;= 'Preset' + intToStr&#40;presetIndex div 16 + 1&#41;;pmNum &#58;= intToStr&#40;presetIndex mod 16&#41;;SendInternalMsg&#40;'SET_TARGET_PATCH','SENDER_PATCH'&#41;;SendInternalMsg&#40;'SET_VALUE', pmName, 'store', '1'&#41;;SendInternalMsg&#40;'SET_VALUE', pmName, 'num', pmNum&#41;;end;Procedure Callback&#40;N&#58;integer&#41;; var x&#58;integer;var pmName&#58;String;var pmNum&#58;String;var presetIndex&#58;integer;begin// Storeif &#40;n=inStore&#41; and &#40;getValue&#40;inStore&#41;=1&#41; then beginif presetsList.count = 0 then loadPresets&#40;&#41;;presetIndex &#58;= presetsList.indexOf&#40;getStringValue&#40;inPresetName&#41;&#41;;if presetIndex = -1 then begin presetIndex &#58;= presetsList.indexOf&#40;'free'&#41;;if presetIndex = -1 then begincleanupPresets&#40;&#41;;presetIndex &#58;= presetsList.indexOf&#40;'free'&#41;;end;presetsList&#91;presetIndex&#93; &#58;= getStringValue&#40;inPresetName&#41;;end;storePreset&#40;presetIndex&#41;;savePresets&#40;&#41;;end;// Recallif &#40;n=inRecall&#41; and &#40;getValue&#40;inRecall&#41; = 1&#41; then beginif presetsList.count = 0 then loadPresets&#40;&#41;;presetIndex &#58;= presetsList.indexOf&#40;getStringValue&#40;inPresetName&#41;&#41;;if presetIndex <> -1 then begin strace&#40;'Recalling'&#41;;recallPreset&#40;presetIndex&#41;;end;end;// Clearif &#40;n=inClear&#41; and &#40;getValue&#40;inClear&#41;=1&#41; then beginstrace&#40;'Clear'&#41;;clearPresets&#40;&#41;;end;// Cleanupif &#40;&#40;n=inCleanUp&#41; and &#40;getValue&#40;inCleanUp&#41;=1&#41;&#41; then begincleanupPresets&#40;&#41;;end;end;//////////////////////////////// main proc//////////////////////////////Procedure Process;beginend;

Statistics: Posted by gthibert — 05 Mar 2011, 09:47


]]>