vendredi 1 mai 2015

SoundEngin problme mit lautstärke reglung

halli hallo
ich habe mal wieder ein problem und zwar hab ich eine Sound Engin Programiert :
Java Code:

  1.  
  2. public static synchronized void playSoundAPI(final String URL , final boolean Replay){ if(PlaySound.getBoolean("!Mute", true)){
  3. new Thread(new Runnable() {
  4.  
  5. public void run() {
  6. Mixer.Info[] m = AudioSystem.getMixerInfo();
  7. mix = AudioSystem.getMixer(m[0]);
  8. DataLine.Info det = new DataLine.Info(Clip.class, null);
  9. try{clip = (Clip)mix.getLine(det);}catch(LineUnavailableException ex){ ex.printStackTrace(); }
  10. try{
  11. AudioInputStream inputStream = AudioSystem.getAudioInputStream(Game.class.getResourceAsStream(URL + ".wav"));
  12. clip = AudioSystem.getClip();
  13. clip.open(inputStream);
  14. System.out.println(URL);
  15. System.out.printf(mix.getMixerInfo().getDescription() + "%n");
  16. System.out.println(clip.getMicrosecondLength() + "micSek");
  17. }catch(LineUnavailableException e){e.printStackTrace();}
  18. catch(IOException e){e.printStackTrace();System.out.println("it locks like the file is not found");}
  19. catch(UnsupportedAudioFileException e){e.printStackTrace();System.out.println("it locks like the Sound has an incorect format");}
  20. mix.isControlSupported(FloatControl.Type.VOLUME);
  21. FloatControl volCtrl = (FloatControl)clip.getControl(Type.VOLUME);
  22. volCtrl.setValue((float) 10.0);
  23. clip.start();
  24. while(true){
  25. if(clip.getMicrosecondLength() == clip.getMicrosecondPosition()){
  26. clip.stop();
  27. if(Replay){run();}else{Thread.yield();}}
  28. }}}
  29. ).start();
  30. }
  31. }


so jetzt bekomm ich da wegen der versuchten Volume Float verenderung dise fehlrmeldung

Exception in thread "Thread-4" java.lang.IllegalArgumentException: Unsupported control type: Volume
at com.sun.media.sound.AbstractLine.getControl(Unknown Source)
at com.weebly.Blackoutupdate.Blackout.Game$1.run(Game.java:61)
at java.lang.Thread.run(Unknown Source)

ich hoffe irgend wer kann helfen

Danke schon mal im vorraus


SoundEngin problme mit lautstärke reglung

0 commentaires:

Enregistrer un commentaire