<html><head></head><body bgcolor="#FFFFFF"><div>tks Cris an Ju!!</div><div><br></div><div>Ju that was exacty the workaround i was looking for. thanks a lot!</div><div><br></div><div>we talk soon guys!</div><div><br></div><div>( :<br><br>On 18 Apr 2012, at 09:33, Julien Saint-Martin <<a href="mailto:julien.saintmartin@googlemail.com">julien.saintmartin@googlemail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>Hi Henrique and Welcome to ChucK world :o)<br><br>I think all you want to do is possible but their is different ways to do it and limitations (but fortunately work around too!! )<br><br>Here is the method I use:<br>To centralize all my public classes, scripts and shared objects, I have a <a href="http://top.ck">top.ck</a> file where I add each files in correct order with Machine.add() command:<br>
<br>Machine.add ("<a href="http://tick_class.ck">tick_class.ck</a>");<br>Machine.add ("<a href="http://beat_event_class.ck">beat_event_class.ck</a>");<br>Machine.add ("<a href="http://beat_events.ck">beat_events.ck</a>");<br>
Machine.add ("<a href="http://play_tick_class.ck">play_tick_class.ck</a>");<br>//Machine.add ("<a href="http://send.ck">send.ck</a>");<br>//Machine.add ("<a href="http://receive.ck">receive.ck</a>");<br>
Machine.add ("<a href="http://receive_tick.ck">receive_tick.ck</a>");<br>Machine.add ("<a href="http://rythm.ck">rythm.ck</a>");...<br><br><br><br><a href="http://tick_class.ck">tick_class.ck</a> is for example an extended Event class where I added some extra info:<br>
<br>public class tick_event extends Event {<br><br>    int tick_nb;<br>    int is_meas_start;<br>    int is_super_meas_start;<br>    dur tick_dur;<br>}<br><br><br>One limitation of current chuck version is that you cannot have more than one public class per file.<br>
<br><br><a href="http://beat_events.ck">beat_events.ck</a> contains another public class where static objects are defined. There is a limitation here, you have to instantiate static objects outside of class declaration. I use to do it in the same file as class declaration:<br>
<br><br>public class beat_events {<br>    static beat_event @ ev1;    <br><br>    static tick_event @ tick;<br>    <br>}<br><br><b>tick_event Tick @=> beat_events.tick;<br>beat_event Ev1 @=> beat_events.ev1;<br></b><br>
<br><br><br><a href="http://play_tick_class.ck">play_tick_class.ck</a> : send Tick event with command beat_events.tick.broadcast();<br><a href="http://receive_tick.ck">receive_tick.ck</a>: Receive event with line:  beat_events.tick => now;<br>
<br><br><br>Have fun!<br>Ju<br><br><br><div class="gmail_quote">2012/4/18 [chriswicks] <span dir="ltr"><<a href="mailto:crwicks@yahoo.com">crwicks@yahoo.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:10pt;font-family:arial,helvetica,sans-serif"><div><span>If you're talking about defining your own object types via classes, you need to make sure that the .ck file containing your defined class gets added to the virtual machine first.  The best way to do this is to instantiate the VM in one terminal by using the comand chuck --loop.  After that, open another terminal and type chuck + Class.ck (replace class with whatever your filename is).  Then go ahead and add the client (whatever file is utilizing your defined class).  I'm not sure if this is what you're asking, and I'm new to ChucK myself, but hopefully this gets you started on the right track.  The other way is to just type "chuck Service.ck <a href="http://client.ck" target="_blank">client.ck</a>" or whatever (it is necessary that the class containing your user-defined object is first).  This works as well, but it's not as flexible on-the-fly as
 running chuck --loop.<br></span></div><div><br></div>  <div style="font-family:arial,helvetica,sans-serif;font-size:10pt"> <div style="font-family:times new roman,new york,times,serif;font-size:12pt"> <div dir="ltr"> <font face="Arial"> <hr size="1">
  <b><span style="font-weight:bold">From:</span></b> henrique matias <<a href="mailto:hems.inlet@gmail.com" target="_blank">hems.inlet@gmail.com</a>><br> <b><span style="font-weight:bold">To:</span></b> <a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a> <br>
 <b><span style="font-weight:bold">Sent:</span></b> Tuesday, April 17, 2012 9:12 PM<br> <b><span style="font-weight:bold">Subject:</span></b> [chuck-users] different classes and files talking to each other<br> </font> </div>
<div><div class="h5"> <br>
<div>Hello folks, hope everything is great over there! ( :<div><br></div><div>Am new to chuck, needless to say am impressed! </div><div><br></div><div>Am a bit confused how to share and control different classes and files from a central "machine".</div>


<div><br></div><div>The first idea was to create a static Event var and put every class listening to this event, but unfortunately we still can't instantiate non-native objects as static.</div><div><br></div><div>Would someone please point me to some basic structure/example?</div>


<div><br></div><div>Thanks a lot! Happy chucking!</div>
</div><br></div></div>_______________________________________________<br>chuck-users mailing list<br><a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br><a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br><br> </div> </div>  </div></div><br>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></blockquote></div><br>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>chuck-users mailing list</span><br><span><a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a></span><br><span><a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a></span><br></div></blockquote></body></html>