Playing Audio Files Using libctru(NDSP) in C?

Discussion in '3DS - Homebrew Development and Emulators' started by AdamFX990, Jan 23, 2017.

  1. AdamFX990
    OP

    AdamFX990 Member

    Newcomer
    43
    10
    Jan 22, 2017
    Santraginus V
    Heyya fellas!

    I've been having a lot of fun making small programs for my 3DS. But one thing I've run into a problem with is playing audio files. I have a decoder which I borrowed from ctrmus. But ctrmus relies on some additional libraries which I'd rather not have to use if possible for the sake of portability.

    The other code I've been looking at borrowing from is 3ds-vgmstream. Unfortunately, that is written in C++. But it uses a library called NDSP, which I've been reading through the documentation for and it seems like the sort of library I'm after, but I can't seem to import it into my C code and I can't see any reason why I shouldn't be able to looking through the documentation.

    Of course, I could just write my program in C++, which I might. But I much prefer functional programming to OO programming. I guess I can do c++ functionally, but I'm imagining some OO fans would have a heart attack if they saw such a thing :gun:. Also, all my other programs are written in C. If I want to combine then in to one super-epic-mega program of doom, then I'd need to port them all over to C++ and that's effort.

    If any of you guys have messed around with any homebrew that plays audio files, then please show me what you got! :D
     
  2. MaK11-12

    MaK11-12 GBAtemp Regular

    Member
    234
    124
    Jul 26, 2009
    Namek
    What kind of portability issues would arise with using a library? ctrmus uses libraries which supports different architectures, but that isn't really required because ctrmus is only targeting the 3DS.

    Give me a shout if you need help with ctrmus.
     
  3. AdamFX990
    OP

    AdamFX990 Member

    Newcomer
    43
    10
    Jan 22, 2017
    Santraginus V
    The libraries in question aren't open source. I don't really fancy the idea of adding lots of non-free dependencies because of the obvious headaches that would bring to anyone wanting to maintain the code (including myself, as I work on as many as four different computers). If you have any recommendations for either Open source libraries that I could use or of anyway I could do this in C using ctrmus then that'd be a fantastic help to me. Thanks for the reply! :)
     
  4. MaK11-12

    MaK11-12 GBAtemp Regular

    Member
    234
    124
    Jul 26, 2009
    Namek
    All the libraries that ctrmus use are open source.

    Edit: dr_flac is public domain, libopus is BSD-like licence, and mpg123 is LGPL.
     
    Last edited by MaK11-12, Feb 7, 2017
  5. AdamFX990
    OP

    AdamFX990 Member

    Newcomer
    43
    10
    Jan 22, 2017
    Santraginus V
    I'll have a look at some of those and see if I can get something working. Thanks for your help :)