X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fwin32%2FGenaDrive%2FDSound.cpp;h=05e7f02a508f011ca8c9ab1370e4b8d13919c465;hb=03a265e5ebabff7adbb4f97387f81e9b0428dbee;hp=5c9cc0c1b26910b587aab82a1a9dec7c7f12f70b;hpb=7c9e6899a2c3fd0dfeafa1c6cda1593741d635d4;p=picodrive.git diff --git a/platform/win32/GenaDrive/DSound.cpp b/platform/win32/GenaDrive/DSound.cpp index 5c9cc0c..05e7f02 100644 --- a/platform/win32/GenaDrive/DSound.cpp +++ b/platform/win32/GenaDrive/DSound.cpp @@ -45,7 +45,7 @@ int DSoundInit() wfx.nAvgBytesPerSec=wfx.nBlockAlign*wfx.nSamplesPerSec; // Make buffer for the next seg to put into the loop: - DSoundNext=(short *)malloc(PsndLen<<2); if (DSoundNext==NULL) return 1; + DSoundNext=(short *)malloc((PsndLen<<2)+64); if (DSoundNext==NULL) return 1; memset(DSoundNext,0,PsndLen<<2); // Create the DirectSound interface: @@ -89,7 +89,10 @@ static int WriteSeg() // Lock the segment at 'LoopWrite' and copy the next segment in LoopBuffer->Lock(LoopWrite<<((PicoOpt&8) ? 2 : 1),PsndLen<<((PicoOpt&8) ? 2 : 1), &mema,&sizea, &memb,&sizeb, 0); + //dprintf2("lock %p, cpy %x\n", mema, sizea); + if (mema) memcpy(mema,DSoundNext,sizea); +// if (memb) memcpy(memb,DSoundNext+sizea,sizeb); LoopBuffer->Unlock(mema,sizea, memb,0); @@ -106,6 +109,8 @@ int DSoundUpdate() LoopBuffer->GetCurrentPosition(&play,NULL); pos=play>>((PicoOpt&8) ? 2 : 1); + //dprintf2("loop %i pos %i\n", LoopWrite, pos); + // 'LoopWrite' is the next seg in the loop that we want to write // First check that the sound 'play' pointer has moved out of it: if (pos>=LoopWrite && pos