HookedBehemoth / sys-tune

Background audio player for the Nintendo switch
145 stars 10 forks source link

Add support for ogg vorbis / ogg opus #15

Open pseiler opened 4 years ago

pseiler commented 4 years ago

As I encode most of my Music as ogg vorbis, please add support for it. Ogg Opus is also used often in podcasts etc and is a future-proof codec.

I already opened a issue on the codecs github project (https://github.com/mackron/dr_libs/issues/139), but this seems not a solution for the near future. But I found this (for vorbis support): https://nothings.org/stb_vorbis/

HookedBehemoth commented 4 years ago

I had issues with flag ogg in dr_libs implementation so it's currently disabled.

About stb: Haven't tried stb_vorbis but my experience with the other stb stuff was that it uses too much dynamic memory and heavily relies on a fast unix filesystem.

e.g. stb_image takes 8 seconds loading a 1280*720 RGB bitmap from the sd card as it allocates and loads line by line.

pseiler commented 4 years ago

I see. I haven't had a deeper look into it. I simply found this and thought this could be useful.

I'm looking forward to have vorbis support somewhen in the future. Thank you very much!

HookedBehemoth commented 4 years ago

I'll look into the libopus + hwopus.

mackron commented 4 years ago

I had issues with flag ogg in dr_libs implementation so it's currently disabled.

I'm the author of dr_flac - what was the issue with the Ogg encapsulation stuff? I'm happy to take a look at it. (Note that this is only for encapsulating a FLAC stream in an Ogg container, nothing to do with Vorbis.)

HookedBehemoth commented 4 years ago

Probably was because it wasn't a flac file.

Didn't really investigate at that time.

HookedBehemoth commented 4 years ago

Oh and another reason was that the size of oggbs is more than 8 times my stack size ^^

mackron commented 4 years ago

Ah, yes it does that to avoid a malloc(). You can disable Ogg encapsulation with DR_FLAC_NO_OGG:

#define DR_FLAC_NO_OGG
#define DR_FLAC_IMPLEMENTATION
#include "dr_flac.h"

That should hopefully exclude that oggbs thing, albeit while also disabling Ogg encapsulation (no huge loss - it's extremely rare).

HookedBehemoth commented 4 years ago

Yeah I have that already. https://github.com/HookedBehemoth/sys-tune/blob/master/sys-tune/source/impl/source.cpp#L9