Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: pause while playing sound

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default pause while playing sound

    i'm making a battleships game for a school assignment and i'm playing a sound when a boat is either hit or sunk. The sound plays fine but how do i make the program pause while the sound is playing?

    thanks


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: pause while playing sound

    The details will all depend on how you are implementing your game including which graphics and GUI library you're using (AWT? Swing? AWT? Android?...?) and of course your game logic. Since you've asked a general question without the details, all I can give is a general answer: model your game in an MVC (model-view-control) fashion, and make the model unresponsive to user interaction via the control when sound is playing.

    If you need more detailed help, consider telling us more of the necessary details about your program and your problem so that we can more fully understand the problem.

Similar Threads

  1. Playing sound in my nursing program
    By loui345 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 19th, 2012, 08:26 PM
  2. Need help playing sound in backround of a program in a loop.(Please Fix my code!)
    By DusteroftheCentury in forum What's Wrong With My Code?
    Replies: 30
    Last Post: January 21st, 2012, 01:14 AM
  3. Replies: 0
    Last Post: January 12th, 2012, 02:54 PM
  4. Playing sound in an applet
    By Skyhigh32 in forum Java Theory & Questions
    Replies: 1
    Last Post: June 3rd, 2011, 07:41 AM
  5. playing sound using java
    By sdhilipan89 in forum Java Applets
    Replies: 6
    Last Post: March 25th, 2010, 08:59 AM