Changeset 4687 for trunk/src


Ignore:
Timestamp:
Nov 24, 2000, 1:14:07 PM (25 years ago)
Author:
phaller
Message:

Fix FS: in pmixWrite

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/winmm/dwaveout.cpp

    r4172 r4687  
    1 /* $Id: dwaveout.cpp,v 1.29 2000-09-03 09:35:14 sandervl Exp $ */
     1/* $Id: dwaveout.cpp,v 1.30 2000-11-24 12:14:07 phaller Exp $ */
    22
    33/*
     
    88 *
    99 * Project Odin Software License can be found in LICENSE.TXT
     10 *
     11 * Note:
     12 * 2000/11/24 PH MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector!
    1013 *
    1114 */
     
    424427
    425428        //write buffers to DART; starts playback
    426         MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle,
    427                                  MixBuffer,
    428                                  PREFILLBUF_DART);
     429        {
     430          // MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector!
     431          USHORT selTIB = GetFS(); // save current FS selector
     432
     433          MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle,
     434                                   MixBuffer,
     435                                   PREFILLBUF_DART);
     436          SetFS(selTIB);           // switch back to the saved FS selector
     437        }
    429438        dprintf(("Dart playing\n"));
    430439  }
     
    516525MMRESULT DartWaveOut::restart()
    517526{
    518  int i, curbuf;
    519 
    520     dprintf(("DartWaveOut::restart"));
    521     if(State == STATE_PLAYING) {
    522         return(MMSYSERR_NOERROR);
     527  int i, curbuf;
     528
     529  dprintf(("DartWaveOut::restart"));
     530  if(State == STATE_PLAYING)
     531    return(MMSYSERR_NOERROR);
     532
     533  //Only write buffers to dart if mixer has been initialized; if not, then
     534  //the first buffer write will do this for us.
     535  if(fMixerSetup == TRUE)
     536  {
     537    wmutex->enter(VMUTEX_WAIT_FOREVER);
     538    State     = STATE_PLAYING;
     539    fUnderrun = FALSE;
     540    wmutex->leave();
     541    curbuf = curPlayBuf;
     542   
     543    // MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector!
     544    USHORT selTIB = GetFS(); // save current FS selector
     545   
     546    for(i=0;i<PREFILLBUF_DART;i++)
     547    {
     548      MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle, &MixBuffer[curbuf], 1);
     549      if(++curbuf == PREFILLBUF_DART)
     550        curbuf = 0;
    523551    }
    524     //Only write buffers to dart if mixer has been initialized; if not, then
    525     //the first buffer write will do this for us.
    526     if(fMixerSetup == TRUE) {
    527         wmutex->enter(VMUTEX_WAIT_FOREVER);
    528         State     = STATE_PLAYING;
    529         fUnderrun = FALSE;
    530         wmutex->leave();
    531         curbuf = curPlayBuf;
    532 
    533         for(i=0;i<PREFILLBUF_DART;i++) {
    534                 MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle, &MixBuffer[curbuf], 1);
    535                 if(++curbuf == PREFILLBUF_DART) {
    536                         curbuf = 0;
    537                 }
    538         }
    539     }
    540     return(MMSYSERR_NOERROR);
     552   
     553    SetFS(selTIB);           // switch back to the saved FS selector
     554  }
     555  return(MMSYSERR_NOERROR);
    541556}
    542557/******************************************************************************/
     
    747762
    748763  wmutex->leave();
     764 
    749765  //Transfer buffer to DART
     766  // MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector!
     767  USHORT selTIB = GetFS(); // save current FS selector
    750768  MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle, &MixBuffer[curPlayBuf], 1);
     769  SetFS(selTIB);           // switch back to the saved FS selector
    751770}
    752771/******************************************************************************/
Note: See TracChangeset for help on using the changeset viewer.