Package javax.sound.sampled

Examples of javax.sound.sampled.Mixer$Info


        }

        AudioFormat audioFormat = new AudioFormat(16000.0F, 16, 1, true, true);
        audioFormat = getBestAudioFormat(audioFormat, mixer);
        DataLine.Info info = new DataLine.Info(TargetDataLine.class, audioFormat);
        Mixer selectedMixer = getSelectedMixer(mixer);
        if (selectedMixer == null) {

            m_line = (TargetDataLine) AudioSystem.getLine(info);
            selectedMixer = AudioSystem.getMixer(null);

        } else {
            m_line = (TargetDataLine) selectedMixer.getLine(info);
        }
        m_line.open(audioFormat);

        //FloatControl fc = (FloatControl) selectedMixer.getControl(FloatControl.Type.MASTER_GAIN);
        //System.out.println("Master Gain min: " + fc.getMinimum());
View Full Code Here


    public static final String dumpLineInfo(String selectedMixerIndex) {
        System.out.println("Selected Mixer: " + selectedMixerIndex);
        if ("".equals(selectedMixerIndex) || selectedMixerIndex == null) {
            return "";
        }
        Mixer mixer = getSelectedMixer(selectedMixerIndex);
        if (mixer == null) {
            return "Default Audio device.";
        }
        Line.Info[] lineInfo = mixer.getTargetLineInfo();
        StringBuilder info = new StringBuilder("");
        if (lineInfo != null) {
            for (int i = 0; i < lineInfo.length; i++) {
                if (lineInfo[i] instanceof DataLine.Info) {
                    AudioFormat[] formats =
View Full Code Here

    public static final List<String> dumpMixers() {
        /** Lists all the available audio devices. */
        Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
        List<String> results = new ArrayList<String>();
        for (int i = 0; i < mixerInfo.length; i++) {
            Mixer mixer = AudioSystem.getMixer(mixerInfo[i]);
            StringBuilder builder = new StringBuilder();
            builder.append("Mixer[" + i + "]: \""
                    + mixerInfo[i].getName() + "\"");
            builder.append(" "
                    + mixerInfo[i].getDescription());
View Full Code Here

       

        AudioFormat audioFormat = new AudioFormat(config.getWavSampleRate(), config.getWavSampleSize(), 1, true, true);
        audioFormat = SimpleAudioRecorder.getBestAudioFormat(audioFormat, mixer);
        DataLine.Info info = new DataLine.Info(TargetDataLine.class, audioFormat);
        Mixer selectedMixer = SimpleAudioRecorder.getSelectedMixer(mixer);
        if (selectedMixer == null) {

            m_line = (TargetDataLine) AudioSystem.getLine(info);
            selectedMixer = AudioSystem.getMixer(null);

        } else {
            m_line = (TargetDataLine) selectedMixer.getLine(info);
        }
        m_line.open(audioFormat);

        //FloatControl fc = (FloatControl) selectedMixer.getControl(FloatControl.Type.MASTER_GAIN);
        //System.out.println("Master Gain min: " + fc.getMinimum());
View Full Code Here

    ArrayList<Mixer.Info> targetMixers = new ArrayList<Mixer.Info>();

    Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo();

    for (int i = 0; i < mixerInfos.length; i++) {
      Mixer mixer = AudioSystem.getMixer(mixerInfos[i]);
      try {
        mixer.open();
      } catch (LineUnavailableException e) {
        e.printStackTrace();
      }
      Line.Info[] targetLines = mixer.getTargetLineInfo();
      for (Line.Info info : targetLines) {
        if (info.getLineClass() == TargetDataLine.class) {
          targetMixers.add(mixerInfos[i]);
        }
      }
      mixer.close();
    }

    return targetMixers;
  }
View Full Code Here

    ArrayList<Mixer.Info> sourceMixers = new ArrayList<Mixer.Info>();

    Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo();

    for (int i = 0; i < mixerInfos.length; i++) {
      Mixer mixer = AudioSystem.getMixer(mixerInfos[i]);
      try {
        mixer.open();
      } catch (LineUnavailableException e) {
        e.printStackTrace();
      }
      Line.Info[] sourceLines = mixer.getSourceLineInfo();
      for (Line.Info info : sourceLines) {
        if (info.getLineClass() == SourceDataLine.class) {
          sourceMixers.add(mixerInfos[i]);
        }
      }
      mixer.close();
    }

    return sourceMixers;
  }
View Full Code Here

    //list the available mixers
    Mixer.Info mixers[]=AudioSystem.getMixerInfo();
    int i;
    //iterate the mixers and display TargetLines
    for (i=0;i<mixers.length;i++){
      Mixer m=AudioSystem.getMixer(mixers[i]);
      Line.Info l[]=m.getTargetLineInfo();
      // Check these exist and are "Capture" devices
      if((l.length>0)&&((m.getMixerInfo().getDescription().endsWith("Capture")==true))){
        int x;
        for (x=0;x<l.length;x++){
          if (l[0].getLineClass().getName().equals("javax.sound.sampled.TargetDataLine"))  {
            AudioMixer mc=new AudioMixer(mixers[i].getName(),m,l[x]);
            devices.add(mc);     
View Full Code Here

 
  /**
   * Set the default line for the default mixer
   */
  public void setDefaultLine(){
      Mixer mx = AudioSystem.getMixer(null)//default mixer
      this.setMixer(mx);
    DataLine.Info info = getDataLineInfo()
    try  {
      this.line = (TargetDataLine) AudioSystem.getLine(info);
    }catch(LineUnavailableException ex){
View Full Code Here

  /**
   * Change the mixer and restart the TargetDataLine
   * @param mixerName
   */
  public boolean changeMixer(String mixerName) {
    Mixer mx=null;
    try  {
      //stop current line
      this.line.stop();
      this.line.close();
      this.line.flush();
      // Record this mixer change
      if (debugAudio==true) audioDebugDump("changeMixer() : mixerName="+mixerName);
      //set the new mixer and line
      mx=getMixer(mixerName);
      // If null we have a problem so return false
      if (mx==null)  {
        if (debugAudio==true) audioDebugDump("changeMixer() : mx==null");
        return false;
      }
      this.setMixer(mx);
      this.line=(TargetDataLine) getDataLineForMixer();
      //restart
      if (openLine()==false)  {
        if (debugAudio==true) audioDebugDump("changeMixer() : openLine()==false");
        return false;
      }
      this.line.start();
    }
    catch (Exception e)  {
      // Record the exception
      errorMsg="changeMixer() : "+e.getMessage();
      // then if a mixer has been obtained then display some information about it
      if (mx!=null)  {
        Mixer.Info mInfo=mx.getMixerInfo();
        errorMsg=errorMsg+"\nMixer Name : "+mInfo.getName()+"\nMixer Description : "+mInfo.getDescription();
      }
      audioDebugDump(errorMsg);
      return false;
    }
View Full Code Here

    Mixer.Info mixers[]=AudioSystem.getMixerInfo();
    if (debugAudio==true) audioDebugDump("getMixer() : Hunting for "+mixerName);
    // Iterate through the mixers and display TargetLines
    int i;
    for (i=0;i<mixers.length;i++){
      Mixer m=AudioSystem.getMixer(mixers[i]);
      if (debugAudio==true) audioDebugDump("getMixer() : Found "+m.getMixerInfo().getName()+" + "+m.getMixerInfo().getDescription());
      // Ensure that only sound capture devices can be selected
      boolean isCaptureDevice=m.getMixerInfo().getDescription().endsWith("Capture");
      if ((m.getMixerInfo().getName().equals(mixerName))&&(isCaptureDevice==true)){
        if (debugAudio==true) audioDebugDump("getMixer() : Match !");
        return m;
      }
    }
    //if no mixer found, returns null which is the default mixer on the machine
View Full Code Here

TOP

Related Classes of javax.sound.sampled.Mixer$Info

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.