Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MP3 time measurement function #2193

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

Hi @pschatzmann.

I don ́t achieve to measure time of the MP3 playing file with PLAYER. Could you help me? The value always is zero.
Thanks in advance.

File* pFile = nullptr;
AudioSourceIdxSDMMC source("/","mp3",true);
...
pFile = (File*)source.selectStream("/test.mp3"); 
...
MP3DecoderHelix decoderMP3;
MetaDataFilterDecoder metadatafilter(decoderMP3);
MeasuringStream measureMP3(decoderMP3);
...
measureMP3.begin();
decoderMP3.begin();
player.setDecoder(metadatafilter);
player.begin();
...
while (playing)
{
 sMP3_begin = measureMP3.estimatedTotalTimeFor(pFile->size());
 Serial.println(sMP3_begin);
 player.copy();
}
You must be logged in to vote

You don't write any data to MeasuringStream!
You can use the setCallbackOnWrite() from the StreamCopy in the player, to feed it with data

Replies: 1 comment 1 reply

Comment options

You don't write any data to MeasuringStream!
You can use the setCallbackOnWrite() from the StreamCopy in the player, to feed it with data

You must be logged in to vote
1 reply
Comment options

Ok. Thanks!

Answer selected by pschatzmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /