!7 import static x30_pkg.x30_util.VF1; sclass PlayAudioLoop > DynPrintLog { bool enabled; float gain = 0.5f; transient short[] loop; transient VF1 source; transient GainSoundSource gainSource; start { // download & load WAV loop = decodeWAVToStereoSamples(loadLibrary(#1400093)); onChange(r { set(gainSource, gain := (double) gain); if (soundSource != null) soundSource.setEnabled(enabled); }); // Make sound source & add to audio output module dm_addSoundSource( gainSource = GainSoundSource(gain, source = stereoSamplesIterator(loop))); } visualize { ret centerAndSouth(super.visualize(), centerAndEast( withLabel("Volume (0-200%):", liveSliderZeroToOne(gain/2, voidfunc(float f) { setField(gain := f*2) })), dm_fieldCheckBox('enabled))); } }