[chuck-users] sndbuf.pos

Adam Tindale adamtindale at hotmail.com
Sun Dec 4 16:20:10 EST 2005

Hi Eduard,

That is true. The way I usually get around this problem is to set up  
a time loop that takes your desired pos and then advances the  
difference in time.

int mypos;

	mypos => samp.pos;
	(samp.samples() - mypos)::samps => now;

You can set this up in a sporked shred and communicate with it to  
stop it or start it. I usually put the sndbuf into an envelope and  
have the keyboard control the gain and that will save you some trouble.

Right now there isn't a better way that I know of. You could also  
make a class that abstracted this out and then plead to Ge and crew  
to add this feature into sndbuf.

Hope this helps.


On 4-Dec-05, at 12:29 PM, eduard wrote:

> Hello all,
> I have a question for whoever is willing to answer it.
> Has one to always set sndbuf.pos at each iteration?
> My scenario:
> Let's say I want to control the starting position of my sndbuf with  
> a midi keyboard while sndbuf is set to loop mode ( 1 => sndbuf.loop ).
> Midi is received in a sporked MidiReceive() function and my  
> sndbuf.pos is set inside this same function and not in the main  
> while-loop.
> Thus when I press a key the sndbuf.pos is changed for that loop,  
> but when it gets to the end of it, it starts at sndbuf.pos(0)  
> instead of the previously set one.
> So it seems that sndbuf doesn't keep track of the position that was  
> set, and automatically starts from the beginning when the end of  
> the audiofile is reached.
> Is this true?
> Thanks,
> Eduard
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

More information about the chuck-users mailing list