aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/oss.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-10-20 12:28:51 -0700
committerChris Robinson <[email protected]>2009-10-20 12:28:51 -0700
commit4461b4c56f784de375dcd37651fa4a8c740ad1b2 (patch)
tree7a2ee71b1972687e45d293c9a89405066248eec0 /Alc/oss.c
parent93361118b7b8c1417e4a717d94818764fb5ffe9e (diff)
Be more tolerant with resetting the fragment size
Diffstat (limited to 'Alc/oss.c')
-rw-r--r--Alc/oss.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Alc/oss.c b/Alc/oss.c
index b5adfcbe..63c92333 100644
--- a/Alc/oss.c
+++ b/Alc/oss.c
@@ -237,8 +237,10 @@ static ALCboolean oss_reset_playback(ALCdevice *device)
numFragmentsLogSize = (periods << 16) | log2FragmentSize;
#define ok(func, str) (i=(func),((i<0)?(err=(str)),0:1))
- if (!(ok(ioctl(data->fd, SNDCTL_DSP_SETFRAGMENT, &numFragmentsLogSize), "set fragment") &&
- ok(ioctl(data->fd, SNDCTL_DSP_SETFMT, &ossFormat), "set format") &&
+ /* Don't fail if SETFRAGMENT fails. We can handle just about anything
+ * that's reported back via GETOSPACE */
+ ioctl(data->fd, SNDCTL_DSP_SETFRAGMENT, &numFragmentsLogSize);
+ if (!(ok(ioctl(data->fd, SNDCTL_DSP_SETFMT, &ossFormat), "set format") &&
ok(ioctl(data->fd, SNDCTL_DSP_CHANNELS, &numChannels), "set channels") &&
ok(ioctl(data->fd, SNDCTL_DSP_SPEED, &ossSpeed), "set speed") &&
ok(ioctl(data->fd, SNDCTL_DSP_GETOSPACE, &info), "get space")))
@@ -290,6 +292,9 @@ static void oss_stop_playback(ALCdevice *device)
StopThread(data->thread);
data->thread = NULL;
+ if(ioctl(data->fd, SNDCTL_DSP_RESET) != 0)
+ AL_PRINT("Error resetting device: %s\n", strerror(errno));
+
free(data->mix_data);
data->mix_data = NULL;
}