diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-07-12 17:20:07 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-07-12 17:20:07 +0100 |
| commit | 6a37a2a1283cc3c73cb857dba32099cf12c8768a (patch) | |
| tree | 32df98dae790a747541f09bfbdc0d8a39e29d323 /src/lib/audio_ring_buffers.cc | |
| parent | 51c755b4fdea854325a09f7658ccfe43b9fa7ef0 (diff) | |
Make ::get tell caller if there's been an underrun.
Diffstat (limited to 'src/lib/audio_ring_buffers.cc')
| -rw-r--r-- | src/lib/audio_ring_buffers.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/audio_ring_buffers.cc b/src/lib/audio_ring_buffers.cc index 59f06a7c0..4e0b33382 100644 --- a/src/lib/audio_ring_buffers.cc +++ b/src/lib/audio_ring_buffers.cc @@ -45,7 +45,8 @@ AudioRingBuffers::put (shared_ptr<const AudioBuffers> data) _buffers.push_back (data); } -void +/** @return true if there was an underrun, otherwise false */ +bool AudioRingBuffers::get (float* out, int channels, int frames) { boost::mutex::scoped_lock lm (_mutex); @@ -58,7 +59,7 @@ AudioRingBuffers::get (float* out, int channels, int frames) } } cout << "audio underrun; missing " << frames << "!\n"; - return; + return true; } shared_ptr<const AudioBuffers> front = _buffers.front (); @@ -82,6 +83,8 @@ AudioRingBuffers::get (float* out, int channels, int frames) _used_in_head = 0; } } + + return false; } void |
