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 | |
| parent | 51c755b4fdea854325a09f7658ccfe43b9fa7ef0 (diff) | |
Make ::get tell caller if there's been an underrun.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/audio_ring_buffers.cc | 7 | ||||
| -rw-r--r-- | src/lib/audio_ring_buffers.h | 2 |
2 files changed, 6 insertions, 3 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 diff --git a/src/lib/audio_ring_buffers.h b/src/lib/audio_ring_buffers.h index 8f180042e..3c726425c 100644 --- a/src/lib/audio_ring_buffers.h +++ b/src/lib/audio_ring_buffers.h @@ -34,7 +34,7 @@ public: AudioRingBuffers (); void put (boost::shared_ptr<const AudioBuffers> data); - void get (float* out, int channels, int frames); + bool get (float* out, int channels, int frames); void clear (); Frame size () const; |
