rafa_es
|
 |
«
Posted
2006-10-25 16:00:38 » |
|
Hi guys, I´m trying to put sound in my game basing my code on SoundTestJavaSound. This eaxample runs fine but my code that is basically the same code doesn't work. Any ideas why? 1 2 3 4 5 6 7 8 9 10
| soundDriver = new SoundDriverImpl(); soundDriver.setListenerVolume(1f); env.getView().setSoundDriver(soundDriver); MediaContainer mcWalk = new MediaContainer("src/Sounds/walk.ogg");
Sound sWalk = new BackgroundSound(mcWalk, 1); sWalk.setEnable(true); sWalk.setLoop(Sound.INFINITE_LOOPS); scene.addChild(sWalk); |
Even if i try to use the sound from the test it doesn't work. Rafael
|
|
|
|
rafa_es
|
 |
«
Reply #1 - Posted
2006-10-25 16:07:26 » |
|
I think that for some reason it is not initializing cuz when i run the test it prints 1 2 3 4 5 6 7 8
| JavaSound sound driver initialized with 61 availble sources starting frame speed test Init file... convsize = 20480 buffer is size=248576, freq=8000, formatMONO16 Init file... convsize = 10240 buffer is size=115968, freq=11025, formatSTEREO16 |
and when i run it in my game it only prints the first line
|
|
|
|
Yuri Vl. Gushchin
Senior Devvie   
Speak Java!
|
 |
«
Reply #2 - Posted
2006-10-25 17:24:48 » |
|
Hi,
Does the sample that works also work if you compile it in your environment? (I mean Xith3D version etc.)
Yuri
|
Yuri Vl. Gushchin JProof Group
|
|
|
Games published by our own members! Check 'em out!
|
|
rafa_es
|
 |
«
Reply #3 - Posted
2006-10-25 19:40:13 » |
|
Hi,
Does the sample that works also work if you compile it in your environment? (I mean Xith3D version etc.)
Yuri
Yes Yuri
|
|
|
|
rafa_es
|
 |
«
Reply #4 - Posted
2006-10-25 20:45:22 » |
|
Another thing... When i put a non existent file on MediaContainer in the test i get a error. 1 2 3 4 5
| MediaContainer mc2 = new MediaContainer("src/Sounds/walk.ogg"); Sound sound2 = new BackgroundSound(mc2, 1); sound2.setEnable(true); sound2.setLoop(Sound.INFINITE_LOOPS); tf_2.addChild(sound2); |
then i get this exception 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| java.io.FileNotFoundException: src\Sounds\walk.ogg (O sistema não pode encontrar o caminho especificado) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) at com.xith3d.sound.loaders.OggLoader.load(OggLoader.java:180) at com.xith3d.scenegraph.MediaContainer.getSoundContainer(MediaContainer.java:112) at com.xith3d.sound.SoundProcessor.process(SoundProcessor.java:171) at com.xith3d.sound.SoundProcessor.processAll(SoundProcessor.java:268) at com.xith3d.render.Renderer.renderOnce(Renderer.java:421) at com.xith3d.render.Renderer.renderOnce(Renderer.java:448) at com.xith3d.render.Renderer.renderOnce(Renderer.java:463) at com.xith3d.scenegraph.VirtualUniverse.renderOnce(VirtualUniverse.java:158) at com.xith3d.scenegraph.View.renderOnce(View.java:593) at org.xith3d.render.base.Xith3DEnvironment.render(Xith3DEnvironment.java:785) at org.xith3d.render.loop.RenderLoop.invokeRendering(RenderLoop.java:640) at org.xith3d.render.loop.RenderLoop.loopIteration(RenderLoop.java:656) at org.xith3d.test.sound.SoundTesteJavaSound.loopIteration(SoundTesteJavaSound.java:161) at org.xith3d.render.loop.RenderLoop.run(RenderLoop.java:775) at java.lang.Thread.run(Thread.java:595) |
But when i do the same thing with my code it runs without exception. Do you think thta the problem is that it's not reading the file?
|
|
|
|
Marvin Fröhlich
|
 |
«
Reply #5 - Posted
2006-10-25 21:07:04 » |
|
I don't have too much experiences with Sound. So I'm not of very much help. I could dig into the code to find it out, but it's not cleverer than if you'd do that. But it would definitely help some people (including me) if you'd translate the error message  . Marvin
|
|
|
|
rafa_es
|
 |
«
Reply #6 - Posted
2006-10-25 21:14:09 » |
|
But it would definitely help some people (including me) if you'd translate the error message  . I think you refer to this line 1
| java.io.FileNotFoundException: src\Sounds\walk.ogg (O sistema não pode encontrar o caminho especificado) |
it says "The system could not find the specified path When i try to force this exception in my code it does not appear.
|
|
|
|
Yuri Vl. Gushchin
Senior Devvie   
Speak Java!
|
 |
