winecfg: Added support for auto detecting all drivers by attempting to
open them.
This commit is contained in:
parent
d52dafb5cc
commit
f6a7b6b59a
|
@ -426,69 +426,33 @@ static void initAudioDlg (HWND hDlg)
|
|||
|
||||
static const char *audioAutoDetect(void)
|
||||
{
|
||||
struct stat buf;
|
||||
const char *argv_new[4];
|
||||
int fd;
|
||||
|
||||
const char *driversFound[10];
|
||||
const char *name[10];
|
||||
int numFound = 0,i;
|
||||
int numFound = 0;
|
||||
const AUDIO_DRIVER *pAudioDrv = NULL;
|
||||
int i;
|
||||
|
||||
argv_new[0] = "/bin/sh";
|
||||
argv_new[1] = "-c";
|
||||
argv_new[3] = NULL;
|
||||
pAudioDrv = getAudioDrivers();
|
||||
|
||||
/* try to detect oss */
|
||||
fd = open("/dev/dsp", O_WRONLY | O_NONBLOCK);
|
||||
if(fd)
|
||||
for (i = 0; *pAudioDrv->szName; i++, pAudioDrv++)
|
||||
{
|
||||
close(fd);
|
||||
driversFound[numFound] = "oss";
|
||||
name[numFound] = "OSS";
|
||||
if (strlen(pAudioDrv->szDriver))
|
||||
{
|
||||
HDRVR hdrv;
|
||||
char driver[MAX_PATH];
|
||||
|
||||
sprintf(driver, "wine%s.drv", pAudioDrv->szDriver);
|
||||
|
||||
if ((hdrv = OpenDriverA(driver, 0, 0)))
|
||||
{
|
||||
CloseDriver(hdrv, 0, 0);
|
||||
driversFound[numFound] = pAudioDrv->szDriver;
|
||||
name[numFound] = pAudioDrv->szName;
|
||||
numFound++;
|
||||
}
|
||||
|
||||
/* try to detect alsa */
|
||||
if(!stat("/proc/asound", &buf))
|
||||
{
|
||||
driversFound[numFound] = "alsa";
|
||||
name[numFound] = "ALSA";
|
||||
numFound++;
|
||||
}
|
||||
|
||||
/* try to detect arts */
|
||||
argv_new[2] = "ps awx|grep artsd|grep -v grep|grep artsd > /dev/null";
|
||||
if(!spawnvp(_P_WAIT, "/bin/sh", argv_new))
|
||||
{
|
||||
driversFound[numFound] = "arts";
|
||||
name[numFound] = "aRts";
|
||||
numFound++;
|
||||
}
|
||||
|
||||
/* try to detect jack */
|
||||
argv_new[2] = "ps awx|grep jackd|grep -v grep|grep jackd > /dev/null";
|
||||
if(!spawnvp(_P_WAIT, "/bin/sh", argv_new))
|
||||
{
|
||||
driversFound[numFound] = "jack";
|
||||
name[numFound] = "JACK";
|
||||
numFound++;
|
||||
}
|
||||
|
||||
/* try to detect EsounD */
|
||||
argv_new[2] = "ps awx|grep esd|grep -v grep|grep esd > /dev/null";
|
||||
if(!spawnvp(_P_WAIT, "/bin/sh", argv_new))
|
||||
{
|
||||
driversFound[numFound] = "esd";
|
||||
name[numFound] = "EsounD";
|
||||
numFound++;
|
||||
}
|
||||
|
||||
/* try to detect nas */
|
||||
/* TODO */
|
||||
|
||||
/* try to detect audioIO (solaris) */
|
||||
/* TODO */
|
||||
|
||||
if(numFound == 0)
|
||||
{
|
||||
MessageBox(NULL, "Could not detect any audio devices/servers", "Failed", MB_OK);
|
||||
|
|
Loading…
Reference in New Issue