AudioNode issue, last second repeated at the end

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.

Any idea what can be the cause?

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. :smile:

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);

To start the track I use;


My own class for the small ‘hack’, here is the one and only difference:

public void play()
    if (!_initial)
        if (_manager != null) = (AudioData) _manager.loadAsset(audioKey);
    _initial = false;;    

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.

If you remove that and stop manually looping then do you still have the problem?

Note: a bunch of audio stuff was fixed in 3.1

It is not about looping. Playing a track the first time causes such effect.
Does the lwjgl.jar from 3.1 would work with JME 3.0 ?

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

…so at some point this will be your problem.

I’m unable to switch to 3.1 because of my custom rendering pipeline. I’ll try to swap jme-jogg jars and see if it would help.

EDIT: jar from 3.1 works with my version but the problem still occurs.

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.

This happens on JME 3.0 when streaming at least. And it should be fixed in JME 3.1. Haven’t tried it, but trust is great :slight_smile:

The current problem is not so important for me, I just asked, because I did not found the solution in one hour :slight_smile: 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…

If you want I can share the ogg file, so you can test and fix it in 3.1.
About the test case: AudioNode issue, last second repeated at the end - #3 by FrozenShade I’m not using anything special, it is the most simple code ever.