How to play audio in Java Application

前端 未结 4 2006
悲&欢浪女
悲&欢浪女 2020-12-07 05:40

I\'m making a java application and I need to play audio. I\'m playing mainly small sound files of my cannon firing (its a cannon shooting game) and the projectiles exploding

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 06:07

    You should create a thread that handles the audio playback. But make sure that it is able to mix in sounds, so two shots that happen after each other can get their sounds played at the correct time, without waiting for the prior sound to finish. There should be Frameworks out there that do the mixing for you.

    A good starting point is: http://www.oracle.com/technetwork/java/javase/tech/index-jsp-140239.html

提交回复
热议问题