Commit 1d834f47 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Fix the check for SNDCTL_DSP_GETCAPS so that it is compliant with the

OSS specification. Only test the different formats if tracing is on.
parent 5ea386e7
......@@ -869,7 +869,7 @@ static BOOL OSS_WaveInInit(OSS_DEVICE* ossdev)
ossdev->dsc_caps.dwFormats = 0x00000000;
ossdev->dsc_caps.dwChannels = 1;
/* See the comment in OSS_WaveOutInit */
/* See the comment in OSS_WaveOutInit for the loop order */
for (f=0;f<2;f++) {
arg=win_std_oss_fmts[f];
rc=ioctl(ossdev->fd, SNDCTL_DSP_SAMPLESIZE, &arg);
......@@ -933,17 +933,31 @@ static void OSS_WaveFullDuplexInit(OSS_DEVICE* ossdev)
int caps;
TRACE("(%p) %s\n", ossdev, ossdev->dev_name);
if (OSS_OpenDevice(ossdev, O_RDWR, NULL, 0,-1,-1,-1) != 0)
/* The OSS documentation says we must call SNDCTL_SETDUPLEX
* *before* checking for SNDCTL_DSP_GETCAPS otherwise we may
* get the wrong result. This ioctl must even be done before
* setting the fragment size so that only OSS_RawOpenDevice is
* in a position to do it. So we set full_duplex speculatively
* and adjust right after.
*/
ossdev->full_duplex=1;
rc=OSS_OpenDevice(ossdev, O_RDWR, NULL, 0,-1,-1,-1);
ossdev->full_duplex=0;
if (rc != 0)
return;
ioctl(ossdev->fd, SNDCTL_DSP_RESET, 0);
TRACE("%s\n", ossdev->ds_desc.szDesc);
if (ioctl(ossdev->fd, SNDCTL_DSP_GETCAPS, &caps) == 0)
ossdev->full_duplex = (caps & DSP_CAP_DUPLEX);
if (WINE_TRACE_ON(wave))
{
OSS_Info(ossdev->fd);
/* See the comment in OSS_WaveOutInit */
/* See the comment in OSS_WaveOutInit for the loop order */
for (f=0;f<2;f++) {
arg=win_std_oss_fmts[f];
rc=ioctl(ossdev->fd, SNDCTL_DSP_SAMPLESIZE, &arg);
......@@ -969,10 +983,7 @@ static void OSS_WaveFullDuplexInit(OSS_DEVICE* ossdev)
}
}
}
if (ioctl(ossdev->fd, SNDCTL_DSP_GETCAPS, &caps) == 0)
ossdev->full_duplex = (caps & DSP_CAP_DUPLEX);
}
OSS_CloseDevice(ossdev);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment