From c6f92b782c3e2178f4107dae2feb29aeef69a6ed Mon Sep 17 00:00:00 2001 From: byuu <2107894+byuu@users.noreply.github.com> Date: Sat, 5 Oct 2019 14:30:55 +0900 Subject: [PATCH] Minor touchups. --- bsnes/emulator/audio/audio.hpp | 2 +- bsnes/emulator/audio/stream.cpp | 5 ++--- nall/queue.hpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bsnes/emulator/audio/audio.hpp b/bsnes/emulator/audio/audio.hpp index fd029403..be3e9cf6 100644 --- a/bsnes/emulator/audio/audio.hpp +++ b/bsnes/emulator/audio/audio.hpp @@ -63,7 +63,7 @@ struct Stream { auto addLowPassFilter(double cutoffFrequency, Filter::Order order, uint passes = 1) -> void; auto addHighPassFilter(double cutoffFrequency, Filter::Order order, uint passes = 1) -> void; - auto pending() const -> uint; + auto pending() const -> bool; auto read(double samples[]) -> uint; auto write(const double samples[]) -> void; diff --git a/bsnes/emulator/audio/stream.cpp b/bsnes/emulator/audio/stream.cpp index d22863b4..5a697527 100644 --- a/bsnes/emulator/audio/stream.cpp +++ b/bsnes/emulator/audio/stream.cpp @@ -81,9 +81,8 @@ auto Stream::addHighPassFilter(double cutoffFrequency, Filter::Order order, uint } } -auto Stream::pending() const -> uint { - if(!channels) return 0; - return channels[0].resampler.pending(); +auto Stream::pending() const -> bool { + return channels && channels[0].resampler.pending(); } auto Stream::read(double samples[]) -> uint { diff --git a/nall/queue.hpp b/nall/queue.hpp index 8b791ee7..062eda77 100644 --- a/nall/queue.hpp +++ b/nall/queue.hpp @@ -41,7 +41,7 @@ struct queue { template auto capacity() const -> uint { return _capacity * sizeof(T) / sizeof(U); } template auto size() const -> uint { return _size * sizeof(T) / sizeof(U); } auto empty() const -> bool { return _size == 0; } - auto pending() const -> bool { return _size; } + auto pending() const -> bool { return _size > 0; } auto full() const -> bool { return _size >= (int)_capacity; } auto underflow() const -> bool { return _size < 0; } auto overflow() const -> bool { return _size > (int)_capacity; }