[Sumover-dev] [svn commit] r3854 - rat/trunk
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Wed Sep 13 13:58:40 BST 2006
Author: piers
Date: Wed Sep 13 13:57:44 2006
New Revision: 3854
Modified:
rat/trunk/auddev_win32.c
Log:
Two changes:
1) nLoopGain back to 100 - Otherwise the user does not hear anything with just 'Listen' enabled - They only heard things when 'Talk' was clicked.
2) Changed EnterCriticalSection() call to TryEnterCriticalSection() to minimise thread blocking in audio processing. This requires a special define: _WIN32_WINNT 0x0500 - as this Try.. call is only enabled at this windows version (and above). See;
http://windowssdk.msdn.microsoft.com/en-gb/library/ms736959.aspx
Modified: rat/trunk/auddev_win32.c
==============================================================================
--- rat/trunk/auddev_win32.c (original)
+++ rat/trunk/auddev_win32.c Wed Sep 13 13:57:44 2006
@@ -17,6 +17,12 @@
#ifdef WIN32
+/* Set _WIN32_WINNT to 0x500 to indicate win2000 and above
+ Needed for TryEnterCriticalSection() */
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#endif
+
#include "config_win32.h"
#include "audio.h"
#include "debug.h"
@@ -37,7 +43,7 @@
static int error = 0;
static char errorText[MAXERRORLENGTH];
-static int nLoopGain = 0;
+static int nLoopGain = 100;
#define MAX_DEV_NAME 64
static UINT mapAudioDescToMixerID(audio_desc_t ad);
@@ -1149,7 +1155,8 @@
/* we do this so the device blksz does not have to match application */
/* blksz. I.e. can reduce process usage by using larger blocks at */
/* device whilst the app operates on smaller blocks. */
- EnterCriticalSection(&CriticalSection );
+ if (!TryEnterCriticalSection(&CriticalSection )) return 0;
+ //EnterCriticalSection(&CriticalSection );
while(whReadList != NULL && done < buf_bytes) {
whCur = whReadList;
More information about the Sumover-dev
mailing list