fix for esddsp, which does not implement the SNDCTL_DSP_CHANNELS ioctl

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@759 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Michael Gernoth 2004-09-03 18:04:48 +00:00
parent 942ba6ccb6
commit ee5f4b0a7a

View File

@ -85,7 +85,7 @@ wave_out_format_supported(WAVEFORMATEX * pwfx)
BOOL
wave_out_set_format(WAVEFORMATEX * pwfx)
{
int channels, format;
int stereo, format;
ioctl(g_dsp_fd, SNDCTL_DSP_RESET, NULL);
ioctl(g_dsp_fd, SNDCTL_DSP_SYNC, NULL);
@ -104,19 +104,23 @@ wave_out_set_format(WAVEFORMATEX * pwfx)
return False;
}
channels = pwfx->nChannels;
if (ioctl(g_dsp_fd, SNDCTL_DSP_CHANNELS, &channels) == -1)
if (pwfx->nChannels == 2)
{
stereo = 1;
g_samplewidth *= 2;
}
else
{
stereo = 0;
}
if (ioctl(g_dsp_fd, SNDCTL_DSP_STEREO, &stereo) == -1)
{
perror("SNDCTL_DSP_CHANNELS");
close(g_dsp_fd);
return False;
}
if (channels == 2)
{
g_samplewidth *= 2;
}
g_snd_rate = pwfx->nSamplesPerSec;
if (ioctl(g_dsp_fd, SNDCTL_DSP_SPEED, &g_snd_rate) == -1)
{