Skip to content

Commit

Permalink
Report buffer fill level (earlephilhower#52)
Browse files Browse the repository at this point in the history
Add method to get the current buffer fill level (for real-time display/etc.)
  • Loading branch information
h3ndrik authored and earlephilhower committed Mar 25, 2018
1 parent 32cbbfe commit e3a3f2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/AudioFileSourceBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ uint32_t AudioFileSourceBuffer::getPos()
return src->getPos();
}

uint32_t AudioFileSourceBuffer::getFillLevel()
{
return length;
}

uint32_t AudioFileSourceBuffer::read(void *data, uint32_t len)
{
if (!buffer) return src->read(data, len);
Expand Down
2 changes: 2 additions & 0 deletions src/AudioFileSourceBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class AudioFileSourceBuffer : public AudioFileSource
virtual uint32_t getPos() override;
virtual bool loop() override;

virtual uint32_t getFillLevel();

enum { STATUS_FILLING=2, STATUS_UNDERFLOW };

private:
Expand Down

0 comments on commit e3a3f2b

Please sign in to comment.