Revision ddabec73

b/audio/audio.c
851 851
    return live;
852 852
}
853 853

  
854
int audio_pcm_hw_clip_out (HWVoiceOut *hw, void *pcm_buf,
855
                           int live, int pending)
856
{
857
    int left = hw->samples - pending;
858
    int len = audio_MIN (left, live);
859
    int clipped = 0;
860

  
861
    while (len) {
862
        struct st_sample *src = hw->mix_buf + hw->rpos;
863
        uint8_t *dst = advance (pcm_buf, hw->rpos << hw->info.shift);
864
        int samples_till_end_of_buf = hw->samples - hw->rpos;
865
        int samples_to_clip = audio_MIN (len, samples_till_end_of_buf);
866

  
867
        hw->clip (dst, src, samples_to_clip);
868

  
869
        hw->rpos = (hw->rpos + samples_to_clip) % hw->samples;
870
        len -= samples_to_clip;
871
        clipped += samples_to_clip;
872
    }
873
    return clipped;
874
}
875

  
854 876
/*
855 877
 * Soft voice (capture)
856 878
 */
b/audio/audio_int.h
221 221
int  audio_pcm_hw_get_live_out (HWVoiceOut *hw);
222 222
int  audio_pcm_hw_get_live_out2 (HWVoiceOut *hw, int *nb_live);
223 223

  
224
int audio_pcm_hw_clip_out (HWVoiceOut *hw, void *pcm_buf,
225
                           int live, int pending);
226

  
224 227
int audio_bug (const char *funcname, int cond);
225 228
void *audio_calloc (const char *funcname, int nmemb, size_t size);
226 229

  

Also available in: Unified diff