mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-24 21:12:27 +00:00
make the rw selection do the right thing elsewhere
This commit is contained in:
parent
d90d3d0de3
commit
a90f8132a7
1 changed files with 6 additions and 3 deletions
|
@ -81,19 +81,22 @@ SNDDMA_Init (void)
|
||||||
int caps;
|
int caps;
|
||||||
int retries = 3;
|
int retries = 3;
|
||||||
int omode = O_WRONLY;
|
int omode = O_WRONLY;
|
||||||
|
int mmmode = PROT_WRITE;
|
||||||
|
|
||||||
snd_inited = 0;
|
snd_inited = 0;
|
||||||
|
|
||||||
// open /dev/dsp, confirm capability to mmap, and get size of dma buffer
|
// open /dev/dsp, confirm capability to mmap, and get size of dma buffer
|
||||||
if (COM_CheckParm ("-sndrw"))
|
if (COM_CheckParm ("-sndrw")) {
|
||||||
omode = O_RDWR;
|
omode = O_RDWR;
|
||||||
|
mmmode |= PROT_READ;
|
||||||
|
}
|
||||||
audio_fd = open ("/dev/dsp", omode);
|
audio_fd = open ("/dev/dsp", omode);
|
||||||
if (audio_fd < 0) { // Failed open, retry up to 3 times
|
if (audio_fd < 0) { // Failed open, retry up to 3 times
|
||||||
// if it's busy
|
// if it's busy
|
||||||
while ((audio_fd < 0) && retries-- &&
|
while ((audio_fd < 0) && retries-- &&
|
||||||
((errno == EAGAIN) || (errno == EBUSY))) {
|
((errno == EAGAIN) || (errno == EBUSY))) {
|
||||||
sleep (1);
|
sleep (1);
|
||||||
audio_fd = open ("/dev/dsp", O_RDWR);
|
audio_fd = open ("/dev/dsp", omode);
|
||||||
}
|
}
|
||||||
if (audio_fd < 0) {
|
if (audio_fd < 0) {
|
||||||
perror ("/dev/dsp");
|
perror ("/dev/dsp");
|
||||||
|
@ -180,7 +183,7 @@ SNDDMA_Init (void)
|
||||||
// memory map the dma buffer
|
// memory map the dma buffer
|
||||||
shm->buffer = (unsigned char *) mmap (NULL, info.fragstotal
|
shm->buffer = (unsigned char *) mmap (NULL, info.fragstotal
|
||||||
* info.fragsize,
|
* info.fragsize,
|
||||||
PROT_READ | PROT_WRITE,
|
mmmode,
|
||||||
MAP_FILE | MAP_SHARED, audio_fd, 0);
|
MAP_FILE | MAP_SHARED, audio_fd, 0);
|
||||||
|
|
||||||
if (shm->buffer == MAP_FAILED) {
|
if (shm->buffer == MAP_FAILED) {
|
||||||
|
|
Loading…
Reference in a new issue