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 3 of 3

Thread: mp3 sound effect makes my computer generate an FFS audio decoder simultaneously

  1. #1
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default mp3 sound effect makes my computer generate an FFS audio decoder simultaneously

    package kkk;
     
    import java.io.File;
    import javax.media.Manager;
    import javax.media.Player;
    import javax.swing.JOptionPane;
     
    public class GunFireSoundEffect  {
     
        private Player player;
     
        public void gunFireSound() {
     
            File file = new File("C:\\KKKFOLDER\\rShot.mp3");
     
            try {
                player = Manager.createPlayer(file.toURL());
                player.start(); // start player
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, "Invalid file or location",
                        "Error loading file", JOptionPane.ERROR_MESSAGE);
            }
        }
     
        public static void main(String[] args) {
     
            new GunFireSoundEffect().gunFireSound();
        }
    }

    this code for a gun fire sound effect works perfectly fine.. im using it in the game that im creating .. where the enemy shoots. i put it in the loop where the gun fire animation happens. the problem is that every time the the gunFireSound() method is being called.. there is something poping out in my task bar everytime the sound effect is being generated... how can i resolve this one?

    it seems like an mp3 player or a player is simultaneously being opened everytime i generate the sound.. i just need a sound effet.. thats all


  2. #2
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: mp3 sound effect makes my computer generate an FFS audio decoder simultaneously

    hmm ill try to make the problem as clear as possible... as i tried digging even deeper into the problem.. i notice that im not just generating an mp3 file im also generating a Sound Media Controller which is the FFS thing.. im using a Player class that loads a Player not only a sound. i use to see its icon on my taskbar everytime the sound is being generated..

    my question is.. what class should i call to simply generate a sound.. generating the sound without a media controller?
    or is my question right enough?

  3. #3
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: mp3 sound effect makes my computer generate an FFS audio decoder simultaneously

    the problem is .. i dont know what right word should i ask google to deal with the problem..

    1.) how to generate a simple sound in java?
    2.) how to import an mp3 sound in java without an opening media?

Similar Threads

  1. How to use PrintSteam and BufferedReader Simultaneously
    By bigmac025 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 29th, 2011, 07:30 AM
  2. Send and Receive data from socket simultaneously
    By bigmac025 in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: March 25th, 2011, 05:18 PM
  3. Replies: 1
    Last Post: December 6th, 2010, 10:09 AM
  4. How to create a pointer type of effect for objects
    By zelalem in forum Object Oriented Programming
    Replies: 6
    Last Post: October 20th, 2010, 02:53 AM
  5. Audioclip play makes applets slow
    By Marcus in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 19th, 2010, 01:20 PM