+ Con_Printf("%d-bit sound not supported.\n", shm->format.width * 8);
+ close(audio_fd);
+ return 0;
+ }
+
+ shm->sampleframes = info.fragstotal * info.fragsize / shm->format.width / shm->format.channels;
+ shm->samples = shm->sampleframes * shm->format.channels;
+
+ // memory map the dma buffer
+ shm->bufferlength = info.fragstotal * info.fragsize;
+ shm->buffer = (unsigned char *) mmap(NULL, shm->bufferlength, 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");