Changeset 152 for sbliveos2/trunk/drv16/wavestrm.cpp
- Timestamp:
- Jul 17, 2000, 8:37:33 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sbliveos2/trunk/drv16/wavestrm.cpp
r151 r152 34 34 #include "ioctl.h" 35 35 36 #ifndef min 37 #define min(a,b) (a>b) ? b : a 38 #endif 39 36 40 // 37 41 // _vRealignBuffer … … 152 156 void WAVESTREAM::AddBuffers(void) 153 157 { 158 ULONG space, byteswritten; 159 154 160 if (ulStreamType & STREAM_WRITE) { 155 161 if(!qhInProcess.Head() && !qhDone.Head()) { … … 160 166 return; 161 167 } 162 AddBuffer(); 163 AddBuffer(); 168 space = OSS16_StreamGetSpace(this); 169 if(space > 128) { 170 space -= 128; 171 } 172 while(space) { 173 byteswritten = AddBuffer(space); 174 space -= byteswritten; 175 if(byteswritten == 0) break; 176 } 164 177 } 165 178 } … … 171 184 // there are buffers on pHead... BEWARE 172 185 // 173 void WAVESTREAM::AddBuffer()186 ULONG WAVESTREAM::AddBuffer(ULONG space) 174 187 { 175 188 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhDone.Head(); … … 180 193 pTemp = (PSTREAMBUFFER)qhInProcess.Head(); 181 194 } 182 if(!pTemp) return ;195 if(!pTemp) return 0; 183 196 184 197 // get the buffer pointer and amount of data remaining … … 187 200 188 201 // write the audio buffer 202 Buff_left = min(Buff_left, space); 189 203 byteswritten = OSS16_StreamAddBuffer(this, pdataBuf, Buff_left); 190 204 if(byteswritten == 0) { 191 return; //no more room 192 } 193 194 // dprintf(("AddBuffer %lx size %d, bytes written %d", pdataBuf, (USHORT)Buff_left, (USHORT)byteswritten)); 205 return 0; //no more room 206 } 195 207 196 208 // update the buffer pos counter … … 200 212 qhDone.PushOnTail(qhInProcess.PopHead()); 201 213 } 214 dprintf4(("AddBuffer %lx size %d, bytes written %d", pdataBuf, (USHORT)Buff_left, (USHORT)byteswritten)); 215 return byteswritten; 202 216 } 203 217 … … 226 240 } 227 241 228 //// dprintf(("_vReadAudioBuf %lx size %d, bytes read %d", pdataBuf, Buff_left, bytesread));242 dprintf4(("_vReadAudioBuf %lx size %d, bytes read %d", pdataBuf, Buff_left, bytesread)); 229 243 230 244 // update the buffer pos counter … … 236 250 } 237 251 if(pTemp->ulBuffpos == pTemp->ulBuffsz) { 238 dprintf (("_vReadAudioBuf return buffer %lx size %ld, bytes read %ld", (ULONG)pTemp->pBuffptr, pTemp->ulBuffsz, bytesread));252 dprintf4(("_vReadAudioBuf return buffer %lx size %ld, bytes read %ld", (ULONG)pTemp->pBuffptr, pTemp->ulBuffsz, bytesread)); 239 253 ReturnBuffer(); 240 254 } … … 280 294 //calc position in next buffer 281 295 bytesinc = ptemp->ulDonepos - ptemp->ulBuffsz; 282 //// dprintf(("Process: Return buffer %lx size %d", ptemp->pBuffptr, ptemp->ulBuffsz));296 dprintf3(("Process: Return buffer %lx size %d", ptemp->pBuffptr, ptemp->ulBuffsz)); 283 297 ReturnBuffer(); 284 298 } … … 309 323 { 310 324 qhInProcess.PushOnTail((PQUEUEELEMENT)new STREAMBUFFER(uLength, pbuf)); 311 //// dprintf(("WAVESTREAM::Write: Push on tail %lx %d", ((PSTREAMBUFFER)qhInProcess.Head())->pBuffptr, ((PSTREAMBUFFER)qhInProcess.Head())->ulBuffsz));325 dprintf2(("WAVESTREAM::Write: Push on tail %lx %d", ((PSTREAMBUFFER)qhInProcess.Head())->pBuffptr, ((PSTREAMBUFFER)qhInProcess.Head())->ulBuffsz)); 312 326 if(fUnderrun) { 313 327 fUnderrun = FALSE; … … 323 337 { 324 338 qhInProcess.PushOnTail((PQUEUEELEMENT)new STREAMBUFFER(uLength, pbuf)); 325 dprintf (("WAVESTREAM::Read: Push on tail %lx %d", ((PSTREAMBUFFER)qhInProcess.Head())->pBuffptr, ((PSTREAMBUFFER)qhInProcess.Head())->ulBuffsz));339 dprintf2(("WAVESTREAM::Read: Push on tail %lx %d", ((PSTREAMBUFFER)qhInProcess.Head())->pBuffptr, ((PSTREAMBUFFER)qhInProcess.Head())->ulBuffsz)); 326 340 return 0; 327 341 } … … 384 398 ULONG fragsize; 385 399 400 #ifdef DEBUG 401 int oldlevel = dbglevel; 402 dbglevel = 4; 403 #endif 386 404 // configure the wave device 387 405 ((PWAVEAUDIO)pahw)->ConfigDev(this, &_configinfo); … … 421 439 OSS16_StartStream(this); 422 440 } 441 #ifdef DEBUG 442 dbglevel = oldlevel; 443 #endif 423 444 424 445 //Must set volume after adding buffers (voices inside sblive driver might not
Note:
See TracChangeset
for help on using the changeset viewer.