summaryrefslogtreecommitdiff
path: root/src/audioout.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/audioout.cc')
-rw-r--r--src/audioout.cc7
1 files changed, 4 insertions, 3 deletions
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);
+ }
}