In my game I’m using _actMusicNode.getStatus() to check if the currently played track is finished. For almost all tracks it is ok, but now I got new one from our composers and the problems started. It is a standard OGG, the only difference between the new one and previous tracks is that there is no silence at the end, the result is that I’m getting Status.stopped just after I hear the last second (or half of the second) repeated. It seems like the setStatus() for AudioNode is called by LwjglAudioRenderer, so I don’t have any possibility to fix it on my own.
Well, yeah, calling setStatus() yourself would be bad anyway because it’s a status. Setting it yourself would just be the same as pretending it was a particular value and you can do that without calling the method.
Can you tell us more about the node’s setup? Streaming, looping, etc.?
You still run JME 3.0, right? That’s also pertinent I think as bugs may be different from one version to the next.
Yes, I’m using 3.0.
For every track I have separate AudioNode (i found a safe way to replay the node’s audio track, but the issue occurs even if I do things in non hacking way).
Here is the code I’m using to init the node:
AudioNodeExt an = new AudioNodeExt(_manager, name, true);
an.setVolume(1.0f);
an.setPositional(false);
an.setReverbEnabled(false);
My own class for the small ‘hack’, here is the one and only difference:
@Override
public void play()
{
if (!_initial)
{
if (_manager != null) this.data = (AudioData) _manager.loadAsset(audioKey);
}
_initial = false;
super.play();
}
So, the first time everything goes in it’s normal way for every AudioNodeEx, when I want to play the node again it reloads the data. But even if I block this functionality to be completely sure that everything goes exactly like JME’s coders wants, and the track is played for it’s first time, there is still the problem with the repeated ending. So… ignore that ‘Ext’.
I found something. It seems that one from my old tracks does not have the silence at the end, but it is NOT repeating. Strange, because all the old tracks were converted by me from mp3 to ogg using Audacity. The new tracks (those with the repeating) were converted by Audacity too, from flac format.
It’s not about lwjgl. JME Audio changes were made in 3.1.
So, at this point the outcome looks like this:
-bug exists in both version, fix will only be applied to 3.1
-bug only exists in 3.0, fix already in 3.1
Switching only one jar from 3.0 to 3.1 is a recipe for more bugs… The only thing I can recommend here is that you try to create a small test case showing the issue and then try it in both 3.0 and 3.1 and see what happens.
Given that the issue is with audio it should be fairly simple to create such isolated test case.
The current problem is not so important for me, I just asked, because I did not found the solution in one hour I hoped that someone meet such problem before and have some nice solution. Now it comes the time for the dirty one: appending 0.5 sec. of silence solved the problem. No one can hear anything bad = there is no problem. So I can forget about it and go back to the battle system implementation for my game. I’m in hurry and I want to do as much as possible before the month’s end. My game has been reported for a contest…