Package javax.sound.sampled

Examples of javax.sound.sampled.FloatControl$Type


    if (c == null) {
      return;
    }

    if (properties.getOptionsSoundEnableMixerPan() && c.isControlSupported(FloatControl.Type.PAN)) {
      FloatControl panCtrl = (FloatControl) c.getControl(FloatControl.Type.PAN);

      panCtrl.setValue(pan);
    }
    if (properties.getOptionsSoundEnableMixerVolume() && c.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
      FloatControl volCtrl = (FloatControl) c.getControl(FloatControl.Type.MASTER_GAIN);

      float min = volCtrl.getMinimum() / 4;

      if (volume != 1) {
        volCtrl.setValue(min * (1 - volume));
      }
    }
    c.loop(loop);
  }
View Full Code Here


    //No need to mix something that isn't playing
    if( audioChannel == null ) return;
         
    //Adjust sound speed
    if( (effects & MIX_SPEED) != 0 && line.isControlSupported(FloatControl.Type.SAMPLE_RATE) ) {
      FloatControl gainControl = (FloatControl)line.getControl(FloatControl.Type.SAMPLE_RATE);
      float sampleRate = soundFormat.getFrameRate() * speed;
      sampleRate = Math.max(gainControl.getMinimum(), Math.min(sampleRate, gainControl.getMaximum()));
      gainControl.setValue(sampleRate);
    }
   
    //Adjust sound balance
    if( (effects & MIX_PANNING) != 0 && line.isControlSupported(FloatControl.Type.PAN) ) {
      FloatControl gainControl = (FloatControl)line.getControl(FloatControl.Type.PAN);
      panning = Math.max(gainControl.getMinimum(), Math.min(panning, gainControl.getMaximum()));
      gainControl.setValue(panning);
    }

    //Set sound volume
    if( (effects & MIX_VOLUME) != 0 && line.isControlSupported(FloatControl.Type.MASTER_GAIN) ) {
      FloatControl gainControl = (FloatControl)line.getControl(FloatControl.Type.MASTER_GAIN)
      float gain = (float)(Math.log(volume)/Math.log(10.0f)*20.0f);
      gain = Math.max(gainControl.getMinimum(), Math.min(gain, gainControl.getMaximum()));
      gainControl.setValue(gain)
    }
  }
View Full Code Here

    }

    myClip.start();

    if (myClip.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
      FloatControl volume = (FloatControl) myClip.getControl(FloatControl.Type.MASTER_GAIN);
      float maximum = volume.getMaximum();
      volume.setValue(maximum);
    }
  }
View Full Code Here

    delayAmount = amount;
  }

  public void setVolume() {
    if (outputLine.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
      FloatControl volume = (FloatControl) outputLine.getControl(FloatControl.Type.MASTER_GAIN);
      float minimum = volume.getMinimum();
      float maximum = volume.getMaximum();
      float currentVolume = (float) (minimum + percentLevelVolume * (maximum - minimum) / 100.0F);
      volume.setValue(currentVolume);
    }

  }
View Full Code Here

  }

  public void setVolume(double percentLevel) {
    if (outputLine.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
      percentLevelVolume = percentLevel;
      FloatControl volume = (FloatControl) outputLine.getControl(FloatControl.Type.MASTER_GAIN);
      float minimum = volume.getMinimum();
      float maximum = volume.getMaximum();
      float currentVolume = (float) (minimum + percentLevelVolume * (maximum - minimum) / 100.0F);
      volume.setValue(currentVolume);
    }

  }
View Full Code Here

            e.printStackTrace();
            return;
        }
            fCont = (FloatControl) auline.getControl(FloatControl.Type.VOLUME);
        if (auline.isControlSupported(FloatControl.Type.PAN)) {
            FloatControl pan = (FloatControl) auline
                    .getControl(FloatControl.Type.PAN);

            if (curPosition == Position.RIGHT)
                pan.setValue(1.0f);
            else if (curPosition == Position.LEFT)
                pan.setValue(-1.0f);
        }
        auline.start();
        int nBytesRead = 0;
        byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
View Full Code Here

            e.printStackTrace();
            return;
        }

        if (auline.isControlSupported(FloatControl.Type.PAN)) {
            FloatControl pan = (FloatControl) auline
                    .getControl(FloatControl.Type.PAN);
            if (curPosition == Position.RIGHT)
                pan.setValue(1.0f);
            else if (curPosition == Position.LEFT)
                pan.setValue(-1.0f);
        }

        auline.start();
        int nBytesRead = 0;
        byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
View Full Code Here

      if (outputLine == null) {
        return;
      }
     
      try {
        FloatControl control = (FloatControl) outputLine.getControl(FloatControl.Type.MASTER_GAIN);
        if (gain == -1) {
          control.setValue(0);
        } else {
          float max = control.getMaximum();
          float min = control.getMinimum(); // negative values all seem to be zero?
          float range = max - min;
         
          control.setValue(min+(range*gain));
        }
      } catch (IllegalArgumentException e) {
        // gain not supported
        e.printStackTrace();
      }
View Full Code Here

      if (outputLine == null) {
        return;
      }
     
      try {
        FloatControl control = (FloatControl) outputLine.getControl(FloatControl.Type.BALANCE);
        control.setValue(balance);
      } catch (IllegalArgumentException e) {
        // balance not supported
      }
    }
View Full Code Here

            e.printStackTrace();
            return;
        }

        if (auline.isControlSupported(FloatControl.Type.PAN)) {
            FloatControl pan = (FloatControl) auline.getControl(FloatControl.Type.PAN);
            if (curPosition == Position.RIGHT) {
                pan.setValue(1.0f);
            } else if (curPosition == Position.LEFT) {
                pan.setValue(-1.0f);
            }
        }

        auline.start();
        int nBytesRead = 0;
View Full Code Here

TOP

Related Classes of javax.sound.sampled.FloatControl$Type

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.