title: How to set volume of a SourceDataLine in Java
body: <p>I'm trying to make an mp3 player in java and I can`t figure out how to control the volume in it.</p>
  
  <p>I've tried something like this:</p>
  
  <pre><code>         // Adjust the volume on the output line.
           if (dataLine.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
               FloatControl volume = (FloatControl) dataLine.getControl(FloatControl.Type.MASTER_GAIN);
              volume.setValue(100.0F);
           }
  </code></pre>
  
  <p>Everything I have written until this code worked fine but apparently the dataLine is NOT control Supported because it jumps over this IF statement.</p>
  
  <p>My question is this : Do you have any idea why this is happening and how could I work this issue around so that I could control the volume of my application?</p>