Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  AudioMixer  (Read 4962 times)
0 Members and 1 Guest are viewing this topic.
Offline nsigma

JGO Knight


Medals: 37



« Reply #30 - Posted 2011-11-10 12:23:55 »

@nsigma: Lag? Largely due to GUI laziness on my part. (Shot myself in the foot?)
...
All in all, my point is that it is dubious to judge lag based solely on a web demo. One doesn't know what the programmer has done via the GUI layer. Better is to ask: is it in the ball park, and thus worth taking a more serious look?

Don't take things too critically!  Grin

I'm just saying that there is some room for improvement, but you're definitely in the ballpark.  However, I doubt any of this is due to your GUI code.  You'd have to do something really 'lazy' for that to make much difference.

Your code for timing events could be improved though - maybe do the initial play() / start() whatever in the actionPerformed() method, and then post subsequent events into a Timer or ScheduledExecutorService.

For one, Java JButtons don't send events until the MouseUp occurs. So the sounds will naturally seem to fall behind the clicks. Maybe I should create MouseDown sensitive "touchpads." (Cranky Have...other...priorities...)

I'm planning on some of those for JAudioLibs (recently been having conversation with another audio developer about adding some useful GUI widgets) but that won't be until the new year.  Like you - other priorities.

However, quick fix for your applet might be to add mouse listeners to the JButtons instead of action listeners, and fire on mousePressed().

We need a smiley icon for "bangs-head-against-wall".

I'm sure we used to have one of those?!

Offline philfrei
« Reply #31 - Posted 2011-11-11 08:02:24 »

@nsigma Thanks for the suggestion about attaching a MouseListener to the JButtons. I didn't realize that was an option. Clueless The demo works much better! I also put the starts of the RayGuns prior to the Thread creation. Seems to help. I don't think it would be wise to do this to the Machine gun. Because the timing of the shots needs to be very even, I want it all in one place.

I added an 'Options' MenuBar for picking an output line, in case there is a Linux user or someone else who is having troubles such as we've discussed before with output lines.

The only other red flag was from ra4king. I've confirmed that other people have hit the same issue with Java 7 and backwards compatibility with audio. There's already thread on it at the Oracle Forum for Java Sound. They are calling it a bug and have registered it with Oracle, but I suspect my fix (avoiding using InputStream) is going to be fine. Am awaiting any confirmation that this fix works! Hopefully ra4king tries again or someone else with Java 7 gives the demo a try and let's me know if it works now or not.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #32 - Posted 2011-11-11 22:34:24 »

It works now!! Hooray!!! Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline philfrei
« Reply #33 - Posted 2011-11-11 22:44:31 »

Whoo hoo! You made my day.
Now I go to the 6 other forums where I was asking about this and follow up...

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (34 views)
2013-05-17 21:29:12

alaslipknot (42 views)
2013-05-16 21:24:48

gouessej (72 views)
2013-05-16 00:53:38

gouessej (71 views)
2013-05-16 00:17:58

theagentd (79 views)
2013-05-15 15:01:13

theagentd (74 views)
2013-05-15 15:00:54

StreetDoggy (116 views)
2013-05-14 15:56:26

kutucuk (139 views)
2013-05-12 17:10:36

kutucuk (140 views)
2013-05-12 15:36:09

UnluckyDevil (147 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.11 seconds with 21 queries.