- Fixes multiple crashes in PortAudio.
- Removes the DirectSound support from PortAudio in order to prevent
issues with bad audio quality.
- Attempts to recognize USB PortAudio devices on Windows as such,
ignores the virtual Microsoft Sound Mapper devices to avoid user
confusion. Contributed by Vincent Lucas.
lyubomir committed on Nov 15, 2012
a93910c from
https://github.com/jitsi/libsrc/commits/master/portaudio.zip
This commit is contained in:
parent
15d77417bf
commit
6c6269425f
2 changed files with 44 additions and 3 deletions
|
|
@ -59,8 +59,12 @@
|
|||
|
||||
#ifdef __GNUC__
|
||||
#include <initguid.h>
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#define WINVER 0x0501
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif /* #ifndef _WIN32_WINNT */
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x0501
|
||||
#endif /* #ifndef WINVER */
|
||||
#endif
|
||||
|
||||
#include <string.h> /* strlen() */
|
||||
|
|
@ -76,7 +80,7 @@
|
|||
#include "pa_debugprint.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
/* #include <winioctl.h> MinGW-w64 4.7.1 from TDM-GCC throws multiple redefinition errors. */
|
||||
#include <process.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
|
|||
|
|
@ -383,6 +383,25 @@ static PaError CloseHandleWithPaError( HANDLE handle )
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the <tt>transportType</tt> of a specific <tt>PaDeviceInfo</tt> to a
|
||||
* value deduced by examining the other fields of the specified
|
||||
* <tt>PaDeviceInfo</tt>. For example, if <tt>name</tt> field matches the
|
||||
* regular expression <tt>\(.*USB.*\)</tt>, the <tt>transportType</tt> is set to
|
||||
* <tt>USB</tt>.
|
||||
*
|
||||
* @param deviceInfo the <tt>PaDeviceInfo</tt> to set the <tt>transportType</tt>
|
||||
* of
|
||||
*/
|
||||
static void SetDeviceInfoTransportType(PaDeviceInfo *deviceInfo)
|
||||
{
|
||||
const char *s = deviceInfo->name;
|
||||
|
||||
deviceInfo->transportType
|
||||
= (s && (s = strrchr(s,'(')) && (s = strstr(s,"USB")) && strchr(s,')'))
|
||||
? "USB"
|
||||
: NULL;
|
||||
}
|
||||
|
||||
/* PaWinMmeHostApiRepresentation - host api datastructure specific to this implementation */
|
||||
|
||||
|
|
@ -688,6 +707,12 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH
|
|||
|
||||
*success = 0;
|
||||
|
||||
/* We do not want Microsoft's Sound Mapper because it is a virtual device
|
||||
* and we want the real (hardware) devices only.
|
||||
*/
|
||||
if (WAVE_MAPPER == winMmeInputDeviceId)
|
||||
return paNoError;
|
||||
|
||||
mmresult = waveInGetDevCaps( winMmeInputDeviceId, &wic, sizeof( WAVEINCAPS ) );
|
||||
if( mmresult == MMSYSERR_NOMEM )
|
||||
{
|
||||
|
|
@ -730,6 +755,9 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH
|
|||
}
|
||||
deviceInfo->name = deviceName;
|
||||
|
||||
/* transportType */
|
||||
SetDeviceInfoTransportType(deviceInfo);
|
||||
|
||||
if( wic.wChannels == 0xFFFF || wic.wChannels < 1 || wic.wChannels > 255 ){
|
||||
/* For Windows versions using WDM (possibly Windows 98 ME and later)
|
||||
* the kernel mixer sits between the application and the driver. As a result,
|
||||
|
|
@ -856,6 +884,12 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme
|
|||
|
||||
*success = 0;
|
||||
|
||||
/* We do not want Microsoft's Sound Mapper because it is a virtual device
|
||||
* and we want the real (hardware) devices only.
|
||||
*/
|
||||
if (WAVE_MAPPER == winMmeOutputDeviceId)
|
||||
return paNoError;
|
||||
|
||||
mmresult = waveOutGetDevCaps( winMmeOutputDeviceId, &woc, sizeof( WAVEOUTCAPS ) );
|
||||
if( mmresult == MMSYSERR_NOMEM )
|
||||
{
|
||||
|
|
@ -898,6 +932,9 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme
|
|||
}
|
||||
deviceInfo->name = deviceName;
|
||||
|
||||
/* transportType */
|
||||
SetDeviceInfoTransportType(deviceInfo);
|
||||
|
||||
if( woc.wChannels == 0xFFFF || woc.wChannels < 1 || woc.wChannels > 255 ){
|
||||
/* For Windows versions using WDM (possibly Windows 98 ME and later)
|
||||
* the kernel mixer sits between the application and the driver. As a result,
|
||||
|
|
|
|||
Loading…
Reference in a new issue