wfx.nAvgBytesPerSec=wfx.nBlockAlign*wfx.nSamplesPerSec;\r
\r
// Make buffer for the next seg to put into the loop:\r
- DSoundNext=(short *)malloc(PsndLen<<2); if (DSoundNext==NULL) return 1;\r
+ DSoundNext=(short *)malloc((PsndLen<<2)+64); if (DSoundNext==NULL) return 1;\r
memset(DSoundNext,0,PsndLen<<2);\r
\r
// Create the DirectSound interface:\r
// Lock the segment at 'LoopWrite' and copy the next segment in\r
LoopBuffer->Lock(LoopWrite<<((PicoOpt&8) ? 2 : 1),PsndLen<<((PicoOpt&8) ? 2 : 1), &mema,&sizea, &memb,&sizeb, 0);\r
\r
+ //dprintf2("lock %p, cpy %x\n", mema, sizea);\r
+\r
if (mema) memcpy(mema,DSoundNext,sizea);\r
+// if (memb) memcpy(memb,DSoundNext+sizea,sizeb);\r
\r
LoopBuffer->Unlock(mema,sizea, memb,0);\r
\r
LoopBuffer->GetCurrentPosition(&play,NULL);\r
pos=play>>((PicoOpt&8) ? 2 : 1);\r
\r
+ //dprintf2("loop %i pos %i\n", LoopWrite, pos);\r
+\r
// 'LoopWrite' is the next seg in the loop that we want to write\r
// First check that the sound 'play' pointer has moved out of it:\r
if (pos>=LoopWrite && pos<LoopWrite+PsndLen) return 1; // No, it hasn't\r