private void setupMicrophone(String name) {
        Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo();

        for (Mixer.Info info : mixerInfos) {
            if (!info.getName().equals(name)) {
                continue;
            }

            Mixer mixer = AudioSystem.getMixer(info);
            int maxLines = mixer.getMaxLines(Port.Info.MICROPHONE);
            Port lineIn = null;
            if (maxLines > 0) {
                try {
                    lineIn = (Port) mixer.getLine(Port.Info.MICROPHONE);
                    lineIn.open();
                    CompoundControl cc = (CompoundControl) lineIn.getControls()[0];
                    Control[] controls = cc.getMemberControls();
                    for (Control c : controls) {
                        if (c.getType() == BooleanControl.Type.MUTE) {
                            this.muteControl = (BooleanControl) c;
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }

        if (this.muteControl == null) {
            JOptionPane.showMessageDialog(null, "Couldn't find the mute control for the microphone!", "Error",
                    JOptionPane.ERROR_MESSAGE);
            System.exit(1);
        }
    }