- shm->samples = info.fragstotal * info.fragsize / shm->format.width;
-
- // memory map the dma buffer
- shm->bufferlength = info.fragstotal * info.fragsize;
- shm->buffer = (unsigned char *) mmap(NULL, shm->bufferlength, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0);
- if (!shm->buffer || shm->buffer == (unsigned char *)-1)
- {
- perror("/dev/dsp");
- Con_Print("Could not mmap /dev/dsp\n");
- close(audio_fd);
- return 0;
- }
-
- tmp = 0;
- if (shm->format.channels == 2)
- tmp = 1;
-