«
Reply #7 - Posted
2006-10-26 00:05:39 » |
|
Hi,
Something is definitely wrong in scene creation or initialization (say, if Sound is under "off" switch it will not play.
Can you post complete example that does not work? (explanation: I have Sound nodes working fine in my app using up-to-date CVS version of Xith3D)
Yuri
|
Yuri Vl. Gushchin JProof Group
|
|
|
|
Amos Wenger
|
 |
«
Reply #9 - Posted
2006-10-26 09:30:53 » |
|
I'm taking a look at it (having been studying a bit sound in Xith recently).
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
Games published by our own members! Check 'em out!
|
|
Amos Wenger
|
 |
«
Reply #10 - Posted
2006-10-26 10:22:16 » |
|
Some comments on your code : line 386 : use Material.AMBIENT, not mat.AMBIENT line 405 : typo, rename "urlWlak" to "urlWalk" line 405 : path you provided is "Sounds/walk.ogg" but I see no folder sounds. I changed it to "walk.ogg" same comments on path on line 196 and 199 (loading of Sala.ASE) (I finally had to re-create the whole directory structure) whole code : it's a good habit to conform to standard Java coding conventions. A slight "Esc-Ctrl-F" in Eclipse does most of the work for you.
I'm having an ASE loading problem (texture). I'm working on that.
Coming soon with more news.
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
Amos Wenger
|
 |
«
Reply #11 - Posted
2006-10-26 11:01:50 » |
|
Textures do work now I'll commit the AseMaterial changes.
Line 602 getDistance() is deprecated, so use getMinimumDistance() instead.
TODO for static geometry loaders : makes them use display lists (as implemented in PrecomputedAnimatedModel).
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
rafa_es
|
 |
«
Reply #12 - Posted
2006-10-26 12:58:02 » |
|
line 405 : path you provided is "Sounds/walk.ogg" but I see no folder sounds. I changed it to "walk.ogg" same comments on path on line 196 and 199 (loading of Sala.ASE) (I finally had to re-create the whole directory structure)
Amos those paths are there. It's working for me like this. Maybe this is because i'm using netbeans. TODO for static geometry loaders : makes them use display lists (as implemented in PrecomputedAnimatedModel).
How do i do that? Thanks for the help Rafael
|
|
|
|
Amos Wenger
|
 |
«
Reply #13 - Posted
2006-10-26 17:12:51 » |
|
line 405 : path you provided is "Sounds/walk.ogg" but I see no folder sounds. I changed it to "walk.ogg" same comments on path on line 196 and 199 (loading of Sala.ASE) (I finally had to re-create the whole directory structure)
Amos those paths are there. It's working for me like this. Maybe this is because i'm using netbeans. Possibly they disappeared when you made the .rar archive.. or the open-source linux rar extractor doesn't re-create the file hierarchy TODO for static geometry loaders : makes them use display lists (as implemented in PrecomputedAnimatedModel).
How do i do that? You just have to ask ^^ I'll do that when I have time. Thanks for the help
You're welcome. Another tip : if you can modify your scene, then use textures instead of meshes to display text on your cylinders. It will be 2x faster. (Text is a heck lot of polys).
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
rafa_es
|
 |
«
Reply #14 - Posted
2006-10-26 17:59:08 » |
|
You just have to ask ^^ I'll do that when I have time.
Thank you very much  Another tip : if you can modify your scene, then use textures instead of meshes to display text on your cylinders. It will be 2x faster. (Text is a heck lot of polys).
Sure, i'll modify it for textures now. Does the sound work for you Amos? Rafael
|
|
|
|
Amos Wenger
|
 |
«
Reply #15 - Posted
2006-10-27 09:19:49 » |
|
You just have to ask ^^ I'll do that when I have time.
Thank you very much  Done for the ASE loader, I'll now test and commit. Sure, i'll modify it for textures now.
It's really valuable. Does the sound work for you Amos?
No but I haven't debugged it yet.. I considered performance and correct file loading in your game to be more important than sound.. But wait once I have included Yuri's faster texture loading in the toolkit I'll debug your sound problem.
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
Marvin Fröhlich
|
 |
«
Reply #16 - Posted
2006-10-27 13:39:53 » |
|
But wait once I have included Yuri's faster texture loading in the toolkit I'll debug your sound problem.
Isn't it better to include it into the existing TextureLoader?
|
|
|
|
Yuri Vl. Gushchin
Senior Devvie   
Speak Java!
|
 |
«
Reply #17 - Posted
2006-10-27 15:09:51 » |
|
Hi, Isn't it better to include it into the existing TextureLoader? I guess he is intergating it with existing texture loader. But in the meantime I plan to play a bit with even better loading which may theoretically utilize some features of the driver. ...but for this I guess we will need something like a "lazy texture loading" which will run on Rendering thread (i.e. within the context of GLCanvas.display(...) Yuri
|
Yuri Vl. Gushchin JProof Group
|
|
|
rafa_es
|
 |
«
Reply #18 - Posted
2006-10-27 15:46:39 » |
|
Done for the ASE loader, I'll now test and commit.
I'll check the cvs now It's really valuable.
Got a big boost of performance without Text2D No but I haven't debugged it yet.. I considered performance and correct file loading in your game to be more important than sound.. But wait once I have included Yuri's faster texture loading in the toolkit I'll debug your sound problem.
Sure it is. Rafael
|
|
|
|
Amos Wenger
|
 |
«
Reply #19 - Posted
2006-10-27 18:43:28 » |
|
I guess he is intergating it with existing texture loader.
Exactly so. Marvin, I'm surprised you thought me dumb enough not to take this opportunity  But in the meantime I plan to play a bit with even better loading which may theoretically utilize some features of the driver.
...but for this I guess we will need something like a "lazy texture loading" which will run on Rendering thread (i.e. within the context of GLCanvas.display(...)
Well good luck.
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
Amos Wenger
|
 |
«
Reply #20 - Posted
2006-10-27 19:08:26 » |
|
rafa_es : I changed a bit your game so that the only difference between the java sound test and your game is that your sound node is added to a render branch (pass).
Marvin, are render passes and regular branchgroup handled differently about sound nodes ?
The sound data is only loaded, when it is first "rendered". And when it's loaded there's a message. And, we don't have this message.. so this node never gets rendered... and when it's not in a special "pass" it works perfectly... soo what's going on ?
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
Amos Wenger
|
 |
«
Reply #21 - Posted
2006-10-28 10:37:51 » |
|
line 504 (not sure if it's the right one, i changed the code abit) : 1
| cronometro.setColor(new Color3f(0.12f, 0.15f, 1f)); |
replace by : 1
| cronometro.setFontColor(new Color3f(0.12f, 0.15f, 1f)); |
(setColor() is deprecated) same for next occurences (line 509 lines 544-545 : not a good idea to have classes like "hudWinner" and "hudLooser", rather use "HudWinner" and "HudLooser". (java standards coding conventions) I'm investigating sound processing
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
Amos Wenger
|
 |
«
Reply #22 - Posted
2006-10-28 12:41:06 » |
|
Marvin, 1 2 3 4 5 6 7 8 9 10 11 12 13
| public final int collectAtoms(Locale locale, RenderPassConfigProvider defaultRenderPassConfig, ScenegraphModificationsListener modListener, Renderer renderer, com.xith3d.render.Canvas3D canvas, SoundProcessor soundProcessor) {
pass.getRenderBinProvider().clearAllBins(j == 0); renderer.nodeUpdaters.clear(); renderer.billboards.clear();
} |
What is this code supposed to do here ? It works well without.
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
Amos Wenger
|
 |
«
Reply #23 - Posted
2006-10-28 12:45:20 » |
|
@rafa_es : update from CVS, should be fixed now.
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
Marvin Fröhlich
|
 |
«
Reply #24 - Posted
2006-10-28 13:46:25 » |
|
I really didn't want to call you dump. Sorry if you came to understand it this way  . Marvin, are render passes and regular branchgroup handled differently about sound nodes ?
Not at all. The sound data is only loaded, when it is first "rendered". And when it's loaded there's a message. And, we don't have this message.. so this node never gets rendered... and when it's not in a special "pass" it works perfectly... soo what's going on ?
Marvin, 1 2 3 4 5 6 7 8 9 10 11 12 13
| public final int collectAtoms(Locale locale, RenderPassConfigProvider defaultRenderPassConfig, ScenegraphModificationsListener modListener, Renderer renderer, com.xith3d.render.Canvas3D canvas, SoundProcessor soundProcessor) {
pass.getRenderBinProvider().clearAllBins(j == 0); renderer.nodeUpdaters.clear(); renderer.billboards.clear();
} |
What is this code supposed to do here ? It works well without. I need to check it. But it should only be a problem, when you're using more than one Locle, which should be very rare. Will check it this evening. Marvin
|
|
|
|
Marvin Fröhlich
|
 |
«
Reply #25 - Posted
2006-10-28 14:15:50 » |
|
line 504 (not sure if it's the right one, i changed the code abit) : 1
| cronometro.setColor(new Color3f(0.12f, 0.15f, 1f)); |
replace by : 1
| cronometro.setFontColor(new Color3f(0.12f, 0.15f, 1f)); |
(setColor() is deprecated) same for next occurences (line 509 A word about the reason, why I deprecated these methods: I introduced a new interface called TextWidget. I'm planning to use it for a speacial implementation of the new List Widget I'm working on. And setColor() is not a good name for a common text-color getter/setter. So I deprecated set/getColor() in Label and added the new method implemented from TextWidget called set/getFontColor(). Marvin
|
|
|
|
rafa_es
|
 |
«
Reply #26 - Posted
2006-10-28 14:47:01 » |
|
@rafa_es : update from CVS, should be fixed now.
Thank you for all the help Amos  I'll update the CVS now
|
|
|
|
Amos Wenger
|
 |
«
Reply #27 - Posted
2006-10-30 08:49:40 » |
|
@rafa_es : update from CVS, should be fixed now.
Thank you for all the help Amos  You're welcome  I'll update the CVS now
I hope I didn't break something else..
|
"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
|
|
|
|