Class MixerManager


  • public class MixerManager
    extends java.lang.Object
    Class to manage audio devices.
    Author:
    K.Jaensch, klausj@phonetik.uni-muenchen.de
    • Field Detail

      • KNOWN_PORTS

        public static javax.sound.sampled.Port.Info[] KNOWN_PORTS
    • Constructor Detail

      • MixerManager

        public MixerManager()
        Create new device manager.
        Throws:
        javax.sound.sampled.LineUnavailableException
    • Method Detail

      • getPlaybackMixers

        public javax.sound.sampled.Mixer[] getPlaybackMixers()
                                                      throws javax.sound.sampled.LineUnavailableException
        Get available playback devices.
        Returns:
        array of playback devices
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getCaptureMixerByName

        public javax.sound.sampled.Mixer getCaptureMixerByName​(java.lang.String name)
      • getCaptureMixerByName

        public javax.sound.sampled.Mixer getCaptureMixerByName​(java.lang.String name,
                                                               boolean open)
                                                        throws javax.sound.sampled.LineUnavailableException
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getPlaybackMixerByName

        public javax.sound.sampled.Mixer getPlaybackMixerByName​(java.lang.String name)
      • getPlaybackMixerByName

        public javax.sound.sampled.Mixer getPlaybackMixerByName​(java.lang.String name,
                                                                boolean open)
                                                         throws javax.sound.sampled.LineUnavailableException
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getPlaybackMixers

        public javax.sound.sampled.Mixer[] getPlaybackMixers​(boolean open)
                                                      throws javax.sound.sampled.LineUnavailableException
        Get available playback devices
        Parameters:
        open - if true open each mixer to check for additional lines
        Returns:
        array of playback devices
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getDirectPlaybackMixers

        public javax.sound.sampled.Mixer[] getDirectPlaybackMixers()
                                                            throws javax.sound.sampled.LineUnavailableException
        Get playback devices ignoring 'java Sound Audio Engine'. This is more or less a workaround method: Under Linux JRE 1.4.2 the 'Java Sound Audio Engine' needs about some seconds to open.
        Returns:
        playback mixers without 'Java Sound Audio Engine'
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getDirectPlaybackMixers

        public javax.sound.sampled.Mixer[] getDirectPlaybackMixers​(boolean open)
                                                            throws javax.sound.sampled.LineUnavailableException
        Get playback devices ignoring 'java Sound Audio Engine'. This is more or less a workaround method: Under Linux JRE 1.4.2 the 'Java Sound Audio Engine' needs about some seconds to open.
        Parameters:
        open - if true open each mixer to check for additional lines
        Returns:
        playback mixers without 'Java Sound Audio Engine'
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getPlaybackMixerInfos

        public javax.sound.sampled.Mixer.Info[] getPlaybackMixerInfos()
                                                               throws javax.sound.sampled.LineUnavailableException
        Get infos of available playback devices.
        Returns:
        array of playback devices
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getPlaybackMixerInfos

        public javax.sound.sampled.Mixer.Info[] getPlaybackMixerInfos​(boolean open)
                                                               throws javax.sound.sampled.LineUnavailableException
        Get infos of available playback devices.
        Parameters:
        open - if true open each mixer to check for additional lines
        Returns:
        array of playback devices
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getCaptureMixers

        public javax.sound.sampled.Mixer[] getCaptureMixers()
                                                     throws javax.sound.sampled.LineUnavailableException
        Get available capture devices.
        Returns:
        array of capture devices
        Throws:
        javax.sound.sampled.LineUnavailableException
        javax.sound.sampled.LineUnavailableException
      • getCaptureMixers

        public javax.sound.sampled.Mixer[] getCaptureMixers​(boolean open)
                                                     throws javax.sound.sampled.LineUnavailableException
        Get available capture devices.
        Parameters:
        open - f true open each mixer to check for additional lines
        Returns:
        array of capture devices
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getCaptureMixerInfos

        public javax.sound.sampled.Mixer.Info[] getCaptureMixerInfos()
                                                              throws javax.sound.sampled.LineUnavailableException
        Get infos of available capture devices.
        Returns:
        array of capture devices
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getCaptureMixerInfos

        public javax.sound.sampled.Mixer.Info[] getCaptureMixerInfos​(boolean open)
                                                              throws javax.sound.sampled.LineUnavailableException
        Get infos of available capture devices.
        Parameters:
        open - if true open each mixer to check for additional lines
        Returns:
        array of capture devices
        Throws:
        javax.sound.sampled.LineUnavailableException
      • getSelectedCaptureMixer

        public javax.sound.sampled.Mixer getSelectedCaptureMixer()
        Get selected capture device.
        Returns:
        selected capture mixer
      • getSelectedPlaybackMixer

        public javax.sound.sampled.Mixer getSelectedPlaybackMixer()
        Get selected playback device.
        Returns:
        selected playback mixer
      • setSelectedCaptureMixer

        public void setSelectedCaptureMixer​(javax.sound.sampled.Mixer mixer)
        Set selected capture device.
        Parameters:
        mixer - selected capture mixer
      • setSelectedPlaybackMixer

        public void setSelectedPlaybackMixer​(javax.sound.sampled.Mixer mixer)
        Set selected playback device.
        Parameters:
        mixer - selected playback mixer
      • printPort

        public java.lang.String printPort​(javax.sound.sampled.Mixer m,
                                          javax.sound.sampled.Port.Info pi)
                                   throws javax.sound.sampled.LineUnavailableException
        Throws:
        javax.sound.sampled.LineUnavailableException
      • printPortControls

        public java.lang.String printPortControls()
                                           throws javax.sound.sampled.LineUnavailableException
        Throws:
        javax.sound.sampled.LineUnavailableException
      • fireSelectedPlaybackMixerChanged

        protected void fireSelectedPlaybackMixerChanged()
      • fireSelectedCaptureMixerChanged

        protected void fireSelectedCaptureMixerChanged()
      • setSelectedPlaybackMixer

        public void setSelectedPlaybackMixer​(javax.sound.sampled.Mixer.Info info)
        Parameters:
        info -
      • setSelectedCaptureMixer

        public void setSelectedCaptureMixer​(javax.sound.sampled.Mixer.Info selectedCaptureMixerInfo)
        Parameters:
        selectedCaptureMixerInfo -
      • main

        public static void main​(java.lang.String[] args)