Index: pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/wmme_dev.c
===================================================================
--- pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/wmme_dev.c	(revision 2474)
+++ pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/wmme_dev.c	(revision 2488)
@@ -19,5 +19,4 @@
  */
 #include <pjmedia-audiodev/audiodev_imp.h>
-#include <pjmedia/errno.h>
 #include <pj/assert.h>
 #include <pj/log.h>
@@ -25,4 +24,7 @@
 #include <pj/string.h>
 #include <pj/unicode.h>
+
+#if PJMEDIA_AUDIO_DEV_HAS_WMME
+
 #ifdef _MSC_VER
 #   pragma warning(push, 3)
@@ -168,10 +170,4 @@
 };
 
-/* Utility: convert MMERROR to pj_status_t */
-PJ_INLINE(pj_status_t) CONVERT_MM_ERROR(MMRESULT mr)
-{
-    return PJ_RETURN_OS_ERROR(mr);
-}
-
 
 /****************************************************************************
@@ -548,5 +544,5 @@
 		     &wfx, (DWORD)wmme_strm->hEvent, 0, CALLBACK_EVENT);
     if (mr != MMSYSERR_NOERROR) {
-	return CONVERT_MM_ERROR(mr);
+	return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr);
     }
 
@@ -554,5 +550,5 @@
     mr = waveOutPause(wmme_strm->hWave.Out);
     if (mr != MMSYSERR_NOERROR) {
-	return CONVERT_MM_ERROR(mr);
+	return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr);
     }
 
@@ -570,10 +566,10 @@
 				  sizeof(WAVEHDR));
 	if (mr != MMSYSERR_NOERROR) {
-	    return CONVERT_MM_ERROR(mr); 
+	    return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr); 
 	}
 	mr = waveOutWrite(wmme_strm->hWave.Out, &(wmme_strm->WaveHdr[i]), 
 			  sizeof(WAVEHDR));
 	if (mr != MMSYSERR_NOERROR) {
-	    return CONVERT_MM_ERROR(mr);
+	    return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr);
 	}
     }
@@ -634,5 +630,5 @@
 		    &wfx, (DWORD)wmme_strm->hEvent, 0, CALLBACK_EVENT);
     if (mr != MMSYSERR_NOERROR) {
-	return CONVERT_MM_ERROR(mr);
+	return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_IN(mr);
     }
 
@@ -650,10 +646,10 @@
 				 sizeof(WAVEHDR));
 	if (mr != MMSYSERR_NOERROR) {
-	    return CONVERT_MM_ERROR(mr);
+	    return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_IN(mr);
 	}
 	mr = waveInAddBuffer(wmme_strm->hWave.In, &(wmme_strm->WaveHdr[i]), 
 			     sizeof(WAVEHDR));
 	if (mr != MMSYSERR_NOERROR) {
-	    return CONVERT_MM_ERROR(mr);
+	    return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_IN(mr);
 	}
     }
@@ -831,5 +827,5 @@
 				  sizeof(WAVEHDR));
 		if (mr != MMSYSERR_NOERROR) {
-		    status = CONVERT_MM_ERROR(mr);
+		    status = PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr);
 		    break;
 		}
@@ -928,5 +924,5 @@
 				     sizeof(WAVEHDR));
 		if (mr != MMSYSERR_NOERROR) {
-		    status = CONVERT_MM_ERROR(mr);
+		    status = PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_IN(mr);
 		    break;
 		}
@@ -1147,5 +1143,5 @@
 	mr = waveOutGetVolume(strm->play_strm.hWave.Out, &dwVol);
 	if (mr != MMSYSERR_NOERROR) {
-	    return CONVERT_MM_ERROR(mr);
+	    return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr);
 	}
 
@@ -1178,5 +1174,6 @@
 
 	mr = waveOutSetVolume(strm->play_strm.hWave.Out, dwVol);
-	return (mr==MMSYSERR_NOERROR)? PJ_SUCCESS : CONVERT_MM_ERROR(mr);
+	return (mr==MMSYSERR_NOERROR)? PJ_SUCCESS : 
+				PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr);
     } else {
 	return PJ_ENOTSUP;
@@ -1196,5 +1193,5 @@
 	mr = waveOutRestart(stream->play_strm.hWave.Out);
 	if (mr != MMSYSERR_NOERROR) {
-	    return CONVERT_MM_ERROR(mr);
+	    return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr);
 	}
 	PJ_LOG(4,(THIS_FILE, "WMME playback stream started"));
@@ -1205,5 +1202,5 @@
 	mr = waveInStart(stream->rec_strm.hWave.In);
 	if (mr != MMSYSERR_NOERROR) {
-	    return CONVERT_MM_ERROR(mr);
+	    return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_IN(mr);
 	}
 	PJ_LOG(4,(THIS_FILE, "WMME capture stream started"));
@@ -1225,5 +1222,5 @@
 	mr = waveOutPause(stream->play_strm.hWave.Out);
 	if (mr != MMSYSERR_NOERROR) {
-	    return CONVERT_MM_ERROR(mr);
+	    return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr);
 	}
 	PJ_LOG(4,(THIS_FILE, "Stopped WMME playback stream"));
@@ -1234,5 +1231,5 @@
 	mr = waveInStop(stream->rec_strm.hWave.In);
 	if (mr != MMSYSERR_NOERROR) {
-	    return CONVERT_MM_ERROR(mr);
+	    return PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_IN(mr);
 	}
 	PJ_LOG(4,(THIS_FILE, "Stopped WMME capture stream"));
@@ -1304,2 +1301,4 @@
 }
 
+#endif	/* PJMEDIA_AUDIO_DEV_HAS_WMME */
+
