# SoundEngin problme mit lautstärke reglung



## MrTroble (1. Mai 2015)

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

```
public static synchronized void playSoundAPI(final String URL , final boolean Replay){	 if(PlaySound.getBoolean("!Mute", true)){
	 new Thread(new Runnable() {
		
		public void run() {
     Mixer.Info[] m = AudioSystem.getMixerInfo();
     mix = AudioSystem.getMixer(m[0]);
     DataLine.Info det = new DataLine.Info(Clip.class, null);
     try{clip = (Clip)mix.getLine(det);}catch(LineUnavailableException ex){ ex.printStackTrace(); }
     try{
    		 AudioInputStream inputStream = AudioSystem.getAudioInputStream(Game.class.getResourceAsStream(URL + ".wav"));
    		    clip = AudioSystem.getClip();
    	        clip.open(inputStream);
    	        System.out.println(URL);
    	        System.out.printf(mix.getMixerInfo().getDescription() + "%n");
    	        System.out.println(clip.getMicrosecondLength() + "micSek");
     }catch(LineUnavailableException e){e.printStackTrace();}
      catch(IOException e){e.printStackTrace();System.out.println("it locks like the file is not found");}
      catch(UnsupportedAudioFileException e){e.printStackTrace();System.out.println("it locks like the Sound has an incorect format");}
     mix.isControlSupported(FloatControl.Type.VOLUME);
	 FloatControl volCtrl = (FloatControl)clip.getControl(Type.VOLUME);
     volCtrl.setValue((float) 10.0);
     clip.start();
     while(true){
     if(clip.getMicrosecondLength() == clip.getMicrosecondPosition()){
    	 clip.stop();
    	if(Replay){run();}else{Thread.yield();}}
		}}}
	 ).start();
 }
 }
```

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


----------

