src/audio/alsa/SDL_alsa_audio.c
changeset 10229 ac7e62852dab
parent 10225 874c22f118c2
child 10237 9530fc07da6c
equal deleted inserted replaced
10228:d7ae395db9f2 10229:ac7e62852dab
   698 
   698 
   699     /* Calculate the final parameters for this audio specification */
   699     /* Calculate the final parameters for this audio specification */
   700     SDL_CalculateAudioSpec(&this->spec);
   700     SDL_CalculateAudioSpec(&this->spec);
   701 
   701 
   702     /* Allocate mixing buffer */
   702     /* Allocate mixing buffer */
   703     this->hidden->mixlen = this->spec.size;
   703     if (!iscapture) {
   704     this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
   704         this->hidden->mixlen = this->spec.size;
   705     if (this->hidden->mixbuf == NULL) {
   705         this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
   706         ALSA_CloseDevice(this);
   706         if (this->hidden->mixbuf == NULL) {
   707         return SDL_OutOfMemory();
   707             ALSA_CloseDevice(this);
   708     }
   708             return SDL_OutOfMemory();
   709     SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen);
   709         }
       
   710         SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen);
       
   711     }
   710 
   712 
   711     /* Switch to blocking mode for playback */
   713     /* Switch to blocking mode for playback */
   712     ALSA_snd_pcm_nonblock(pcm_handle, 0);
   714     ALSA_snd_pcm_nonblock(pcm_handle, 0);
   713 
   715 
   714     /* We're ready to rock and roll. :-) */
   716     /* We're ready to rock and roll. :-) */