Ticket #5093: PushGameSound.patch
File PushGameSound.patch, 1.3 KB (added by , 14 years ago) |
---|
-
src/kits/game/PushGameSound.cpp
16 16 17 17 18 18 BPushGameSound::BPushGameSound(size_t inBufferFrameCount, const gs_audio_format *format, 19 size_t inBufferCount, BGameSoundDevice *device) 20 : BStreamingGameSound(inBufferFrameCount, format, inBufferCount, device) 19 size_t inBufferCount, BGameSoundDevice *device) 20 : 21 BStreamingGameSound(inBufferFrameCount, format, inBufferCount, device), 22 fLockPos(0), 23 fPlayPos(0) 21 24 { 22 25 fPageLocked = new BList; 23 26 … … 153 156 return; 154 157 155 158 if (fPlayPos + bytes > fBufferSize) { 156 size_t remainder = f PlayPos + bytes - fBufferSize;159 size_t remainder = fBufferSize - fPlayPos; 157 160 char * buffer = (char*)inBuffer; 158 161 159 162 // fill the buffer with the samples left at the end of our buffer 160 memcpy(buffer, &fBuffer[fPlayPos], remainder); 163 if (remainder) 164 memcpy(buffer, &fBuffer[fPlayPos], remainder); 161 165 fPlayPos = 0; 162 166 163 167 // fill the remainder of the buffer by looping to the start … … 170 174 } else { 171 175 memcpy(inBuffer, &fBuffer[fPlayPos], bytes); 172 176 fPlayPos += bytes; 177 fPlayPos %= fBufferSize; 173 178 } 174 179 175 180 BStreamingGameSound::FillBuffer(inBuffer, inByteCount);