[chuck-users] Attempt to exit a sporked shred
Casper Schipper
casper.schipper at gmail.com
Sat Nov 1 08:34:57 EDT 2014
Hi Will,
Try use machine.remove(shred.id()) instead of shred.exit() :
See examples/shred/spork2.ck:
// define function
fun void foo()
{
while( true )
{
<<< "hi" >>>;
.2::second => now;
}
}
// spork the function, remember the shred reference
spork ~ foo() @=> Shred @ s;
// wait for 2 seconds
2::second => now;
// remove by id
Machine.remove( s.id() );
// wait a little more
2::second => now;
Happy chucking!
Casper
> On 1 nov. 2014, at 08:42, chuck-users-request at lists.cs.princeton.edu wrote:
>
> Send chuck-users mailing list submissions to
> chuck-users at lists.cs.princeton.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> or, via email, send a message with subject or body 'help' to
> chuck-users-request at lists.cs.princeton.edu
>
> You can reach the person managing the list at
> chuck-users-owner at lists.cs.princeton.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of chuck-users digest..."
> Today's Topics:
>
> 1. re Instanceof in ChucK (Casper Schipper)
> 2. Re: re Instanceof in ChucK (Casper Schipper)
> 3. Attempt to exit a sporked shred. (Will Hardwick-Smith)
> 4. Un-chuck something? (Will Hardwick-Smith)
>
> From: Casper Schipper <casper.schipper at gmail.com>
> To: chuck-users at lists.cs.princeton.edu
> Date: 31 oktober 2014 17:09:00 CET
> Reply-To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> Subject: [chuck-users] re Instanceof in ChucK
>
>
> Try .toString(): it's the closest thing.
>
> SinOsc foo;
> Object bar;
>
> class MyClass {
> float value;
> }
>
> MyClass myInstance;
>
> <<<foo.toString()>>>;
> <<<bar.toString()>>>;
> <<<myInstance.toString()>>>;
>
>
> "SinOsc:10061d9a0" : (string)
> "Object:61000009e190" : (string)
> "MyClass:61000009e140" : (string)
>
> Best,
> Casper
>
>
>>
>> 1. Instanceof in ChucK (Will Hardwick-Smith)
>>
>> From: Will Hardwick-Smith <whardwicksmith at gmail.com <mailto:whardwicksmith at gmail.com>>
>> To: chuck-users at lists.cs.princeton.edu <mailto:chuck-users at lists.cs.princeton.edu>
>> Date: 30 oktober 2014 23:34:57 CET
>> Reply-To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu <mailto:chuck-users at lists.cs.princeton.edu>>
>> Subject: [chuck-users] Instanceof in ChucK
>>
>>
>> Say I have Object o, and I want to see if it is an instance of UGen or a sub-class of UGen.
>> Is there a way to check this in ChucK?
>>
>>
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu <mailto:chuck-users at lists.cs.princeton.edu>
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
>
>
> From: Casper Schipper <casper.schipper at gmail.com>
> To: chuck-users at lists.cs.princeton.edu
> Date: 31 oktober 2014 17:24:33 CET
> Reply-To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> Subject: Re: [chuck-users] re Instanceof in ChucK
>
>
> Ah sorry Will, I misread your question.
>
> I am afraid that there is no built-in way in ChucK to check what is the super-class of an object.
>
> However, you could take a look at this earlier discussion which discusses the same problem:
> https://lists.cs.princeton.edu/pipermail/chuck-users/2013-January/007223.html <https://lists.cs.princeton.edu/pipermail/chuck-users/2013-January/007223.html>
>
> best,
> Casper
>
>> On 31 okt. 2014, at 17:09, Casper Schipper <casper.schipper at gmail.com <mailto:casper.schipper at gmail.com>> wrote:
>>
>> Try .toString(): it's the closest thing.
>>
>> SinOsc foo;
>> Object bar;
>>
>> class MyClass {
>> float value;
>> }
>>
>> MyClass myInstance;
>>
>> <<<foo.toString()>>>;
>> <<<bar.toString()>>>;
>> <<<myInstance.toString()>>>;
>>
>>
>> "SinOsc:10061d9a0" : (string)
>> "Object:61000009e190" : (string)
>> "MyClass:61000009e140" : (string)
>>
>> Best,
>> Casper
>>
>>
>>>
>>> 1. Instanceof in ChucK (Will Hardwick-Smith)
>>>
>>> From: Will Hardwick-Smith <whardwicksmith at gmail.com <mailto:whardwicksmith at gmail.com>>
>>> To: chuck-users at lists.cs.princeton.edu <mailto:chuck-users at lists.cs.princeton.edu>
>>> Date: 30 oktober 2014 23:34:57 CET
>>> Reply-To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu <mailto:chuck-users at lists.cs.princeton.edu>>
>>> Subject: [chuck-users] Instanceof in ChucK
>>>
>>>
>>> Say I have Object o, and I want to see if it is an instance of UGen or a sub-class of UGen.
>>> Is there a way to check this in ChucK?
>>>
>>>
>>> _______________________________________________
>>> chuck-users mailing list
>>> chuck-users at lists.cs.princeton.edu <mailto:chuck-users at lists.cs.princeton.edu>
>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users <https://lists.cs.princeton.edu/mailman/listinfo/chuck-users>
>>
>
>
>
>
> From: Will Hardwick-Smith <whardwicksmith at gmail.com>
> To: chuck-users at lists.cs.princeton.edu
> Date: 1 november 2014 06:47:05 CET
> Reply-To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> Subject: [chuck-users] Attempt to exit a sporked shred.
>
>
> I want to end/exit/destroy a sporked shred.
>
> In this example code, I attempt to exit a sporked function. When executed, the shred doesn't stop as I'd expect.
>
> fun void foo(){
> 1::week => now;
> }
> spork ~ foo() @=> Shred shred;
> 2::second => now;
> shred.exit();
> 1::week => now;
>
> How can I exit the sporked shred?
>
>
>
> From: Will Hardwick-Smith <whardwicksmith at gmail.com>
> To: chuck-users at lists.cs.princeton.edu
> Date: 1 november 2014 08:42:15 CET
> Reply-To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> Subject: [chuck-users] Un-chuck something?
>
>
> Is there a way to un-chuck something?
> If this code is executed:
> SinOsc sine => dac;
> Is there a way to make it so sine is no longer being chucked to dac?
>
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20141101/323836c5/attachment-0001.html>
More information about the chuck-users
mailing list