From 90fb73a91936ede98ccedda073929397ddf842b1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 2 Aug 2012 20:43:30 +0200 Subject: New portaudio approach. --- src/audioout.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/audioout.cc') diff --git a/src/audioout.cc b/src/audioout.cc index 0495a2c..b0ab3d7 100644 --- a/src/audioout.cc +++ b/src/audioout.cc @@ -29,8 +29,6 @@ #define T(x, msg) if(x < 0) { printf("%s failed: %s\n", msg, snd_strerror(x)); fflush(stdout); } -#define BUFSZ 40960 - AudioOut::AudioOut(std::string device, unsigned int srate, int channels) { handle = NULL; @@ -83,5 +81,8 @@ AudioOut::~AudioOut() void AudioOut::write(sample_t *samples, size_t size) { // Write the interleaved buffer to the soundcard - snd_pcm_writei(handle, samples, size); + size_t sz = 0; + while(size > sz) { + sz += snd_pcm_writei(handle, samples + sz, size - sz); + } } -- cgit v1.2.3