three new addons
-
woodslanding
- Member
- Posts: 1327
- Contact:
1. I've uploaded my midi channel strip so you don't have to copy and paste text from the forums.
2. I've uploaded my subpatch for disabling and visibility. I ran into a problem where patches were disabled before becoming invisible, or conversely didn't become visible because they weren't yet enabled. This patch fixes that.
3. I have moved on past mondo combo, as I've given up on my touchscreen for the time being. Time to control patch changes from a midi slider! This is my solution for that.....
Enjoy!
-eric
2. I've uploaded my subpatch for disabling and visibility. I ran into a problem where patches were disabled before becoming invisible, or conversely didn't become visible because they weren't yet enabled. This patch fixes that.
3. I have moved on past mondo combo, as I've given up on my touchscreen for the time being. Time to control patch changes from a midi slider! This is my solution for that.....
Enjoy!
-eric
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
very useful !
Olivier Sens
www.brainmodular.com
www.brainmodular.com
-
woodslanding
- Member
- Posts: 1327
- Contact:
Okay, I am periodically (about 50% of the time) getting an 'error callback' when I use the latest version of the sliderlist.
Here is the (updated and improved) patch I'm using it in:
http://sensomusic.com/forums/uploaded/P ... xample.pat
It's very inconsistent--I have a dozen of these in my wkp, and more or less half of them give the error the first time they are enabled (only one is enabled at a time) and when this happens, the page up and down buttons don't work. If I recompile them they are fine.
Any clue what could be causing this??? Can anybody spot my error? Code below.....
Thanks!
-eric
Here is the (updated and improved) patch I'm using it in:
http://sensomusic.com/forums/uploaded/P ... xample.pat
It's very inconsistent--I have a dozen of these in my wkp, and more or less half of them give the error the first time they are enabled (only one is enabled at a time) and when this happens, the page up and down buttons don't work. If I recompile them they are fine.
Any clue what could be causing this??? Can anybody spot my error? Code below.....
Thanks!
-eric
Code: Select all
/// slider list by emoon//////
/// use a slider to control a list
///
const buttonCount = 24; // 32
const itemMax = 1000; // 256
var cTextOUT : Tparameter;
var cTextIN : Tparameter;
var progIN : Tparameter;
var nextPg : Tparameter;
var prevPg : Tparameter;
var pageOUT : Tparameter;
var valueOUT : Tparameter;
var offsetOUT : Tparameter;
var items : TStringList;
var buttons : TStringList;
var commastring : String;
var page : integer;
var selection : integer;
var itemCount : integer;
var pageMax : integer;
// destroy
// initialisation : create parameters
procedure init;
var digit : string;
var i : integer;
begin
cTextIN := CreateParam('comma text',ptTextField);
SetIsOutput(cTextIN,false);
nextPg := CreateParam('next page',ptButton);
SetIsOutput(nextPg,false);
prevPg := CreateParam('prev page',ptButton);
SetIsOutput(prevPg,false);
progIN := CreateParam('prog',ptDataField);
SetIsOutput(progIN,false);
valueOUT := CreateParam('list sel',ptDataField);
SetIsInput(valueOUT,false);
cTextOUT := CreateParam('comma text',ptTextField);
SetIsInput(cTextOUT,false);
pageOUT := CreateParam('page num',ptDataField);
SetIsInput(pageOUT,false);
//offsetOUT := CreateParam('page num',ptDataField);
//SetIsInput(pageOUT,false);
items := TStringList.create;
buttons := TStringList.create;
page := 0;
selection := -1;
itemCount := 0;
pageMax := 0;
end;
procedure updateButtons;
var i : integer;
begin
buttons.clear;
setValue(pageOUT, page);
for i := 0 to (buttonCount - 1) do begin
if ((page * buttonCount) + i) > itemCount then begin
buttons.add('---');
end else begin
buttons.add(items.strings[(page * buttonCount) + i]);
end;
end;
setStringValue(cTextOUT, buttons.commatext);
end;
procedure Callback(n:integer);
var charCount : integer;
var i : integer;
var item : string;
var pos: integer;
var prog: integer;
var val : integer;
begin
// if the commaText has changed, reparse the text, and layout the buttons
if (n = cTextIN) then begin
page := 0; // reset the page number
// split the commaText
commastring := getStringValue(cTextIN);
items.CommaText := commastring;
itemCount := items.Count - 1;
pageMax := trunc(itemCount/buttonCount);
updateButtons;
end;
// we can take a prog number to set the list display....
if (n = progIN) then begin
prog := trunc(getValue(progIN));
page:= prog div buttoncount;
val := prog mod buttoncount;
setValue(valueOUT, val);
updateButtons;
end;
// if the user has paged, re-layout the buttons
if (n = nextPg) and (page < pageMax) then begin
page := page + 1;
updateButtons;
end else if (n = prevPg) and (page > 0) then begin
page := page - 1;
updateButtons;
end;
end;
// no process blocCustom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
I haven't got time for any debugging, but I suspect that the problem lies with the initialization of the page variable, If it's not >0 before the prev/next buttons are triggered, nothing will happen.
I noticed something unrelated though: You should add a Destroy procedure to get rid of the two TStringList variables and clean up the memory.
I noticed something unrelated though: You should add a Destroy procedure to get rid of the two TStringList variables and clean up the memory.
Bjørn S
-
woodslanding
- Member
- Posts: 1327
- Contact:
do I need a destroy if the object is never removed during the life of the program?
Oh well, I guess it is good form, either way--and memory IS tight for me!
But I can't understand what you mean about the page variable. Page 0 is the 1st page, so the prevPage button does nothing if it is 0, but the 'next' button should (and does--about 1/2 the time!)
Oh well, I guess it is good form, either way--and memory IS tight for me!
But I can't understand what you mean about the page variable. Page 0 is the 1st page, so the prevPage button does nothing if it is 0, but the 'next' button should (and does--about 1/2 the time!)
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
i profit of this to ask few wonders:
so in this case i didn't understood why should we destroy a stringlist and when? lets say we read an incoming list as woodslanding exemple, we could destroy on init, but it will be reupdated as soon as listchanges and by the way it will use same memry amount than if was not destroyed no? or do ya mean once textout have been updated can clear to same memory?mmmm
i was thinking it was more usefull when we add/insert and need to reset it before..but so i could avoid 2x ram use, cause of one use for all textout and one for internal Tstringlist that's it?
Also I tried to deal with StringArrays instead of stringlist, (to try indexing XY receiving 0sc). is it more recommended to use Tstringlists, or is it that stringlist have more functions like search/insert ect, or is it just because using commatext and should I
clear the array seting size to 0 when no future uses?(in my case i suppose no as i reuse to scroll) lot's of questions
i suspect i also get some ram problems via my non correct uses of scripts, not only using stinglist, any overall advices relating ram gestion with script master bsork? ie when values are only 0 or 1 we should better use boolean or byte than integer, use integer rather than floats when possible, does it make a big difference at the end, mmm probably..
so in this case i didn't understood why should we destroy a stringlist and when? lets say we read an incoming list as woodslanding exemple, we could destroy on init, but it will be reupdated as soon as listchanges and by the way it will use same memry amount than if was not destroyed no? or do ya mean once textout have been updated can clear to same memory?mmmm
i was thinking it was more usefull when we add/insert and need to reset it before..but so i could avoid 2x ram use, cause of one use for all textout and one for internal Tstringlist that's it?
Also I tried to deal with StringArrays instead of stringlist, (to try indexing XY receiving 0sc). is it more recommended to use Tstringlists, or is it that stringlist have more functions like search/insert ect, or is it just because using commatext and should I
clear the array seting size to 0 when no future uses?(in my case i suppose no as i reuse to scroll) lot's of questions
i suspect i also get some ram problems via my non correct uses of scripts, not only using stinglist, any overall advices relating ram gestion with script master bsork? ie when values are only 0 or 1 we should better use boolean or byte than integer, use integer rather than floats when possible, does it make a big difference at the end, mmm probably..
That's what I meant: If page=0 then nothing will happen. Try adding itrace(page) in the Callback to check the value. I'm not saying this is the cause, but it's possible.
About the Destroy, I think the objects are located on the heap and that memory should be released when the script is dropped one way or another.. I haven't got the faintest clue if there's a garbage collection going on if you don't add the destroy, but I suspect not.
About the Destroy, I think the objects are located on the heap and that memory should be released when the script is dropped one way or another.. I haven't got the faintest clue if there's a garbage collection going on if you don't add the destroy, but I suspect not.
Bjørn S
Hi 23fx23, you posted while I was answering woodslanding.
I can't answer all your questions, as I don't know much about what's going on "under the hood". Olivier is the one with all the knowledge, but as I write in my previous post, objects like stringlists should be destroyed when no longer needed. Of course you can create them and destroy them when there no longer needed even if the script is running, but I don't think you gain much from that - you only use some more CPU while allocating and releasing memory. Whether arrays of strings or stringlists are "better", I don't know, but if you reuse an object it should use the same amount of memory (if the input is the same size, of course), probably starting at the same memory address. (Jeez, this is really not my turf...
)
Unless you keep very large data structures within your scripts, I don't think the data types it matter much. Of course, a byte is one quarter the size of an integer, but compare the sizes a typical script array with the WAV files loaded in your samplers, and they're neglible. However, I do think it's good programming practice to use the smaller sizes whenever possible, and I'm a big fan of booleans. Not because of RAM usage, more bacasue it's (mostly) CPU efficient, and makes for easily readable scripts. A typical example would be some switch input parameter whose value is referenced several places within a script. Instead of using a lot of GetValues or put the value into an integer or single with checks like "IF (switchValue = 1) THEN" or similar, just set the boolean in Callback and write something like "IF switchedOn THEN".
I can't answer all your questions, as I don't know much about what's going on "under the hood". Olivier is the one with all the knowledge, but as I write in my previous post, objects like stringlists should be destroyed when no longer needed. Of course you can create them and destroy them when there no longer needed even if the script is running, but I don't think you gain much from that - you only use some more CPU while allocating and releasing memory. Whether arrays of strings or stringlists are "better", I don't know, but if you reuse an object it should use the same amount of memory (if the input is the same size, of course), probably starting at the same memory address. (Jeez, this is really not my turf...
Unless you keep very large data structures within your scripts, I don't think the data types it matter much. Of course, a byte is one quarter the size of an integer, but compare the sizes a typical script array with the WAV files loaded in your samplers, and they're neglible. However, I do think it's good programming practice to use the smaller sizes whenever possible, and I'm a big fan of booleans. Not because of RAM usage, more bacasue it's (mostly) CPU efficient, and makes for easily readable scripts. A typical example would be some switch input parameter whose value is referenced several places within a script. Instead of using a lot of GetValues or put the value into an integer or single with checks like "IF (switchValue = 1) THEN" or similar, just set the boolean in Callback and write something like "IF switchedOn THEN".
Bjørn S
-
woodslanding
- Member
- Posts: 1327
- Contact:
but I don't WANT prevPage to do anything when I'm already on page 0!! But is there a reason 'pageNext' won't work when there is more than one page?
--It always works after a recompile, just not always after the host patch is re-enabled.
I'll put in the trace and see what happens..... but why would usine give an error? And why only 1/2 the time?
BTW: what other objects need to be destroyed?? Is there a list somewhere? Strings don't need to, right? And tparameters don't need to??
thanks!!!!
-e
--It always works after a recompile, just not always after the host patch is re-enabled.
I'll put in the trace and see what happens..... but why would usine give an error? And why only 1/2 the time?
BTW: what other objects need to be destroyed?? Is there a list somewhere? Strings don't need to, right? And tparameters don't need to??
thanks!!!!
-e
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Hope I'm not misguiding you with my theory about the page variable, but if it is 0, nextPg will do just as much a prevPg; ie nothing. Or have I misunderstood you: Does Usine report some error when the page buttons don't work?
As far as I have understood, you only need to destroy object variables (of which stringlists are the most obvious example within scripts). In other words, if you do a variableName.Create, you should also clean it up. I'm not very well versed in the OO side of Delphi so when checking various documentation while writing this, I'm actually not sure what the correct command is for "destroying" an object and get totally rid of it. I think I've used it in some old scripts, but I don't remember what it was. Will have to get back to you on that...
[Edit:] Seems like the FreeAndNil procedure is the universal destructor in Delphi.
As far as I have understood, you only need to destroy object variables (of which stringlists are the most obvious example within scripts). In other words, if you do a variableName.Create, you should also clean it up. I'm not very well versed in the OO side of Delphi so when checking various documentation while writing this, I'm actually not sure what the correct command is for "destroying" an object and get totally rid of it. I think I've used it in some old scripts, but I don't remember what it was. Will have to get back to you on that...
[Edit:] Seems like the FreeAndNil procedure is the universal destructor in Delphi.
Bjørn S
-
woodslanding
- Member
- Posts: 1327
- Contact:
so this line:
will not work in some circumstances if page = 0, even if pageMax is > 0?? I'm still not understanding why, this would happen. And typically it does not.
I am getting an error message: 'error callback' when the enclosing patch is enabled for the first time. I recompile and it works again.
Could it be a problem with the patch being disabled on startup?
Code: Select all
// if the user has paged, re-layout the buttons
if (n = nextPg) and (page < pageMax) then begin
page := page + 1;I am getting an error message: 'error callback' when the enclosing patch is enabled for the first time. I recompile and it works again.
Could it be a problem with the patch being disabled on startup?
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
...oops! Sorry, but I've mixed up your variable names. pageMax is the one I should've been referring to, of course. No wonder you didn't understand me. Your Callback procedure looks fine to me.
Mea culpa...
If this only happens when the patch is initially disabled, that must surely be the reason. Why it would happen, I don't know. Olivier would have to chime in on the matter.
Just a wild guess, but what if you put a WaitOne or two before progIN and cTextIN so the script can be initialized fully before new input arrives?
Mea culpa...
If this only happens when the patch is initially disabled, that must surely be the reason. Why it would happen, I don't know. Olivier would have to chime in on the matter.
Just a wild guess, but what if you put a WaitOne or two before progIN and cTextIN so the script can be initialized fully before new input arrives?
Bjørn S
thanks master bsork for your always apprecied advices, im gonna try the boolean thing where i can convert. thats what i thought,
i was worried about dealing ie a 64x128 string array but it must be nothing compared to wav as you point, at least my first 16x128
test seem to work like a charm without spikes.
i was worried about dealing ie a 64x128 string array but it must be nothing compared to wav as you point, at least my first 16x128
test seem to work like a charm without spikes.
Who is online
Users browsing this forum: No registered users and 11 guests
