mp3 sound effect makes my computer generate an FFS audio decoder simultaneously
Code :
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
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?
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?