- Timestamp:
- Jun 4, 2002, 7:36:56 PM (23 years ago)
- Location:
- trunk/src/winmm
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/winmm/initwinmm.cpp
r8510 r8568 1 /* $Id: initwinmm.cpp,v 1. 8 2002-05-28 17:10:02sandervl Exp $1 /* $Id: initwinmm.cpp,v 1.9 2002-06-04 17:36:55 sandervl Exp $ 2 2 * 3 3 * WINMM DLL entry point … … 243 243 return MCIERR_CANNOT_LOAD_DRIVER; 244 244 } 245 USHORT sel = GetFS();245 USHORT sel = RestoreOS2FS(); 246 246 DWORD ret = pfnmciSendCommand(wDeviceID, wMessage, dwParam1, dwParam2, wUserParm); 247 247 SetFS(sel); … … 258 258 return MCIERR_CANNOT_LOAD_DRIVER; 259 259 } 260 USHORT sel = GetFS();260 USHORT sel = RestoreOS2FS(); 261 261 DWORD ret = pfnmciGetErrorString(dwError, lpstrBuffer, wLength); 262 262 SetFS(sel); -
trunk/src/winmm/waveout.cpp
r8508 r8568 1 /* $Id: waveout.cpp,v 1.2 4 2002-05-28 14:09:25 sandervl Exp $ */1 /* $Id: waveout.cpp,v 1.25 2002-06-04 17:36:55 sandervl Exp $ */ 2 2 //#undef DEBUG 3 3 /* … … 153 153 154 154 if(WaveOut::find(dwave) == TRUE) 155 return(dwave->res tart());155 return(dwave->resume()); 156 156 else return(MMSYSERR_INVALHANDLE); 157 157 } -
trunk/src/winmm/waveoutbase.h
r5873 r8568 1 /* $Id: waveoutbase.h,v 1. 2 2001-06-02 08:30:35 sandervl Exp $ */1 /* $Id: waveoutbase.h,v 1.3 2002-06-04 17:36:55 sandervl Exp $ */ 2 2 3 3 /* … … 27 27 virtual MMRESULT pause() = 0; 28 28 virtual MMRESULT stop() = 0; 29 virtual MMRESULT res tart() = 0;29 virtual MMRESULT resume() = 0; 30 30 virtual MMRESULT reset() = 0; 31 31 virtual ULONG getPosition() = 0; -
trunk/src/winmm/waveoutdart.cpp
r8202 r8568 1 /* $Id: waveoutdart.cpp,v 1. 7 2002-04-07 14:36:31sandervl Exp $ */1 /* $Id: waveoutdart.cpp,v 1.8 2002-06-04 17:36:55 sandervl Exp $ */ 2 2 3 3 /* … … 197 197 int minbufsize = consumerate/32; 198 198 199 ulBufSize = pwh->dwBufferLength/2; 200 if(ulBufSize > minbufsize) { 201 dprintf(("set buffer size to %d bytes (org size = %d)", minbufsize, pwh->dwBufferLength)); 202 ulBufSize = minbufsize; 199 if(pwh->dwBufferLength > minbufsize) { 200 ulBufSize = pwh->dwBufferLength/2; 201 if(ulBufSize < minbufsize) { 202 dprintf(("set buffer size to %d bytes (org size = %d)", minbufsize, pwh->dwBufferLength)); 203 ulBufSize = minbufsize; 204 } 205 } 206 else { 207 //assume application knows what it's doing and use the first buffersize 208 ulBufSize = pwh->dwBufferLength; 203 209 } 204 210 #else … … 261 267 //write buffers to DART; starts playback 262 268 // MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector! 263 USHORT selTIB = GetFS(); // save current FS selector269 USHORT selTIB = RestoreOS2FS(); // save current FS selector 264 270 265 271 MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle, … … 267 273 PREFILLBUF_DART); 268 274 SetFS(selTIB); // switch back to the saved FS selector 269 270 275 dprintf(("Dart playing\n")); 271 276 } … … 290 295 291 296 writeBuffer(); //must be called before (re)starting playback 297 298 State = STATE_PLAYING; 299 fUnderrun = FALSE; 292 300 wmutex.leave(); 293 301 294 if(State == STATE_STOPPED) {//continue playback 295 restart(); 296 } 297 else 298 if(fUnderrun) { 299 dprintf(("Resume playback after underrun")); 300 fUnderrun = FALSE; 301 State = STATE_PLAYING; 302 303 memset(&GenericParms, 0, sizeof(GenericParms)); 304 305 // Resume the playback. 306 mymciSendCommand(DeviceId, MCI_RESUME, MCI_WAIT, (PVOID)&GenericParms, 0); 307 308 //write buffers to DART; starts playback 309 // MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector! 310 USHORT selTIB = GetFS(); // save current FS selector 311 312 MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle, &MixBuffer[curPlayBuf], 1); 313 314 SetFS(selTIB); // switch back to the saved FS selector 315 } 302 //write buffers to DART; starts playback 303 // MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector! 304 USHORT selTIB = RestoreOS2FS(); // save current FS selector 305 306 MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle, 307 MixBuffer, 308 PREFILLBUF_DART); 309 SetFS(selTIB); // switch back to the saved FS selector 310 311 dprintf(("Dart playing\n")); 316 312 } 317 313 return(MMSYSERR_NOERROR); … … 321 317 MMRESULT DartWaveOut::pause() 322 318 { 323 MCI_GENERIC_PARMS Params;319 MCI_GENERIC_PARMS Params; 324 320 325 321 dprintf(("WINMM: DartWaveOut::pause")); … … 339 335 // Pause the playback. 340 336 mymciSendCommand(DeviceId, MCI_PAUSE, MCI_WAIT, (PVOID)&Params, 0); 337 338 return(MMSYSERR_NOERROR); 339 } 340 /******************************************************************************/ 341 /******************************************************************************/ 342 MMRESULT DartWaveOut::resume() 343 { 344 MCI_GENERIC_PARMS Params; 345 346 dprintf(("DartWaveOut::resume")); 347 348 wmutex.enter(); 349 if(State != STATE_PAUSED) { 350 wmutex.leave(); 351 return(MMSYSERR_NOERROR); 352 } 353 354 State = STATE_PLAYING; 355 wmutex.leave(); 356 357 memset(&Params, 0, sizeof(Params)); 358 359 // Resume the playback. 360 mymciSendCommand(DeviceId, MCI_RESUME, MCI_WAIT, (PVOID)&Params, 0); 341 361 342 362 return(MMSYSERR_NOERROR); … … 408 428 /******************************************************************************/ 409 429 /******************************************************************************/ 410 MMRESULT DartWaveOut::restart()411 {412 int i, curbuf;413 414 dprintf(("DartWaveOut::restart"));415 if(State == STATE_PLAYING)416 return(MMSYSERR_NOERROR);417 418 //Only write buffers to dart if mixer has been initialized; if not, then419 //the first buffer write will do this for us.420 if(fMixerSetup == TRUE)421 {422 wmutex.enter();423 State = STATE_PLAYING;424 fUnderrun = FALSE;425 wmutex.leave();426 curbuf = curPlayBuf;427 428 // MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector!429 USHORT selTIB = GetFS(); // save current FS selector430 431 for(i=0;i<PREFILLBUF_DART;i++)432 {433 dprintf(("restart: write buffer at %x size %d", MixBuffer[curbuf].pBuffer, MixBuffer[curbuf].ulBufferLength));434 MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle, &MixBuffer[curbuf], 1);435 if(++curbuf == PREFILLBUF_DART)436 curbuf = 0;437 }438 SetFS(selTIB); // switch back to the saved FS selector439 }440 441 return(MMSYSERR_NOERROR);442 }443 /******************************************************************************/444 /******************************************************************************/445 430 ULONG DartWaveOut::getPosition() 446 431 { … … 612 597 //Transfer buffer to DART 613 598 // MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector! 614 USHORT selTIB = GetFS(); // save current FS selector599 USHORT selTIB = RestoreOS2FS(); // save current FS selector 615 600 MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle, &MixBuffer[curPlayBuf], 1); 616 601 SetFS(selTIB); // switch back to the saved FS selector … … 678 663 ULONG ulFlags) 679 664 { 680 PTIB2 ptib2; 681 DartWaveOut *dwave; 665 PTIB2 ptib2; 666 DartWaveOut *dwave; 667 668 dprintf2(("WaveOutHandler %x %x %x", ulStatus, pBuffer, ulFlags)); 682 669 683 670 ptib2 = (PTIB2)_getTIBvalue(offsetof(TIB, tib_ptib2)); -
trunk/src/winmm/waveoutdart.h
r5421 r8568 1 /* $Id: waveoutdart.h,v 1. 2 2001-04-01 12:31:01sandervl Exp $ */1 /* $Id: waveoutdart.h,v 1.3 2002-06-04 17:36:56 sandervl Exp $ */ 2 2 3 3 /* … … 38 38 virtual MMRESULT pause(); 39 39 virtual MMRESULT stop(); 40 virtual MMRESULT res tart();40 virtual MMRESULT resume(); 41 41 virtual MMRESULT setVolume(ULONG ulVol); 42 42 virtual MMRESULT reset(); -
trunk/src/winmm/waveoutdaud.cpp
r8202 r8568 1 /* $Id: waveoutdaud.cpp,v 1. 7 2002-04-07 14:36:32sandervl Exp $ */1 /* $Id: waveoutdaud.cpp,v 1.8 2002-06-04 17:36:56 sandervl Exp $ */ 2 2 3 3 /* … … 160 160 } 161 161 162 if(State == STATE_STOPPED) {//continue playback 163 restart(); 164 } 165 else 166 if(fUnderrun) { 167 dprintf(("Resume playback after underrun")); 162 if(State == STATE_STOPPED || fUnderrun) { 163 wmutex.enter(); 164 State = STATE_PLAYING; 168 165 fUnderrun = FALSE; 169 State = STATE_PLAYING; 170 171 // Resume the playback. 172 resume(); 166 wmutex.leave(); 167 168 if(sendIOCTL(DAUDIO_START, &cmd)) { 169 dprintf(("Unable to (re)start stream!!!!!")); 170 return MMSYSERR_ERROR; 171 } 173 172 } 174 173 return(MMSYSERR_NOERROR); … … 266 265 /******************************************************************************/ 267 266 /******************************************************************************/ 268 MMRESULT DAudioWaveOut::restart()269 {270 DAUDIO_CMD cmd;271 272 dprintf(("DAudioWaveOut::restart"));273 if(State == STATE_PLAYING)274 return(MMSYSERR_NOERROR);275 276 wmutex.enter();277 State = STATE_PLAYING;278 fUnderrun = FALSE;279 wmutex.leave();280 281 return sendIOCTL(DAUDIO_START, &cmd);282 }283 /******************************************************************************/284 /******************************************************************************/285 267 ULONG DAudioWaveOut::getPosition() 286 268 { -
trunk/src/winmm/waveoutdaud.h
r5643 r8568 1 /* $Id: waveoutdaud.h,v 1. 4 2001-04-30 21:06:56 sandervl Exp $ */1 /* $Id: waveoutdaud.h,v 1.5 2002-06-04 17:36:56 sandervl Exp $ */ 2 2 3 3 /* … … 30 30 virtual MMRESULT pause(); 31 31 virtual MMRESULT stop(); 32 virtual MMRESULT res tart();32 virtual MMRESULT resume(); 33 33 virtual MMRESULT setVolume(ULONG ulVol); 34 34 virtual MMRESULT reset(); … … 44 44 45 45 private: 46 MMRESULT resume();47 46 BOOL handler(); 48 47 MMRESULT sendIOCTL(ULONG cmd, DAUDIO_CMD *pDataPacket);
Note:
See TracChangeset
for help on using the changeset viewer.