Package com.tulskiy.musique.audio.player.io

Examples of com.tulskiy.musique.audio.player.io.AudioOutput


        panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 5, 30));

        Box mainBox = Box.createVerticalBox();
        JPanel misc = new JPanel(new GridLayout(2, 2, 10, 10));

        final AudioOutput output = app.getPlayer().getAudioOutput();

        Box mix = Box.createHorizontalBox();
        mix.add(new JLabel("Audio Mixer: "));
        Vector<String> mixerVector = new Vector<String>();
        mixerVector.add("Detect automatically");
        final Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
        int selectedIndex = Arrays.asList(mixerInfo).indexOf(output.getMixer());
        for (Mixer.Info info : mixerInfo) {
            String s = info.getDescription() + ", " + info.getName();
            mixerVector.add(s);
        }
        final JComboBox mixers = new JComboBox(mixerVector);
        mixers.setSelectedIndex(selectedIndex + 1);
        mixers.setPrototypeDisplayValue(mixerVector.get(0));
        mix.add(mixers);
        mainBox.add(mix);
        mainBox.add(Box.createVerticalStrut(5));
        mainBox.add(misc);

        misc.add(new JLabel("Default Encoding for Tags"));
        Charset charset = AudioFileReader.getDefaultCharset();
        final JComboBox encoding = new JComboBox(Charset.availableCharsets().values().toArray());
        encoding.setSelectedItem(charset);
        misc.add(encoding);

        final JCheckBox oneInstance = new JCheckBox("Allow only one instance (needs restart)");
        oneInstance.setSelected(config.getBoolean("system.oneInstance", false));
        misc.add(oneInstance);

        panel.add(mainBox, BorderLayout.NORTH);

        applyButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                int index = mixers.getSelectedIndex();
                if (index > 0) {
                    Mixer.Info info = mixerInfo[index - 1];
                    output.setMixer(info);
                } else {
                    output.setMixer(null);
                }
                AudioFileReader.setDefaultCharset((Charset) encoding.getSelectedItem());
                config.setBoolean("system.oneInstance", oneInstance.isSelected());
            }
        });
View Full Code Here


        initColorsAndFontsSettings();
        initPluginsSettings();
    }

    private void initSystemSettings() {
        final AudioOutput output = app.getPlayer().getAudioOutput();

        Vector<String> mixerVector = new Vector<String>();
        mixerVector.add("Detect automatically");
        final Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
        int selectedIndex = Arrays.asList(mixerInfo).indexOf(output.getMixer());
        for (Mixer.Info info : mixerInfo) {
            String s = info.getDescription() + ", " + info.getName();
            mixerVector.add(s);
        }

        audioMixer.setModel(new DefaultComboBoxModel(mixerVector));
        audioMixer.setSelectedIndex(selectedIndex + 1);
        audioMixer.setPrototypeDisplayValue(mixerVector.get(0));

        Charset charset = AudioFileReader.getDefaultCharset();
        defaultEncoding.setModel(new DefaultComboBoxModel(Charset.availableCharsets().values().toArray()));
        defaultEncoding.setSelectedItem(charset);

        singleInstance.setSelected(config.getBoolean("system.oneInstance", false));

        applyButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                int index = audioMixer.getSelectedIndex();
                if (index > 0) {
                    Mixer.Info info = mixerInfo[index - 1];
                    output.setMixer(info);
                    config.setString("player.mixer", info.getName());
                } else {
                    output.setMixer(null);
                    config.remove("player.mixer");
                }
                Charset defaultCharset = (Charset) defaultEncoding.getSelectedItem();
                AudioFileReader.setDefaultCharset(defaultCharset);
                config.setString("tag.defaultEncoding", defaultCharset.name());
View Full Code Here

    }

    private void loadSettings() {
//        System.setProperty("http.agent", "Mozilla/5.001 (windows; U; NT4.0; en-US; rv:1.0) Gecko/25250101");

        AudioOutput audioOutput = player.getAudioOutput();
        audioOutput.setVolume(configuration.getFloat("player.volume", 1));
        String mixer = configuration.getString("player.mixer", null);
        if (mixer != null) {
            Mixer.Info[] infos = AudioSystem.getMixerInfo();
            for (Mixer.Info info : infos) {
                if (info.getName().equals(mixer)) {
                    audioOutput.setMixer(info);
                    break;
                }
            }
        }
        if (configuration.getBoolean("proxy.enabled", false)) {
View Full Code Here

TOP

Related Classes of com.tulskiy.musique.audio.player.io.AudioOutput

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.