~dholbach/xwax/trunk

« back to all changes in this revision

Viewing changes to alsa.c

  • Committer: Mark Hills
  • Date: 2011-06-19 14:58:29 UTC
  • Revision ID: git-v1:11694be463c171d603cd02c1726a44123cf2d997
Move audio processing to a shared function

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <alsa/asoundlib.h>
24
24
 
25
25
#include "alsa.h"
26
 
#include "timecoder.h"
27
 
#include "player.h"
28
26
 
29
27
 
30
28
/* This structure doesn't have corresponding functions to be an
251
249
    int r;
252
250
    struct alsa_t *alsa = (struct alsa_t*)dv->local;
253
251
 
254
 
    if (dv->player) {
255
 
        player_collect(dv->player, alsa->playback.buf,
256
 
                       alsa->playback.period, alsa->playback.rate);
257
 
    } else {
258
 
        memset(alsa->playback.buf, 0,
259
 
               alsa->playback.period * DEVICE_CHANNELS * sizeof(short));
260
 
    }    
 
252
    device_collect(dv, alsa->playback.buf, alsa->playback.period);
261
253
 
262
254
    r = snd_pcm_writei(alsa->playback.pcm, alsa->playback.buf,
263
255
                       alsa->playback.period);
290
282
        fprintf(stderr, "alsa: capture underrun %d/%ld.\n",
291
283
                r, alsa->capture.period);
292
284
    }
293
 
    
294
 
    if (dv->timecoder)
295
 
        timecoder_submit(dv->timecoder, alsa->capture.buf, r);
 
285
 
 
286
    device_submit(dv, alsa->capture.buf, r);
296
287
 
297
288
    return 0;
298
289
}