|
|
1.1 root 1:
2: #include "quakedef.h"
3:
4: extern int desired_speed;
5: extern int desired_bits;
6:
7: qboolean SNDDMA_Init(void)
8: {
9: int size;
10:
11: size = 16384 + sizeof(dma_t);
12: shm = malloc (size);
13: memset((void*)shm, 0, size);
14:
15: shm->buffer = (char*)shm + sizeof(dma_t);
16: shm->channels = 2;
17: shm->speed = desired_speed;
18: shm->samplebits = desired_bits;
19: shm->samples = 16384 / (desired_bits / 8);
20: shm->submission_chunk = 1;
21:
22: return true;
23: }
24:
25: // return the current sample position (in mono samples read)
26: // inside the recirculating dma buffer
27: int SNDDMA_GetDMAPos(void)
28: {
29: shm->samplepos = (int)(realtime*shm->speed*shm->channels) & (shm->samples-1);
30:
31: return shm->samplepos;
32: }
33:
34: void SNDDMA_Shutdown(void)
35: {
36: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.