[ad_1]
I would like to add multiple music formats to the LibGdx library, like .vgm, .mod, .s3m, .xm and so on. I already have the Java code to do so, but it’s hard to integrate it with LibGdx code.
I know there is a backend class named OpenALLwjgl3Audio that has the following 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 would be nice to call this registerMusic(“vgm”, Vgm.Music.class) from outside this class.
-
Unfortunately, as it is a backend class, I can’t access it from ‘core’ project:
((OpenALLwjgl3Audio) Gdx.audio).registerMusic("vgm", Vgm.Music.class); => Error: OpenALLwjgl3Audio can't be resolved to a type
-
I tried to access the audio variable in the ‘desktop’ project (DesktopLauncher.java), but it is null until the application is instantiated, and then it enter in a loop:
((OpenALLwjgl3Audio) Gdx.audio).registerMusic("vgm", Vgm.Music.class); => Nullpointer Exception, as audio is null until the code below executes: ... new Lwjgl3Application(new Game(), config);
-
Creating the class Vgm.Music.class in the LibGdx library itself, along with Mp3.class, Ogg.class and so on and edit the OpenALLwjgl3Audio directly. BUT: I would need to use a particular fork of the LibGdx code, as it probably wouldn’t enter in the main develop branch, making it harder to keep my project updated.
Any guidelines to achieve this goal?
[ad_2]