Index: trunk/src/winmm/mixer.cpp
===================================================================
--- trunk/src/winmm/mixer.cpp	(revision 8506)
+++ trunk/src/winmm/mixer.cpp	(revision 8508)
@@ -1,3 +1,3 @@
-/* $Id: mixer.cpp,v 1.21 2002-05-28 13:35:02 sandervl Exp $ */
+/* $Id: mixer.cpp,v 1.22 2002-05-28 14:09:24 sandervl Exp $ */
 
 /*
@@ -212,4 +212,5 @@
             DWORD dwLevelL;
 
+#ifdef DEBUG
             switch(fdwDetails & MIXER_GETCONTROLDETAILSF_QUERYMASK) {
             case MIXERCONTROL_CONTROLTYPE_TREBLE:
@@ -220,4 +221,5 @@
                 break;
             }
+#endif
 
             if(OSLibMixGetVolume(mixerControls[lpmcd->dwControlID].id, &dwLevelL, NULL) == FALSE) {
Index: trunk/src/winmm/wavein.cpp
===================================================================
--- trunk/src/winmm/wavein.cpp	(revision 8506)
+++ trunk/src/winmm/wavein.cpp	(revision 8508)
@@ -1,3 +1,3 @@
-/* $Id: wavein.cpp,v 1.11 2002-05-22 15:50:26 sandervl Exp $ */
+/* $Id: wavein.cpp,v 1.12 2002-05-28 14:09:24 sandervl Exp $ */
 
 /*
@@ -47,5 +47,6 @@
         return(WAVERR_BADFORMAT);
 
-    if(fdwOpen == WAVE_FORMAT_QUERY) {
+    if(fdwOpen & WAVE_FORMAT_QUERY) 
+    {
         if(DartWaveIn::queryFormat(pwfx->wFormatTag, pwfx->nChannels, pwfx->nSamplesPerSec,
                                    pwfx->wBitsPerSample) == TRUE) 
Index: trunk/src/winmm/waveindart.cpp
===================================================================
--- trunk/src/winmm/waveindart.cpp	(revision 8506)
+++ trunk/src/winmm/waveindart.cpp	(revision 8508)
@@ -1,3 +1,3 @@
-/* $Id: waveindart.cpp,v 1.3 2002-04-07 14:36:31 sandervl Exp $ */
+/* $Id: waveindart.cpp,v 1.4 2002-05-28 14:09:25 sandervl Exp $ */
 
 /*
@@ -373,6 +373,6 @@
 ULONG DartWaveIn::getPosition()
 {
- MCI_STATUS_PARMS mciStatus = {0};
- ULONG rc, nrbytes;
+    MCI_STATUS_PARMS mciStatus = {0};
+    ULONG rc, nrbytes;
 
     mciStatus.ulItem = MCI_STATUS_POSITION;
@@ -389,7 +389,7 @@
 int DartWaveIn::getNumDevices()
 {
- MCI_GENERIC_PARMS  GenericParms;
- MCI_AMP_OPEN_PARMS AmpOpenParms;
- APIRET rc;
+    MCI_GENERIC_PARMS  GenericParms;
+    MCI_AMP_OPEN_PARMS AmpOpenParms;
+    APIRET rc;
 
    // Setup the open structure, pass the playlist and tell MCI_OPEN to use it
@@ -421,53 +421,53 @@
                              ULONG nSamplesPerSec, ULONG wBitsPerSample)
 {
- MCI_WAVE_GETDEVCAPS_PARMS mciAudioCaps;
- MCI_GENERIC_PARMS    GenericParms;
- MCI_OPEN_PARMS       mciOpenParms;         /* open parms for MCI_OPEN             */
- int i, freqbits = 0;
- ULONG rc, DeviceId;
- BOOL winrc;
-
-  dprintf(("DartWaveIn::queryFormat %x srate=%d, nchan=%d, bps=%d", formatTag, nSamplesPerSec, nChannels, wBitsPerSample));
-
-  memset(&mciOpenParms,            /* Object to fill with zeros.       */
-         0,                        /* Value to place into the object.  */
-         sizeof( mciOpenParms ) ); /* How many zero's to use.          */
-
-  mciOpenParms.pszDeviceType = (PSZ)MCI_DEVTYPE_WAVEFORM_AUDIO;
-
-  rc = mymciSendCommand( (USHORT) 0,
-                       MCI_OPEN,
-                       MCI_WAIT | MCI_OPEN_TYPE_ID,
-                       (PVOID) &mciOpenParms,
-                       0);
-  if((rc & 0xFFFF) != MCIERR_SUCCESS) {
+    MCI_WAVE_GETDEVCAPS_PARMS mciAudioCaps;
+    MCI_GENERIC_PARMS    GenericParms;
+    MCI_OPEN_PARMS       mciOpenParms;         /* open parms for MCI_OPEN             */
+    int i, freqbits = 0;
+    ULONG rc, DeviceId;
+    BOOL winrc;
+
+    dprintf(("DartWaveIn::queryFormat %x srate=%d, nchan=%d, bps=%d", formatTag, nSamplesPerSec, nChannels, wBitsPerSample));
+
+    memset(&mciOpenParms,            /* Object to fill with zeros.       */
+           0,                        /* Value to place into the object.  */
+           sizeof( mciOpenParms ) ); /* How many zero's to use.          */
+
+    mciOpenParms.pszDeviceType = (PSZ)MCI_DEVTYPE_WAVEFORM_AUDIO;
+
+    rc = mymciSendCommand( (USHORT) 0,
+                          MCI_OPEN,
+                          MCI_WAIT | MCI_OPEN_TYPE_ID,
+                          (PVOID) &mciOpenParms,
+                          0);
+    if((rc & 0xFFFF) != MCIERR_SUCCESS) {
         mciError(rc);
         return(FALSE);
-  }
-  DeviceId = mciOpenParms.usDeviceID;
-
-  memset( &mciAudioCaps , 0, sizeof(MCI_WAVE_GETDEVCAPS_PARMS));
-
-  mciAudioCaps.ulBitsPerSample = wBitsPerSample;
-  mciAudioCaps.ulFormatTag     = DATATYPE_WAVEFORM;
-  mciAudioCaps.ulSamplesPerSec = nSamplesPerSec;
-  mciAudioCaps.ulChannels      = nChannels;
-  mciAudioCaps.ulFormatMode    = MCI_RECORD;
-  mciAudioCaps.ulItem          = MCI_GETDEVCAPS_WAVE_FORMAT;
-
-  rc = mymciSendCommand(DeviceId,   /* Device ID    */
-                      MCI_GETDEVCAPS,
-                      MCI_WAIT | MCI_GETDEVCAPS_EXTENDED | MCI_GETDEVCAPS_ITEM,
-                      (PVOID) &mciAudioCaps,
-                      0);
-  if((rc & 0xFFFF) != MCIERR_SUCCESS) {
+    }
+    DeviceId = mciOpenParms.usDeviceID;
+
+    memset( &mciAudioCaps , 0, sizeof(MCI_WAVE_GETDEVCAPS_PARMS));
+
+    mciAudioCaps.ulBitsPerSample = wBitsPerSample;
+    mciAudioCaps.ulFormatTag     = DATATYPE_WAVEFORM;
+    mciAudioCaps.ulSamplesPerSec = nSamplesPerSec;
+    mciAudioCaps.ulChannels      = nChannels;
+    mciAudioCaps.ulFormatMode    = MCI_RECORD;
+    mciAudioCaps.ulItem          = MCI_GETDEVCAPS_WAVE_FORMAT;
+
+    rc = mymciSendCommand(DeviceId,   /* Device ID    */
+                          MCI_GETDEVCAPS,
+                          MCI_WAIT | MCI_GETDEVCAPS_EXTENDED | MCI_GETDEVCAPS_ITEM,
+                          (PVOID) &mciAudioCaps,
+                          0);
+    if((rc & 0xFFFF) != MCIERR_SUCCESS) {
         mciError(rc);
         winrc = FALSE;
-  }
-  else  winrc = TRUE;
-
-  // Close the device
-  mymciSendCommand(DeviceId,MCI_CLOSE,MCI_WAIT,(PVOID)&GenericParms,0);
-  return(winrc);
+    }
+    else  winrc = TRUE;
+
+    // Close the device
+    mymciSendCommand(DeviceId,MCI_CLOSE,MCI_WAIT,(PVOID)&GenericParms,0);
+    return(winrc);
 }
 /******************************************************************************/
