Skip to content

Commit

Permalink
Merge pull request #98 from sccn/fix_97
Browse files Browse the repository at this point in the history
Fixes #97 - samples_available now returns samples_available
  • Loading branch information
cboulay authored Nov 25, 2020
2 parents 9b96b95 + b3af300 commit f801a22
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/data_receiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class data_receiver : public cancellable_registry {
/// Check whether the underlying buffer is empty. This value may be inaccurate.
bool empty() { return sample_queue_.empty(); }

std::size_t samples_available() { return sample_queue_.read_available(); }

/// Flush the queue, return the number of dropped samples
uint32_t flush() noexcept { return sample_queue_.flush(); }

Expand Down
2 changes: 1 addition & 1 deletion src/stream_inlet_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class stream_inlet_impl {
* Query the current size of the buffer, i.e. the number of samples that are buffered.
* Note that this value may be inaccurate and should not be relied on for program logic.
*/
std::size_t samples_available() { return (std::size_t)(!data_receiver_.empty()); }
std::size_t samples_available() { return data_receiver_.samples_available(); }

/// Flush the queue, return the number of dropped samples
uint32_t flush() { return data_receiver_.flush(); }
Expand Down

0 comments on commit f801a22

Please sign in to comment.