<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Claudio,</p>
<p><br>
</p>
<p>Since you mentioned the command line I suppose you want to pass
arguments to a program (it is also possible to pass it to a shred,
but not sure that is what you meant).<br>
</p>
<p> If that's the case well then yes, programs can receive floats
arguments from command line. <br>
</p>
<p>Here's an example:</p>
<p><br>
</p>
<p></p>
<pre>// loop through all the arguments</pre>
<pre>// those which are not 'floats' will be printed as 0</pre>
<pre>if(me.args())</pre>
<pre>{
</pre>
<pre> for(0 => int c; c < me.args(); c++)</pre>
<pre> {</pre>
<pre>         chout <= Std.atof(me.arg(c)) <= " ";</pre>
<pre> }</pre>
<pre> chout <= IO.nl();</pre>
<pre>}</pre>
<pre>
Std.atof(me.arg(0)) => float myArg;</pre>
<pre>
chout <= "1st argument: " <= myArg <= IO.nl();</pre>
<p><br>
</p>
<p>You can launch this program and pass one or more args the
following way (assuming you saved it as myScript.ck):</p>
<pre>
</pre>
<pre>chuck myScript:1.23:5555:thridArg</pre>
<p><br>
</p>
<p>where you have 3 args: 1.23, 5555, thirdArg <br>
</p>
<p>The colon character ":" is used to separate the various
arguments, with no space between them.</p>
<p>me.arg() returns all the arguments as strings, regardless of
their type (numbers, literals), so you need to convert them (when
possible).</p>
<p>Std.atof() and Std.atoi() (ASCII to Float and ASCII to Int - more
info <a moz-do-not-send="true"
href="https://en.flossmanuals.net/chuck/_full/#standard-libraries">here</a>)
will do the job, but keep in mind that when the argument passed is
a 'string' that can't be properly converted into a number (ie
"thirdArg"), they'll return 0.</p>
<p><br>
</p>
<p>Now this is just the way you can pass arguments to a program,
then you'll have to implement a way to make it fade out.</p>
<p>The only thing that is not clear to me yet, is how you want to
use this to actually fade out and terminate a program, considering
the arguments are passed when the program is launched.</p>
<p>But anyway, let me know if you have any questions, and/or if I
can be of any help.<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p>Cheers,</p>
<p>Mario<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 01/06/2020 18:36, Claudio Donaggio
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAPJrx1Uvh-35n2Z25YDqBkh8PkgT1Lp0bqabt6K49mzD0OHWCg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">Hi Mario and thanks for your response!
<div dir="auto">Is it possible for a shred to receive an float
argument, from Command Line, that is the Gain of the shred and
so gradually and manually faing the shred?</div>
<div dir="auto">Thanks for answering my surely stupid question!</div>
<div dir="auto"><br>
</div>
<div dir="auto">Claudio</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Il lun 1 giu 2020, 18:00 <<a
href="mailto:chuck-users-request@lists.cs.princeton.edu"
moz-do-not-send="true">chuck-users-request@lists.cs.princeton.edu</a>>
ha scritto:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Send
chuck-users mailing list submissions to<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu"
target="_blank" rel="noreferrer" moz-do-not-send="true">chuck-users@lists.cs.princeton.edu</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a
href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a
href="mailto:chuck-users-request@lists.cs.princeton.edu"
target="_blank" rel="noreferrer" moz-do-not-send="true">chuck-users-request@lists.cs.princeton.edu</a><br>
<br>
You can reach the person managing the list at<br>
<a
href="mailto:chuck-users-owner@lists.cs.princeton.edu"
target="_blank" rel="noreferrer" moz-do-not-send="true">chuck-users-owner@lists.cs.princeton.edu</a><br>
<br>
When replying, please edit your Subject line so it is more
specific<br>
than "Re: Contents of chuck-users digest..."<br>
Today's Topics:<br>
<br>
1. Re: Shreds fade out (mario buoninfante)<br>
<br>
<br>
<br>
---------- Forwarded message ----------<br>
From: mario buoninfante <<a
href="mailto:mario.buoninfante@gmail.com" target="_blank"
rel="noreferrer" moz-do-not-send="true">mario.buoninfante@gmail.com</a>><br>
To: <a href="mailto:chuck-users@lists.cs.princeton.edu"
target="_blank" rel="noreferrer" moz-do-not-send="true">chuck-users@lists.cs.princeton.edu</a><br>
Cc: <br>
Bcc: <br>
Date: Sun, 31 May 2020 19:31:28 +0100<br>
Subject: Re: [chuck-users] Shreds fade out<br>
<div>
<p>Hi Claudio,</p>
<p>I suspect ChucK just 'kills' the programs when you run <br>
</p>
<p>> chuck - 1</p>
<p>from terminal. What it does it's just sending the
'remove' command to the Virtual Machine, so the program
itself is not really aware of what's going on.<br>
</p>
<p>If you want to fade the program out (or do any other
operation) before removing it, you must find a way to let
it know first, if that makes sense.</p>
<p>One solution could be to kill (and maybe launch as well)
your program from a different ChucK script (see Machine
section here: <a
href="https://en.flossmanuals.net/chuck/_full/#standard-libraries"
target="_blank" rel="noreferrer" moz-do-not-send="true">https://en.flossmanuals.net/chuck/_full/#standard-libraries</a>),
at this point you could put the 2 in communication and
have the parent program sending an Event to the child
before killing it, so that the latter has the time to fade
out and then 'remove' itself (ie me.exit()).</p>
<p>One other way could be to have all your programs able to
receive msg via OSC. <br>
</p>
<p>Then you have a dedicate program that deals with removing
them, sending messages via OSC.</p>
<p>For example you can have a <a href="http://cleanup.ck"
target="_blank" rel="noreferrer" moz-do-not-send="true">cleanup.ck</a>
program that simply takes one argument (provided via
terminal) that is the ID of the program to remove.</p>
<p>For example:<br>
</p>
<p>> <a href="http://cleanup.ck:12" target="_blank"
rel="noreferrer" moz-do-not-send="true">cleanup.ck:12</a></p>
<p>to remove the program with the ID 12.<br>
</p>
<p>When this is launched it fires an OSC message that looks
like this: <br>
</p>
<p>"remove x" <br>
</p>
<p>where 'x' is the ID of the program to remove.</p>
<p>Now all the other "active" programs receive this message,
but only the one with the right ID will respond to it and
maybe run your cleanupAndLeave() function, that fades out
and exits (me.exit()).</p>
<p>This of course means that all your other programs need to
have a simple parser that deals with the incoming OSC msg.<br>
</p>
<p><br>
</p>
<p>Of course I don't know anything about the context here,
so these solutions could be not suitable for you.</p>
<p>Maybe if you share a bit more about how and why you're
trying to achieve this, we'd be able to provide a bit more
support.</p>
<p><br>
</p>
<p>Hope this helps, anyway.<br>
</p>
<p><br>
</p>
<p>Cheers,</p>
<p>Mario<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<div>On 30/05/2020 23:33, Claudio Donaggio wrote:<br>
</div>
<blockquote type="cite">
<div dir="auto">
<div style="font-family:sans-serif;font-size:12.8px"
dir="auto">
<div style="width:328px;margin:16px 0px">
<div><br>
<br>
Hi all!<br>
I was wondering if there is a way to smoothly fade
out a shred. Example: from command line you add a
shred with chuck + <a href="http://shred.ck/"
style="text-decoration-line:none;color:rgb(66,133,244)"
target="_blank" rel="noreferrer"
moz-do-not-send="true">shred.ck</a> and remove
it with chuck - 1. But when you remove the shred
or replace it gets cut off instantly. I am sure
there is a way to dinamically scale the gain from
1 to 0 smoothly before remove the shred, but I do
not have a clue on how to go about it...<br>
Thanks!<br>
Claudio<br>
<br>
Inviato dal mio dispositivo mobile Huawei</div>
</div>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
chuck-users mailing list
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank" rel="noreferrer" moz-do-not-send="true">chuck-users@lists.cs.princeton.edu</a>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank" rel="noreferrer" moz-do-not-send="true">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a>
</pre>
</blockquote>
</div>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu"
target="_blank" rel="noreferrer" moz-do-not-send="true">chuck-users@lists.cs.princeton.edu</a><br>
<a
href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
chuck-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a>
<a class="moz-txt-link-freetext" href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a>
</pre>
</blockquote>
</body>
</html>