@@ -489,6 +489,5 @@
 void DartWaveIn::handler(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags)
 {
- ULONG    buflength, bufpos, bytestocopy;
- WAVEHDR *whdr, *prevhdr = NULL;
+    ULONG    buflength, bufpos, bytestocopy;
 
     dprintf2(("WINMM: DartWaveIn handler %x\n", pBuffer));
@@ -507,6 +506,5 @@
     wmutex.enter();
 
-    whdr = wavehdr;
-    if(whdr == NULL) {
+    if(wavehdr == NULL) {
         wmutex.leave();
         //last buffer recorded -> no new ones -> overrun
@@ -520,4 +518,5 @@
     while(buflength) {
         if(wavehdr) {
+            dprintf2(("WINMM: DartWaveIn handler: bytes recorded %d, buffer length %d, room %d", buflength, wavehdr->dwBufferLength, wavehdr->dwBytesRecorded));
             bytestocopy = min(buflength, wavehdr->dwBufferLength - wavehdr->dwBytesRecorded);
             if(bytestocopy) {
@@ -532,4 +531,6 @@
             if(wavehdr->dwBytesRecorded == wavehdr->dwBufferLength)
             {
+                WAVEHDR *whdr = wavehdr;
+
                 dprintf2(("WINMM: DartWaveIn handler buf %X done\n", whdr));
                 whdr->dwFlags |= WHDR_DONE;
@@ -552,5 +553,5 @@
     // MCI_MIXSETUP_PARMS->pMixWrite does alter FS: selector!
     USHORT selTIB = GetFS(); // save current FS selector
-    MixSetupParms->pmixWrite(MixSetupParms->ulMixHandle, pBuffer, 1);
+    MixSetupParms->pmixRead(MixSetupParms->ulMixHandle, pBuffer, 1);
     SetFS(selTIB);           // switch back to the saved FS selector
 }
Index: trunk/src/winmm/waveout.cpp
===================================================================
--- trunk/src/winmm/waveout.cpp	(revision 8506)
+++ trunk/src/winmm/waveout.cpp	(revision 8508)
@@ -1,3 +1,3 @@
-/* $Id: waveout.cpp,v 1.23 2002-05-22 15:50:26 sandervl Exp $ */
+/* $Id: waveout.cpp,v 1.24 2002-05-28 14:09:25 sandervl Exp $ */
 //#undef DEBUG
 /*
@@ -49,5 +49,5 @@
         return(WAVERR_BADFORMAT);
 
-    if(fdwOpen == WAVE_FORMAT_QUERY)
+    if(fdwOpen & WAVE_FORMAT_QUERY) 
     {
         if(DartWaveOut::queryFormat(pwfx->wFormatTag, pwfx->nChannels, pwfx->nSamplesPerSec,
