/*
snd_alsa_0_9.c
- (description)
+ Support for ALSA 0.9 sound driver (cvs development version)
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
#include <sys/asoundlib.h>
-#include "qtypes.h"
+#include "quakedef.h"
#include "sound.h"
-#include "qargs.h"
#include "console.h"
static int snd_inited;
break;
case 8:
case 16:
- if (snd_pcm_hw_params_set_format(pcm, hw,
+ if (snd_pcm_hw_params_set_format(pcm, hw,
bps == 8 ? SND_PCM_FORMAT_U8 :
SND_PCM_FORMAT_S16) >= 0) {
break;
goto error;
}
- if (snd_pcm_hw_params_set_access(pcm, hw,
+ if (snd_pcm_hw_params_set_access(pcm, hw,
SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) {
Con_Printf("ALSA: interleaved is not supported\n");
goto error;
}
snd_pcm_hw_params_set_period_size_near(pcm, hw, frag_size, 0);
-
+
err = snd_pcm_hw_params(pcm, hw);
if (err < 0) {
Con_Printf("ALSA: unable to install hw params\n");
mmap_areas = snd_pcm_mmap_running_areas(pcm);
- shm=&sn;
memset((dma_t*)shm,0,sizeof(*shm));
- shm->splitbuffer = 0;
shm->channels=stereo+1;
- shm->submission_chunk=snd_pcm_hw_params_get_period_size(hw, 0); // don't mix less than this #
shm->samplepos=0; // in mono samples
shm->samplebits=bps;
- buffer_size = snd_pcm_hw_params_get_buffer_size(hw);
+ buffer_size = snd_pcm_hw_params_get_buffer_size(hw);
shm->samples=buffer_size*shm->channels; // mono samples in buffer
shm->speed=rate;
shm->buffer=(unsigned char*)mmap_areas->addr;
Con_Printf("%5d samples\n", shm->samples);
Con_Printf("%5d samplepos\n", shm->samplepos);
Con_Printf("%5d samplebits\n", shm->samplebits);
- Con_Printf("%5d submission_chunk\n", shm->submission_chunk);
Con_Printf("%5d speed\n", shm->speed);
Con_Printf("0x%x dma buffer\n", (int)shm->buffer);
Con_Printf("%5d total_channels\n", total_channels);
}
static inline int
-get_hw_ptr()
+get_hw_ptr(void)
{
size_t app_ptr;
snd_pcm_sframes_t delay;
}
}
+void *S_LockBuffer(void)
+{
+ return shm->buffer;
+}
+
+void S_UnlockBuffer(void)
+{
+}
+