Ignore:
Timestamp:
Mar 8, 2000, 7:26:49 PM (25 years ago)
Author:
mike
Message:

Killed no longer needed files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/dsound/new/dart.cpp

    r3035 r3044  
    2525static long               lLastBuff;
    2626static char               *pDSoundBuff;
     27static BOOL               fIsPlaying = FALSE;
    2728
    2829USHORT               usDeviceID;                 /* Amp Mixer device id          */
     
    7071   MCI_AMP_OPEN_PARMS  AmpOpenParms;
    7172   //MCI_WAVE_SET_PARMS WaveSetParms;
    72    ULONG   rc;
     73   ULONG   rc, ulNew;
     74   LONG    lAdd = 5;
    7375   short   device = 0;
    7476
    7577   dprintf(("DSOUND-DART: Dart_Open_Device"));
     78
     79   DosSetRelMaxFH(&lAdd, &ulNew);
    7680
    7781   *vpMixBuffer    = &MixBuffers;
     
    175179   MCI_MIXSETUP_PARMS  *MixSetup;
    176180   MCI_BUFFER_PARMS    *BufferParms;
     181   ULONG               rc;
    177182
    178183   dprintf(("DSOUND-DART: Dart_Close_Device"));
     
    182187   BufferParms = (MCI_BUFFER_PARMS*)vpBuffParms;
    183188
    184     if (MixBuffer->pBuffer) {
    185        mciSendCommand(usDeviceID,MCI_BUFFER,MCI_WAIT|MCI_DEALLOCATE_MEMORY, BufferParms,0);
    186        MixBuffer->pBuffer=NULL;
    187     }
    188     if (usDeviceID) {
    189         mciSendCommand(usDeviceID,MCI_CLOSE,MCI_WAIT, NULL, 0);
    190         usDeviceID=0;
    191     }
     189   rc = mciSendCommand(usDeviceID, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, BufferParms, 0);
     190   if (rc != MCIERR_SUCCESS) {
     191      dprintf(("DSOUND-DART: MCI_BUFFER (Close) %d", rc));
     192   }
     193   rc = mciSendCommand(usDeviceID, MCI_CLOSE, MCI_WAIT, NULL, 0);
     194   if (rc != MCIERR_SUCCESS) {
     195      dprintf(("DSOUND-DART: MCI_CLOSE (Close) %d", rc));
     196   }
    192197
    193198   dprintf(("DSOUND-DART: Dart_Close_Device returning DS_OK"));
     
    301306   }
    302307
     308   /* If the primary buffer was playing, we have to restart it!! */
     309   if (fIsPlaying) {
     310      dprintf(("DSOUND-DART: Restarting playback!!!!"));
     311
     312      /* Mix the first buffer before playing */
     313      MixCallback(BUFFER_SIZE/NUM_DART_BUFFS);
     314      memcpy(pMixBuffs[lLastBuff].pBuffer, &pDSoundBuff[lLastBuff*(BUFFER_SIZE/NUM_DART_BUFFS)], BUFFER_SIZE/NUM_DART_BUFFS);
     315
     316      USHORT  sel = RestoreOS2FS();
     317      /* Note: the call to pmixWrite trashes the FS selector, we have to save */
     318      /* and then restore FS!!! Otherwise exception handling will be broken.  */
     319      MixSetupParms.pmixWrite(MixSetupParms.ulMixHandle, MixBuffers, 2);
     320      SetFS(sel);
     321      fIsPlaying = TRUE;
     322   }
     323
    303324   return DS_OK;
    304325}
     
    311332   dprintf(("DSOUND-DART: Dart_Stop"));
    312333
     334   if (!fIsPlaying)
     335      return DS_OK;
     336
     337   fIsPlaying = FALSE;
    313338//   rc = mciSendCommand(usDeviceID, MCI_PAUSE, MCI_WAIT, NULL, 0);
    314339   rc = mciSendCommand(usDeviceID, MCI_STOP, MCI_WAIT, NULL, 0);
     
    349374      MixSetupParms.pmixWrite(MixSetupParms.ulMixHandle, MixBuffers, 2);
    350375      SetFS(sel);
    351    }
    352 
    353    return DS_OK;
    354 }
     376      fIsPlaying = TRUE;
     377   }
     378
     379   return DS_OK;
     380}
Note: See TracChangeset for help on using the changeset viewer.