//class definition (blueprints, template) //for a sample player object (concrete instance) public class SmpPlay //declared public so other shreds can access it { //declare variable "filename" of type string string filename; //instantiate a SndBuf object named buf SndBuf buf => dac; //define our class method named "play" (ie a function) //declared public so other shreds can use, returns nothing (void) public void play(string str) //takes a string as input (ie file path) { //assign the input (file path) to our "filename" //variable declared above str => filename; //read our file into the SndBuf object named buf filename => buf.read; //set the beginning position, rate of playback, and gain 0 => buf.pos; 1. => buf.rate; 0.7 => buf.gain; //advance time by the lenght of the sound file //so that it doens't get cut off early buf.length() => now; } public void loop(int on) { if(on == 1) { buf.loop(on); } else { buf.loop(0); } } }