Hi...

If you're restting the sndbufpt to the beginning of your sound buffer each time 
then 'k' will always be 0.  So if the value pointed to by sndbufpt is 50000 and 
sndstrP->sndbuffer is at 50000 then k = 50000 - 50000 will be 0.  That's why I 
wondered if this is your actual callback because it should've never made a 
sound on any device.  You're going to need to utilize your sndbufsize somewhere.

Oh, and you don't want the application messing around with any 
variables/pointers while this callback is being called.  You'll run into major 
race-conditions.

void callback (struct sndstrtype *sndstrP, SndStreamRef strRef, void 
*bufP,UInt32 *bsp)
{
UInt32 k=*(sndstrP->sndbufpt)-sndstrP->sndbuffer;
if(k>*bsp) k=*bsp;
else *bsp=k;
if(k)MemMove(bufP,sndstrP->sndbuffer,k);
*(sndstrP->sndbufpt)=sndstrP->sndbuffer;
}
struct sndstrtype{
char **sndbufpt; //ptr to ptr of the current buffer pos.
char *sndbuffer; //buffer pointer
char *sndbufsize;
} *sndstr; 
 

David
-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to