Skip to content

Music playback progress by percentage #630

Answered by pschatzmann
BeijingUncle asked this question in Q&A
Discussion options

You must be logged in to vote

Currently there is no such functionality, but I suggest that you contribute to this project by extending it.

I think the cleanest way would be to provide a new class e.g. ProgressStream() where you implement the following methods:

  • setInput(Stream&)
  • setInput(File&): calls setInput() and setSize()
  • setOutput(Print&)
  • setSize(size_t size) updates the total size and resets the bytes consumed
  • bytesConsumed() provides the bytes consumed which are updated by the write() and readBytes() methods
  • percentage(): calculated from size and bytes consumed
  • write() writes the provided bytes to the final output
  • readBytes provides the bytes from the final input

Maybe you have a look at the existing Measuring…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by pschatzmann
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants