Package javax.sound.sampled

Examples of javax.sound.sampled.Mixer$Info


    Mixer.Info mixers[]=AudioSystem.getMixerInfo();
    audioDebugDump("getMixerInfo() : 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("getMixerInfo() : 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("getMixerInfo() : Match !");
        return m.getMixerInfo();
      }
    }
    //if no mixer found, returns null which is the default mixer on the machine
    if (debugAudio==true) audioDebugDump("getMixerInfo() : Nothing found !");
    return null;
View Full Code Here


/**
* @author Tako Schotanus
*/
public class run_ {
    public static void main(String[] args) throws Exception {
        Mixer mixer = AudioSystem.getMixer(null);
        Mixer.Info[] mixers = AudioSystem.getMixerInfo();
        Type[] fileTypes = AudioSystem.getAudioFileTypes();
        boolean moduleHasMixer = mixer != null;
        int moduleMixerCount = mixers.length;
        int moduleFileTypeCount = fileTypes.length;
View Full Code Here

        testArchive(module, lib1, lib2);
    }

    @Test
    public void testAudioMixerServices() throws Throwable {
        Mixer mixer = AudioSystem.getMixer(null);
        Mixer.Info[] mixers = AudioSystem.getMixerInfo();
        Type[] fileTypes = AudioSystem.getAudioFileTypes();
        boolean plainHasMixer = mixer != null;
        int plainMixerCount = mixers.length;
        int plainFileTypeCount = fileTypes.length;
View Full Code Here

                        SoftMixingMixerProvider.lockthread = Thread
                                .currentThread();
                    }

                    try {
                        Mixer defaultmixer = AudioSystem.getMixer(null);
                        if (defaultmixer != null)
                        {
                            // Search for suitable line

                            DataLine.Info idealinfo = null;
                            AudioFormat idealformat = null;

                            Line.Info[] lineinfos = defaultmixer.getSourceLineInfo();
                            idealFound:
                            for (int i = 0; i < lineinfos.length; i++) {
                                if(lineinfos[i].getLineClass() == SourceDataLine.class)
                                {
                                    DataLine.Info info = (DataLine.Info)lineinfos[i];
                                    AudioFormat[] formats = info.getFormats();
                                    for (int j = 0; j < formats.length; j++) {
                                        AudioFormat format = formats[j];
                                        if(format.getChannels() == 2 ||
                                                format.getChannels() == AudioSystem.NOT_SPECIFIED)
                                        if(format.getEncoding().equals(Encoding.PCM_SIGNED) ||
                                                format.getEncoding().equals(Encoding.PCM_UNSIGNED))
                                        if(format.getSampleRate() == AudioSystem.NOT_SPECIFIED ||
                                                format.getSampleRate() == 48000.0)
                                        if(format.getSampleSizeInBits() == AudioSystem.NOT_SPECIFIED ||
                                                format.getSampleSizeInBits() == 16)
                                        {
                                            idealinfo = info;
                                            int ideal_channels = format.getChannels();
                                            boolean ideal_signed = format.getEncoding().equals(Encoding.PCM_SIGNED);
                                            float ideal_rate = format.getSampleRate();
                                            boolean ideal_endian = format.isBigEndian();
                                            int ideal_bits = format.getSampleSizeInBits();
                                            if(ideal_bits == AudioSystem.NOT_SPECIFIED) ideal_bits = 16;
                                            if(ideal_channels == AudioSystem.NOT_SPECIFIED) ideal_channels = 2;
                                            if(ideal_rate == AudioSystem.NOT_SPECIFIED) ideal_rate = 48000;
                                            idealformat = new AudioFormat(ideal_rate, ideal_bits,
                                                    ideal_channels, ideal_signed, ideal_endian);
                                            break idealFound;
                                        }
                                    }
                                }
                            }

                            if(idealformat != null)
                            {
                                format = idealformat;
                                line = (SourceDataLine) defaultmixer.getLine(idealinfo);
                            }
                        }

                        if(line == null)
                            line = AudioSystem.getSourceDataLine(format);
View Full Code Here

     * Gets the maximum number of simultaneous sounds with the specified
     * AudioFormat that the default mixer can play.
     */
    public static int getMaxSimultaneousSounds(AudioFormat playbackFormat) {
        DataLine.Info lineInfo = new DataLine.Info(SourceDataLine.class, playbackFormat);
        Mixer mixer = AudioSystem.getMixer(null);

        final int max = mixer.getMaxLines(lineInfo);
        return max != AudioSystem.NOT_SPECIFIED ? max : MAX_SIMULTANEOUS;
    }
View Full Code Here

    protected void cleanUp() {
        // signal to unpause
        setPaused(false);

        // close the mixer (stops any running sounds)
        Mixer mixer = AudioSystem.getMixer(null);
        if (mixer.isOpen()) {
            mixer.close();
        }
    }
View Full Code Here

  }

  private static void runVolumeCommand(Closure closure) {
    Mixer.Info[] infos = AudioSystem.getMixerInfo();
    for (Mixer.Info info : infos) {
      Mixer mixer = AudioSystem.getMixer(info);
      if (mixer.isLineSupported(Port.Info.SPEAKER)) {
        Port port;
        try {
          port = (Port) mixer.getLine(Port.Info.SPEAKER);
          port.open();
          if (port.isControlSupported(FloatControl.Type.VOLUME)) {
            FloatControl volume = (FloatControl) port.getControl(FloatControl.Type.VOLUME);
            closure.execute(volume);
          }
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.