Re: Does IanniX engine sometimes freeze variables state ?

Accueil Forums Scripts Does IanniX engine sometimes freeze variables state ? Re: Does IanniX engine sometimes freeze variables state ?

#2824
Anonyme
Inactif

Hi Joseph, I’m the author of GeoSonix which was branched off IanniX about a year ago.

I was curious to know whether the problems you are reporting existed in GeoSonix so I converted your script to a GeoSonix script. The commands are similar but the syntax is simplified (see below). As far as I can tell the script builds a score that runs as you intended, although I have not tried controlling it with OSC.

The converted script is at the end of this post. It needs the GeoSonix Version 0.9 Beta (OS X only for now). If you’d like to try it contact me at the email address in the message signature for download information.

– Chris

var ENTONNOIR = 0;
var BOURONNE = 1;
var COURONNE = 2;

var playEntonnoir = 0;
var entonnoirSpeed = 1;
var entonnoirDuration = 10;

var playBouronne = 0;
var bouronneSpeed = 1;
var bouronneDuration = 10;

var playCouronne = 1;
var couronneSpeed = 1;
var couronneDuration = 10;

function onCreate() {

var id = 0;

clear();
rotate();
center(6.5,0,0);
zoom(50);

//
:::::::::::::::::::::::::::::: Entonnoir
addCurve(1000 + id);
setPosition(id * 7,0,0);

//Plot curve
fx = function(t) {return 3 * pow(1-t,3) * cos(t * TWO_PI * 12)};
fy = function(t) {return 3 * pow(1-t,3) * sin(t * TWO_PI * 12)};
fz = function(t) {return 2 - (pow(t,1.5) * 4)};
plot( 300, fx, fy, fz);

addCursor(id);
setCurve();
setDuration(entonnoirDuration);
//setSpeedMultiplierRT(playEntonnoir * entonnoirSpeed);
setPattern("1 0"); // one shot
setCursorWidth(1);

//Set custom cursor message

setMessage(20, "osc://127.0.0.1:57120/entonnoir " + id
+ " {cursorXPosition - curveXPosition}"
+ " {cursorYPosition - curveYPosition}"
+ " {cursorZPosition - curveZPosition}"
+ " cursorTimePercent");

id++;

//_________________________________________________________________________//
//
::::::::::::::::::::::::: Bouronne
addCurve(1000 + id);
setPosition(id * 7,0,0);

// curve variables :
var ray = 2;
var revs = 5;
var hf = 0.5;

//theta : sin(6 * TWO_PI * t),
//r : 2.5 - (5 * t),
//phi : cos(6 * TWO_PI * t),
fx = function(t) {return ray * cos(TWO_PI * t) * sin(HALF_PI + hf * sin(revs * TWO_PI * t))};
fy = function(t) {return ray * sin(TWO_PI * t) * sin(HALF_PI + hf * sin(revs * TWO_PI * t))};
fz = function(t) {return ray * cos(HALF_PI + hf * sin(revs * TWO_PI * t))};
plot( 300, fx, fy, fz);

//Add a cursor
addCursor(id);
setCurve();
setDuration(10);
setPattern("1 -1"); // back and forth
setCursorWidth(1);

//Set custom cursor message

setMessage(20, "osc://127.0.0.1:57120/bouronne " + id
+ " {cursorXPosition - curveXPosition}"
+ " {cursorYPosition - curveYPosition}"
+ " {cursorZPosition - curveZPosition}"
+ " cursorTimePercent");

id++;

//_________________________________________________________________________//

//
::::::::::::::::::::::::: Couronne
addCurve(1000 + id);
setPosition(id * 7,0,0);

//Plot curve
//fx = function(t) {return 2 * cos(t * TWO_PI)};// * (2 - abs(sin(6 * TWO_PI * t)))};
//fy = function(t) {return 2 * sin(t * TWO_PI)};// * (2 - abs(sin(6 * TWO_PI * t)))};
//fx = function(t) {return sin(6 * TWO_PI * t)};//2 - (pow(t,1.5) * 4)};

fx = function(t) {return ray * cos(TWO_PI * t) * sin(HALF_PI + hf * sin(revs * TWO_PI * t))};
fy = function(t) {return ray * sin(TWO_PI * t) * sin(HALF_PI + hf * sin(revs * TWO_PI * t))};
fz = function(t) {return ray * cos(HALF_PI + hf * sin(revs * TWO_PI * t))};
plot( 300, fx, fy, fz);

addCursor(id);
setCurve();
setDuration(couronneDuration);
//run("setSpeedF current " + playCouronne * couronneSpeed);
setPattern("1"); // mono directionnal infinite loop
setCursorWidth(1);

//Set custom cursor message
setMessage(20, "osc://127.0.0.1:57120/couronne " + id
+ " {cursorXPosition - curveXPosition}"
+ " {cursorYPosition - curveYPosition}"
+ " {cursorZPosition - curveZPosition}"
+ " cursorTimePercent");
id++;

// Play on init :
play(1);
}

//If a message is received
function onMessage(protocol, host, port, destination, values) {
if(protocol == "osc") {
// :::::::::::::::::::::::::::::::::::: Entonnoir control
if(destination == "/entonnoir/play") {
playEntonnoir = values[0];
setSpeedMultiplierRT(ENTONNOIR, playEntonnoir * entonnoirSpeed);
if(playEntonnoir == 0) {
setTime(ENTONNOIR, 0);
}
}
if(destination == "/entonnoir/duration") {
entonnoirDuration = (values[0] <= 1) ? 0.001 : values[0]/1000;
}
if(destination == "/entonnoir/speed") {
entonnoirSpeed = values[0];
setSpeedMultiplierRT(ENTONNOIR, playEntonnoir * entonnoirSpeed);
}
// :::::::::::::::::::::::::::::::::::: Couronne control
if(destination == "/couronne/play") {
playCouronne = values[0];
setSpeedMultiplierRT(COURONNE, playCouronne * couronneSpeed);
if(playCouronne == 0) {
run("setTime "+ COURONNE + " 0");
}
}
if(destination == "/couronne/duration") {
couronneDuration = (values[0] <= 1) ? 0.001 : values[0]/1000;
}
if(destination == "/couronne/speed") {
couronneSpeed = values[0];
setSpeedMultiplierRT(COURONNE, playCouronne * couronneSpeed);
}
}
}

© IanniX Association

Qu'est-ce que IanniX ? | Téléchargement | Showcase | Forum | Recherche | À propos