deltabeard / ctrmus

3DS Music Player

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[REQUEST] Show current time and total time of current playing song

StupidRepo opened this issue · comments

I'd like it if on the bottom screen at the bottom, it shows the current time in the song (e.g. 05:58) on the bottom left, the title of the file (and make it scroll slowly when pressing R button if the text goes off screen/is too long) on the bottom center, and the total time of the song on the bottom right (e.g. 05:59).

Concept image below (sorry the font isn't the exact same):
ooh
And a concept video I just made (took me about 30 minutes):

thething.mp4

Notes for my future self:
The number of samples read is already obtained in ctrmus, so the time played can already be deduced using the sample rate. So only the total number of samples for the file needs to be added.

  • mpg123 uses mpg123_length() and mpg123_tell() to obtain the number of samples in the music file and the number of samples decoded.
  • dr_flac: drflac_open_and_read_pcm_frames_s16 returns totalPCMFrameCount, drflac_read_pcm_frames_s16 reads the number of samples decoded, so this would need to be added.
  • opusfile: op_pcm_total to obtain the number of samples in the file.
  • wav: this could be calculated from the file size. But I think that this should be made to use dr_wav.

If the number of samples in the file isn't available, then the length of the music won't be displayed.

My 3DS has collected dust; it's been 6 years since the last release of ctrmus. I last worked on a UI for it in 2021 that used LVGL, but it was slow and clunky so I abandoned it.

👀 Are you going to update ctrmus though to add this? If not, I can always try my best to make something but I suck at coding 3DS apps/games and I just generally suck at C/C++ a lot.

Added in cdf49f8.
Could you please test the build attached?
ctrmus.zip

👀 Of course I will test it! 😁
Thank you for updating it!
(and sorry for the late reply!)

did it work?