Bonjour .
J'aimerais savoir si il est possible de créer un script ou un patch ou une procédure
qui permet de saisir des valeurs dans un tableau à partir d'une syntaxe comme
1+23+24
ou 1>24 ( par exemple pour sélectionner 24 valeurs d'un coup)
est il également possible de pouvoir saisir cette valeur directement à partir du module keyb
plutôt que d'avoir à double cliquer sur dans une fenêtre ?
Merci .
JF
saisie valeurs au clavier
- oli_lab
- Member
- Posts: 1286
- Location: Brittany, France
- Contact:
C possible,
il faudra définir une syntaxe plus précisément :
pense à une machine à calculer :
il faut que certaines touches délimitent ce qui correspond à l'opérande de ce qui correspond à l'opérateur
par exemple tant que tu tapes des caractères correspondant aux chiffres, ils s'empilent dans un registre (le précédent se multiplie par 10 et s’additionne au chiffre courant)
l'appuie sur + rend le nombre positif, - négatif, et additionne le nombre courant avec le résultat précédent et remet à 0 le registre d'entrée
= fait apparaitre le résultat final
il faudra aussi trier les touches (de 0 à 9, +,-,=....)
un script semble le bon candidat
bon courage
Olivar
il faudra définir une syntaxe plus précisément :
pense à une machine à calculer :
il faut que certaines touches délimitent ce qui correspond à l'opérande de ce qui correspond à l'opérateur
par exemple tant que tu tapes des caractères correspondant aux chiffres, ils s'empilent dans un registre (le précédent se multiplie par 10 et s’additionne au chiffre courant)
l'appuie sur + rend le nombre positif, - négatif, et additionne le nombre courant avec le résultat précédent et remet à 0 le registre d'entrée
= fait apparaitre le résultat final
il faudra aussi trier les touches (de 0 à 9, +,-,=....)
un script semble le bon candidat
bon courage
Olivar
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
- oli_lab
- Member
- Posts: 1286
- Location: Brittany, France
- Contact:
c'est un bon début :
//////////////////////////
//une calculette
//entrer nombre puis appui sur touche +
//appui sur touche enter remet à 0
/////////////////////////
var key, pressed: Tparameter;
var result: Tparameter;
var inval, outval : integer;
//////////////////////////////////////
// Init is started on script compilation to create the in/outs
PROCEDURE INIT;
BEGIN
key:= CreateParam('key',PtDataField,pioInput);
pressed:= CreateParam('pressed',PtDataField,pioInput);
result:= CreateParam('result',PtDataField,pioOutput);
inval := 0;
outval := 0;
END;
//////////////////////////////////////
// Callback procedure
// inputs have an id (n) from first (top) to n last, the callback proc
// scans the inputs to detect changes,
// and notes the index if detecting one.
// that will allows to launchs different process depending on wich kind of
// inputs changed
Procedure Callback(N:integer);
BEGIN
if ((n=1) and (pressed.asInteger = 1) and (key.asInteger > 47) and (key.asInteger < 58))
then begin
inval := (key.asInteger - 48) + 10 * inval;
//result.asInteger(inval);
end;
if ((n=1) and (pressed.asInteger = 1) and (key.asInteger = 43) )//add
then begin
outval := outval + inval;
result.asInteger(outval);
inval := 0;
end;
if ((n=1) and (pressed.asInteger = 1) and (key.asInteger = 13) )//add
then begin
result.asInteger(outval);
inval := 0;
outval := 0;
end;
END;
//////////////////////////
//une calculette
//entrer nombre puis appui sur touche +
//appui sur touche enter remet à 0
/////////////////////////
var key, pressed: Tparameter;
var result: Tparameter;
var inval, outval : integer;
//////////////////////////////////////
// Init is started on script compilation to create the in/outs
PROCEDURE INIT;
BEGIN
key:= CreateParam('key',PtDataField,pioInput);
pressed:= CreateParam('pressed',PtDataField,pioInput);
result:= CreateParam('result',PtDataField,pioOutput);
inval := 0;
outval := 0;
END;
//////////////////////////////////////
// Callback procedure
// inputs have an id (n) from first (top) to n last, the callback proc
// scans the inputs to detect changes,
// and notes the index if detecting one.
// that will allows to launchs different process depending on wich kind of
// inputs changed
Procedure Callback(N:integer);
BEGIN
if ((n=1) and (pressed.asInteger = 1) and (key.asInteger > 47) and (key.asInteger < 58))
then begin
inval := (key.asInteger - 48) + 10 * inval;
//result.asInteger(inval);
end;
if ((n=1) and (pressed.asInteger = 1) and (key.asInteger = 43) )//add
then begin
outval := outval + inval;
result.asInteger(outval);
inval := 0;
end;
if ((n=1) and (pressed.asInteger = 1) and (key.asInteger = 13) )//add
then begin
result.asInteger(outval);
inval := 0;
outval := 0;
end;
END;
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
