java - how to change the volume of a clip when it is playing -


ok using example load sound in program

public static void playsound(string url,int vol){     try {         audioinputstream audioinputstream = audiosystem.getaudioinputstream(soundsengine.class.getresource("/resources/sounds/"+url+".wav"));         clip clip = audiosystem.getclip();         clip.open(audioinputstream);         floatcontrol gaincontrol = (floatcontrol) clip.getcontrol(floatcontrol.type.master_gain);         gaincontrol.setvalue(vol);         clip.start();         clip.loop(clip.loop_continuously);     } catch(exception ex) {         system.out.println("error playing sound.");         ex.printstacktrace();     } } 

}

i wandering if there ways change volume without stopping loop?? im not sure have done correctly first time working sounds in java, tried running playsound() again vol integer different ended opening more files, information, using jslider change volume, in advance appreciated


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

delphi - Indy UDP Read Contents of Adata -