Exemple #1
0
 Sound(URL soundPath, float gain) {
   this.soundPath = soundPath;
   try {
     AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(soundPath);
     sound = AudioSystem.getClip();
     sound.open(audioInputStream);
     gainControl = (FloatControl) sound.getControl(FloatControl.Type.MASTER_GAIN);
     gainControl.setValue(gain);
   } catch (Exception e) {
     System.out.println("The sound from file " + String.valueOf(soundPath) + "was not found!");
     System.out.println(e);
   } // Satisfy the catch
 }
Exemple #2
0
 public void changeGain(float gain) {
   gainControl.setValue(gain);
 }