]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_alsa_0_9.c
The portable_samplepair_t structure has no need to be public
[xonotic/darkplaces.git] / snd_alsa_0_9.c
index 49b6bb872b310acf7c4fb7a0b0827cd5c298141e..dbcdcb0af19b269c804414772bc246f63e3e7776 100644 (file)
@@ -102,7 +102,7 @@ qboolean SNDDMA_Init(void)
                        frag_size = 64; /* assuming stereo 8 bit */
                        rate = 11025;
                } else {
-                       Con_Printf("ALSA: no useable rates\n");
+                       Con_Print("ALSA: no useable rates\n");
                        goto error;
                }
                break;
@@ -115,7 +115,7 @@ qboolean SNDDMA_Init(void)
                }
                /* Fall through */
        default:
-               Con_Printf("ALSA: desired rate not supported\n");
+               Con_Print("ALSA: desired rate not supported\n");
                goto error;
        }
 
@@ -126,26 +126,26 @@ qboolean SNDDMA_Init(void)
                } else if (snd_pcm_hw_params_set_format(pcm, hw, SND_PCM_FORMAT_U8) >= 0) {
                        bps = 8;
                } else {
-                       Con_Printf("ALSA: no useable formats\n");
+                       Con_Print("ALSA: no useable formats\n");
                        goto error;
                }
                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;
                 }
                /* Fall through */
        default:
-               Con_Printf("ALSA: desired format not supported\n");
+               Con_Print("ALSA: desired format not supported\n");
                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");
+               Con_Print("ALSA: interleaved is not supported\n");
                goto error;
        }
 
@@ -156,7 +156,7 @@ qboolean SNDDMA_Init(void)
                } else if (snd_pcm_hw_params_set_channels(pcm, hw, 1) >= 0) {
                        stereo = 0;
                } else {
-                       Con_Printf("ALSA: no useable channels\n");
+                       Con_Print("ALSA: no useable channels\n");
                        goto error;
                }
                break;
@@ -166,15 +166,15 @@ qboolean SNDDMA_Init(void)
                         break;
                 /* Fall through */
        default:
-               Con_Printf("ALSA: desired channels not supported\n");
+               Con_Print("ALSA: desired channels 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");
+               Con_Print("ALSA: unable to install hw params\n");
                goto error;
        }
 
@@ -184,20 +184,17 @@ qboolean SNDDMA_Init(void)
 
        err = snd_pcm_sw_params(pcm, sw);
        if (err < 0) {
-               Con_Printf("ALSA: unable to install sw params\n");
+               Con_Print("ALSA: unable to install sw params\n");
                goto error;
        }
 
        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;
@@ -205,7 +202,6 @@ qboolean SNDDMA_Init(void)
        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);
@@ -218,7 +214,7 @@ qboolean SNDDMA_Init(void)
 }
 
 static inline int
-get_hw_ptr()
+get_hw_ptr(void)
 {
        size_t app_ptr;
        snd_pcm_sframes_t delay;
@@ -305,3 +301,12 @@ void SNDDMA_Submit(void)
        }
 }
 
+void *S_LockBuffer(void)
+{
+       return shm->buffer;
+}
+
+void S_UnlockBuffer(void)
+{
+}
+