[comp.sys.mac.programmer] changing sound playback rate problem

ma199at@sdcc6.ucsd.edu (L J Cris) (12/27/89)

I am trying to change the playback rate of digitalized
sound with the sound manager. I tried this code but
it does not seem to work. The odd thing is if I set up a
breakpoint at the call to SndPlay, and then once the code
is interrupted just let it continue executing again the
change in the playback rate does work.
Why!?? All help would be appreciated. Thanks.
-Cris Rys
------------

sndChanPtr = nil;
error = SndNewChannel( &sndChanPtr,0,initMono,nil);
if (error != noErr)  Debugger();
else  	{
	rsrcHdl = GetNamedResource('snd ',rsrcName);
	if (rsrcHdl == nil) Debugger();
	else 	{
		error = SndPlay(sndChanPtr,rsrcHdl,true);
		if (error != noErr)  Debugger();
		sndCommand.cmd = rateCmd;
		sndCommand.param1 = 0;
		sndCommand.param2 = FixRatio(1,2);
		error = SndDoImmediate(sndChanPtr,&sndCommand);
		if (error != noErr)  Debugger();
		error =  SndDisposeChannel(sndChanPtr, false);
		if (error != noErr)  Debugger();
		ReleaseResource(rsrcHdl);
		}
	}