<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><BLOCKQUOTE type="cite"><DIV><BLOCKQUOTE class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">- It should be possible to start and stop the ChucK VM in Processing,<BR>but no stop handlers are called at closing the app, leaving the VM in<BR>the air. I understand this is an issue with Java applets. </BLOCKQUOTE><DIV><BR>Yes, this is a bit mysterious to me. The way to go about this would be staring ChucK using either "chuck --loop" or by feeding it a file like this; "ChucK <A href="http://myfile.ck">myfile.ck </A>" using a file that will keep running. The ChucK VM should exit after you give the system a command to "chuck --kill" or after the last shred has been removed from it (if it's not set to --loop). If it doesn't properly exit after either then that would probably be a bug. I don't see how applets would affect this as this would be something between the OS and ChucK, ChucK shouldn't be affected by what sort of thing send those system calls. Strange. <BR></DIV></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>No, this is just because of the way applets are quit in Java. If 'chuck --kill' is sent the processed are killed normally, so ChucK behaves predictable</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR><BLOCKQUOTE type="cite"><DIV><BLOCKQUOTE class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">- I would have liked to use 1 FilePlayer class that is loaded only<BR>once into the VM, but I have not found a way to do this. Either: <BR>    1) call 'chuck <A href="http://fileplayer.ck">fileplayer.ck</A>' before demo files are called causes<BR>errors on running the demo files that FilePlayer is unknown<BR>    2) for every demo file call 'chuck <A href="http://fileplayer.ck">fileplayer.ck</A><BR>chuckdemo.ck:all:sorts:of:params' causes an error that FilePlayer is<BR>already in the global VM space and this will stop the demo file from<BR>running</BLOCKQUOTE><DIV> <BR>I looked at your code for a bit and noticed you wrote a public class in one file, then redefined the class in another...<BR></DIV></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The public class not used in the demo, but I kept the file because that is the way I would ideally solve it.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>What I do in Processing is:</DIV><DIV>1) start chuck with 'chuck --loop' (because Processing will not quit the process I start it from the command line)</DIV><DIV>2) add the fileplayer class with 'chuck -add fileplayer.ck'</DIV><DIV>3) for each of the sound files, add it with 'chuck -add chuckdemo.ck:with:a:lot:of:params'</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>This is the order the commands are sent to ChucK. But what I get back is:</DIV><DIV>$ chuck --loop</DIV><DIV>[chuckdemo.ck]:line(43): undefined type 'FilePlayer'...</DIV><DIV>[chuckdemo.ck]:line(43): ... in declaration ...</DIV><DIV>[chuckdemo.ck]:line(43): undefined type 'FilePlayer'...</DIV><DIV>[chuckdemo.ck]:line(43): ... in declaration ...</DIV><DIV>[chuckdemo.ck]:line(43): undefined type 'FilePlayer'...</DIV><DIV>[chuckdemo.ck]:line(43): ... in declaration ...</DIV><DIV>[chuckdemo.ck]:line(43): undefined type 'FilePlayer'...</DIV><DIV>[chuckdemo.ck]:line(43): ... in declaration ...</DIV><DIV>[chuck](VM): sporking incoming shred: 1 (fileplayer.ck)...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>So even if 'fileplayer.ck' is called earlier, it is added last to the VM. First the chuckdemo.ck files are run and they do not know any FilePlayer class at that time.</DIV><DIV>Note that the order varies at each run. Sometimes the FilePlayer class is added second or third, sometimes first.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I don't know if this is because of the way Java calls the processes, or if class initialization in ChucK happens after file processing.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>So I would be fine if I could call for each file: 'chuck -add fileplayer.ck chuckdemo.ck:with:a:lot:of:params', but after the first file ChucK is bailing out:</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>[fileplayer.ck]:line(1): class/type 'FilePlayer' is already defined in namespace 'global'</DIV><DIV>why can't it just ignore this?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Arthur</DIV><DIV><BR class="khtml-block-placeholder"></DIV></DIV><BR></BODY></HTML>