[chuck-users] reseting sndbuf

altern altern2 at gmail.com
Fri Nov 17 07:50:35 EST 2006


here i am with my weekly question ;)

Le t see if I explain this properly, I have few sndbuf playing. For this 
i am using a class that instantiates and controls a buffer and keeps the 
data for the buffer. It also sporks a shred that plays the sound.

At some point and while the buffer is being played i need to change the 
start point and length of the loop played. At the moment, the buffer 
keeps playing until it is time to start again and it does not updates 
its values until the loop is executed again. I would need the buffer to 
acknowledge that the length has changed 'on the fly'.

How could I do this?
This is the method sporked by the player class to play the buffer

	fun void loop() {
		while(!paused){ //play loop again if not paused
			gain => buffer.gain;
			gpitch => buffer.rate;
			pos => buffer.pos;
			pan => p.pan;
			length::samp => now;

If I understand well, this line
length::samp => now;
means that until the lenght time has passed the while wont loop again. 
So i would need some way to detect the current pos of the buffer then 
stop that sound and restart again the while with the new values at the 
pos where the sound was at the moment of the change.

I am not sure about how to to this or if this is the right way to do it. 
any tips?



More information about the chuck-users mailing list