!7 sclass AudioOutput > DynPrintLog { int bufSize = 40960; transient playAudioFromSampleMakingFunction_AudioLoop loop; transient L sources = new CopyOnWriteArrayList; // L void start { ownTimer(loop = playAudioFromSampleMakingFunction(bufSize, voidfunc(short[] pair) { makeSample(pair) })); } void makeSample(short[] pair) { int l = 0, r = 0; for (O source : sources) { callF(source, pair); l += pair[0]; r += pair[1]; } pair[0] = clipShort(l); pair[1] = clipShort(r); } void addSource(O source) { sources.add(source); } void removeSource(O source) { sources.remove(source); } }