0

I was creating a Audio Player in Java using JMF API but i am stucked in creating volume controls (setMute() is throwing Exception) and integrating them with JSlider. Heres the code for Mute Functionality:

public void volume()
{
     if(ismute)
     {   
         gc.setMute(false); *//GainControls gc*
         volbutton.setIcon(new ImageIcon("Volume.png"));
         ismute = false;
     }
     else
     {
         gc.setMute(true);
         volbutton.setIcon(new ImageIcon("Mute.png"));
         ismute = true;
     }
}
Piyush Pant
  • 35
  • 1
  • 6
  • *"Also How should .."* Each question thread should be limited to **one** question because someone might know the answer to one but not the other & avoid answering at all, because of that. SO is a Q&A site, not a help desk. Please decide which of the questions you'd like this thread devoted to, and move the other to a separate thread. – Andrew Thompson Nov 02 '17 at 00:28
  • You can tell what you know .. – Piyush Pant Nov 03 '17 at 05:45
  • Good call on splitting the other question out. For better help sooner, post a [MCVE] or [Short, Self Contained, Correct Example](http://www.sscce.org/). The only way to make an MCVE / SSCCE that will run here is to hot-link to a sound sample (load it by URL directly from the code - make sure it's small in byte size!) or to generate a tone in code. BTW - why not use either the [`javax.sound.Clip`](https://docs.oracle.com/javase/8/docs/api/javax/sound/sampled/Clip.html) or the Java-FX based [`MediaPlayer`](https://docs.oracle.com/javafx/2/api/javafx/scene/media/MediaPlayer.html) instead? .. – Andrew Thompson Nov 03 '17 at 06:11
  • .. Both can achieve this goal, and have the distinction that they have actually been supported within the last decade (as opposed to JMF, which is effectively 'abandon ware'). – Andrew Thompson Nov 03 '17 at 06:12
  • *"generate a tone in code"* E.G. as seen in [this answer](https://stackoverflow.com/a/8632160/418556) (it uses a `Clip` to play the tone). – Andrew Thompson Nov 03 '17 at 06:21

0 Answers0