audio – In LibGdx, methods to add one other music format?

audio – In LibGdx, methods to add one other music format?

[ad_1]

I wish to add a number of music codecs to the LibGdx library, like .vgm, .mod, .s3m, .xm and so forth. I have already got the Java code to take action, but it surely’s exhausting to combine it with LibGdx code.

I do know there’s a backend class named OpenALLwjgl3Audio that has the next code:

    registerSound("ogg", Ogg.Sound.class);
    registerMusic("ogg", Ogg.Music.class);
    registerSound("wav", Wav.Sound.class);
    registerMusic("wav", Wav.Music.class);
    registerSound("mp3", Mp3.Sound.class);
    registerMusic("mp3", Mp3.Music.class);

So it will be good to name this registerMusic(“vgm”, Vgm.Music.class) from exterior this class.

  1. Sadly, as it’s a backend class, I am unable to entry it from ‘core’ mission:

     ((OpenALLwjgl3Audio) Gdx.audio).registerMusic("vgm", Vgm.Music.class);
     => Error: OpenALLwjgl3Audio cannot be resolved to a kind
    
  2. I attempted to entry the audio variable within the ‘desktop’ mission (DesktopLauncher.java), however it’s null till the applying is instantiated, after which it enter in a loop:

     ((OpenALLwjgl3Audio) Gdx.audio).registerMusic("vgm", Vgm.Music.class);
     => Nullpointer Exception, as audio is null till the code beneath executes:
     ...
     new Lwjgl3Application(new Sport(), config);
    
  3. Creating the category Vgm.Music.class within the LibGdx library itself, together with Mp3.class, Ogg.class and so forth and edit the OpenALLwjgl3Audio instantly. BUT: I would want to make use of a specific fork of the LibGdx code, because it in all probability would not enter in the primary develop department, making it more durable to maintain my mission up to date.

Any tips to realize this purpose?

[ad_2]

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply