SEVERE: Stream is not open. Can not play

Ok, so I've installed fmod.dll, and now everything looked like it was going to work (the TestSoundGraph demo gets cubes on screen)… however, the sample didn't load properly.  The program didn't crash - it was just silent.



The relevant error messages are as follows:



INFO: INIT FSOUND 44100 1024 0

06-Jun-2007 18:30:24 com.jmex.sound.fmod.scene.SoundNode <init>

INFO: Node created.

06-Jun-2007 18:30:24 com.jmex.sound.fmod.objects.Sample3D init

INFO: Load file:file:/C:/projects/jme/target/jmetest-data.jar!/jmetest/data/soun

d/CHAR_CRE_1.ogg Success=false

06-Jun-2007 18:30:24 com.jmex.sound.fmod.objects.Sample3D init

INFO: Load file:file:/C:/projects/jme/target/jmetest-data.jar!/jmetest/data/soun

d/CHAR_CRE_1.ogg Success=false

06-Jun-2007 18:30:24 com.jmex.sound.fmod.objects.Sample3D init

INFO: Load file:file:/C:/projects/jme/target/jmetest-data.jar!/jmetest/data/soun

d/CHAR_CRE_1.ogg Success=false

06-Jun-2007 18:30:24 com.jmex.sound.fmod.objects.MusicStream play

SEVERE: Stream is not open.  Can not play.



This doesn't give me too many clues.

I've tried out a load of the demos which come with FMOD, and they all seem to work fine.

I've also done a jar -tvf on the jmetest-data.jar and can confirm that the CHAR_CRE_1.ogg file is present.



Any ideas?

Phil Moore said:

INFO: Load file:file:/C:/projects/jme/target/jmetest-data.jar!/jmetest/data/soun


Apparently the loader is appending a file: to the front of the path to make it an URL, but it already has one. This is most certainly the cause it cannot load it, since the file is not correctly pointed to.

No - I checked the source,  and that's just part of the string:



LoggingSystem.getLogger().log(Level.INFO,"Load file:"+fileU.getFile()+ " Success="+(fmodSample !=null));



I'll hunt around a bit more and see if I can find out why fmodSample might be null…

Actually - here is the complete method which is doing this load:



private FSoundSample init(URL fileU)

{

        //getFile does not work (on windows?) it seems to add / at the beginning of the path

        FSoundSample sample=FSound.FSOUND_Sample_Load(FSound.FSOUND_UNMANAGED, fileU.getFile().substring(1), FSound.FSOUND_HW3D |FSound.FSOUND_FORCEMONO | FSound.FSOUND_ENABLEFX, 0, 0);



        if(sample==null){

            //retry without substring

            sample=FSound.FSOUND_Sample_Load(FSound.FSOUND_UNMANAGED, fileU.getFile(), FSound.FSOUND_HW3D |FSound.FSOUND_FORCEMONO | FSound.FSOUND_ENABLEFX, 0, 0);

        }



        LoggingSystem.getLogger().log(Level.INFO,"Load file:"+fileU.getFile()+ " Success="+(fmodSample !=null));

        return sample;

    }



As you can see, the LoggingSystem call references fmodSample - which will always be null at this point because the sample hasn't been returned yet.  So "Success = false" will always be present - this is a cosmetic (and misleading) bug.



So now I have no idea whether sample was null or not … and even less idea when the stream didn't open.  I guess I could hack it…  fun getting my hands dirty!



P


Welll this is probably one of the main reasons why com.jmex.sound is going to extinction and you should start using com.jmex.audio. Unfortunately (for you at least) it only supports OpenAL at the moment.



I don't like FMOD anyway since it is not open source.  }:-@


I guess - I don't know much about the future state as I only joined the community yesterday.
I'm just trying to understand why the existing demos don't work on my install :(

I should point out for the curious that it doesn't appear to be this error which is the real problem:



INFO: Load file:file:/C:/projects/jme/target/jmetest-data.jar!/jmetest/data/soun

d/CHAR_CRE_1.ogg Success=false



As already pointed out, success will always = false, so actually this might not tell us anything (although I still get no sound).



The error "SEVERE: Stream is not open.  Can not play."  actually comes from trying to play the following MusicStream object:



background = SoundSystem

                .createStream("jmetest/data/sound/test.ogg", false);



createStream just calls down to the MusicStream constructor, which is here (memoryLoad = false, by the way):



public MusicStream(String file, boolean memoryLoad){

        this.streamLoc=MusicStream.class.getClassLoader().getResource(file);

        if(memoryLoad){

            …

        }else{

            stream = FSound.FSOUND_Stream_Open(file, FSound.FSOUND_NORMAL | FSound.FSOUND_MPEGACCURATE, 0, 0);

            if(stream==null){

                URL fileU = MusicStream.class.getClassLoader().getResource(file);

                file=fileU.getFile();

                if(file.startsWith("/")) file=file.substring(1);

                stream = FSound.FSOUND_Stream_Open(file, FSound.FSOUND_NORMAL | FSound.FSOUND_MPEGACCURATE, 0, 0);               

            }

        }

        opened=(stream !=null); 

    }



The bold text suggests that stream is coming up null, as in the play function, it is a check of 'opened' which causes the "SEVERE" error message to get generated.



The question is, what is happening to the loading of "test.ogg" to make stream come back null?

I've got a pretty simple setup - the file lives in jmetest-data.jar and that's on the classpath… so… what could it be?



Can anyone else get the TestSoundGraph demo to work?




I've mostly only experienced this type of issue when files are not found.  Perhaps you could try accessing the file in other ways to test?


I might give it a go - but I don't really want to spend too much time tinkering with the demos.

Could you try running the jmetest.sound.fsound.TestSoundGraph demo and seeing what happens?
I just tried it at the work office, and no joy there either, so maybe it's just broke.

Just tried it here at work with no issues.