Small cleanup.
authorCarl Hetherington <cth@carlh.net>
Mon, 17 Apr 2017 22:59:08 +0000 (23:59 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 19 Apr 2017 22:04:32 +0000 (23:04 +0100)
src/lib/audio_ring_buffers.cc

index 81072474ed7203ebea62dbadf20b4cc39b866664..b4fea485e8d795ea79052139fffc6923551ac234 100644 (file)
@@ -62,9 +62,11 @@ AudioRingBuffers::get (float* out, int channels, int frames)
                        return;
                }
 
-               int const to_do = min (frames, _buffers.front()->frames() - _used_in_head);
-               float** p = _buffers.front()->data();
-               int const c = min (_buffers.front()->channels(), channels);
+               shared_ptr<const AudioBuffers> front = _buffers.front ();
+
+               int const to_do = min (frames, front->frames() - _used_in_head);
+               float** p = front->data();
+               int const c = min (front->channels(), channels);
                for (int i = 0; i < to_do; ++i) {
                        for (int j = 0; j < c; ++j) {
                                *out++ = p[j][i + _used_in_head];
@@ -76,7 +78,7 @@ AudioRingBuffers::get (float* out, int channels, int frames)
                _used_in_head += to_do;
                frames -= to_do;
 
-               if (_used_in_head == _buffers.front()->frames()) {
+               if (_used_in_head == front->frames()) {
                        _buffers.pop_front ();
                        _used_in_head = 0;
                }