示例#1
0
 public void Dispose()
 {
     try
     {
         Stop();
         System.Threading.Thread.Sleep(250);
         if (output != null)
         {
             output.Kill();
             output.Dispose();
         }
         stream.Close();
         stream.Dispose();
         stream = AudioStream.NullStream;
         preloadStream.Close();
         preloadStream.Dispose();
         preloadStream = AudioStream.NullStream;
         AudioStreamFile.FreeBassPlugins();
         AudioStreamFile.UnregisterBASS();
         OutputASIO.Unload();
     }
     catch { }
 }
示例#2
0
        public static Output GetOutput(string Name, int Frequency, Form ParentForm, GetSampleDelegate Callback16, GetSampleDelegate Callback24, Player Player)
        {
            try
            {
                if (OutputASIO.DeviceExists(Name))
                {
                    Output o = new OutputASIO(Name, Frequency, Callback24, Callback16, Player);

                    if (o != null && o.Playing)
                    {
                        return(o);
                    }
                    else
                    {
                        Controller.ShowMessage("ASIO output failed; using default output device.");
                        return(new OutputDX(String.Empty, Frequency, Callback16, ParentForm, Player));
                    }
                }
            }
            catch { }

            return(new OutputDX(Name, Frequency, Callback16, ParentForm, Player));
        }
示例#3
0
        public frmOptions() : base(Localization.Get(UI_Key.Options_Title, Application.ProductName), ButtonCreateType.OKAndCancel)
        {
            this.SPACING = 4;

            tabs = new Dictionary <QButton, List <Control> >();

            InitializeComponent();

            QButton        button   = new QButton("Primary Options", true, false);
            List <Control> controls = new List <Control>();

            tabs.Add(button, controls);
            button.Value          = true;
            button.ButtonPressed += clickTab;

            topMargin = PADDING + button.Height + SPACING + SPACING;

            lblSound = new QLabel(Localization.Get(UI_Key.Options_Label_Sound), Styles.FontBold);
            controls.Add(lblSound);

            chkAutoClippingControl = new QCheckBox(Localization.Get(UI_Key.Options_Auto_Clipping_Control), this.BackColor);
            controls.Add(chkAutoClippingControl);

            lblSoundDevice = new QLabel("Specify a sound output device:");
            controls.Add(lblSoundDevice);

            cboSoundDevice = new QComboBox(false);
            cboSoundDevice.Items.AddRange(OutputDX.GetDeviceNames());
            cboSoundDevice.SelectedIndexChanged += new EventHandler(cboSoundDevice_SelectedIndexChanged);

            asioDevices = OutputASIO.GetDeviceNames().ToArray();
            cboSoundDevice.Items.AddRange(asioDevices);

            chkVolumeControlsWindowsVolume = new QCheckBox(Localization.Get(UI_Key.Options_Volume_Controls_Windows_Volume, Application.ProductName), this.BackColor);

            if (!Lib.IsVistaOrLater)
            {
                controls.Add(chkVolumeControlsWindowsVolume);
            }
            else
            {
                chkVolumeControlsWindowsVolume.Visible = false;
            }

            if (cboSoundDevice.Items.Count > 0)
            {
                cboSoundDevice.SelectedIndex = 0;
                cboSoundDevice.AutoSetWidth();
            }
            controls.Add(cboSoundDevice);

            lblDisplay = new QLabel(Localization.Get(UI_Key.Options_Label_Display), Styles.FontBold);
            controls.Add(lblDisplay);

            chkIncludeTagCloud = new QCheckBox(Localization.Get(UI_Key.Options_Include_Tag_Cloud), this.BackColor);
            controls.Add(chkIncludeTagCloud);

            chkDisableScreensavers = new QCheckBox(Localization.Get(UI_Key.Options_Disable_Screensaver), this.BackColor);
            controls.Add(chkDisableScreensavers);

            chkDisableScreensaversOnlyWhenPlaying = new QCheckBox("Only When Playing", this.BackColor);
            controls.Add(chkDisableScreensaversOnlyWhenPlaying);

            chkShowGridOnSpectrum = new QCheckBox(Localization.Get(UI_Key.Options_Spectrum_Show_Grid), this.BackColor);
            controls.Add(chkShowGridOnSpectrum);

            button                = new QButton("Secondary Options", true, false);
            button.Value          = false;
            button.ButtonPressed += clickTab;
            controls              = new List <Control>();
            tabs.Add(button, controls);

            lblInternet = new QLabel(Localization.Get(UI_Key.Options_Label_Internet), Styles.FontBold);
            controls.Add(lblInternet);

            chkAutoCheckUpdates = new QCheckBox(Localization.Get(UI_Key.Options_Auto_Check_Updates), this.BackColor);
            controls.Add(chkAutoCheckUpdates);

            chkDownloadCoverArt = new QCheckBox(Localization.Get(UI_Key.Options_Download_Cover_Art), this.BackColor);
            controls.Add(chkDownloadCoverArt);

            lblArtSave         = new QLabel(Localization.Get(UI_Key.Options_Save_Art_Caption));
            lblArtSave.Enabled = false;
            controls.Add(lblArtSave);

            cboArtSave = new QComboBox(false);
            cboArtSave.Items.Add(Localization.Get(UI_Key.Options_Save_Art_Folder_JPG));
            cboArtSave.Items.Add(Localization.Get(UI_Key.Options_Save_Art_Artist_Album));
            cboArtSave.Items.Add(Localization.Get(UI_Key.Options_Save_Art_None));
            cboArtSave.AutoSetWidth();
            cboArtSave.Enabled = false;
            controls.Add(cboArtSave);

            lblMisc = new QLabel(Localization.Get(UI_Key.Options_Label_Other), Styles.FontBold);
            controls.Add(lblMisc);

            chkUseGlobalHotkeys = new QCheckBox(Localization.Get(UI_Key.Options_Use_Global_Hotkeys), this.BackColor);
            controls.Add(chkUseGlobalHotkeys);

            spnShortTracks = new QSpin(true,
                                       true,
                                       Localization.Get(UI_Key.Options_Dont_Load_Shorter_Than),
                                       Localization.Get(UI_Key.Options_Dont_Load_Seconds),
                                       1,
                                       60,
                                       10,
                                       5,
                                       this.BackColor);

            spnShortTracks.OffEquivalent = 0;
            controls.Add(spnShortTracks);

            chkDownloadCoverArt.CheckedChanged += (s, e) =>
            {
                lblArtSave.Enabled = chkDownloadCoverArt.Checked;
                cboArtSave.Enabled = chkDownloadCoverArt.Checked;
            };

            chkStopClearsNowPlaying = new QCheckBox("Stop clears Now Playing", this.BackColor);
            controls.Add(chkStopClearsNowPlaying);

            chkSaveNowPlayingOnExit = new QCheckBox("Save Now Playing on exit", this.BackColor);
            controls.Add(chkSaveNowPlayingOnExit);

            bool isFirst  = true;
            int  tabIndex = 0;

            foreach (KeyValuePair <QButton, List <Control> > kvp in tabs)
            {
                this.Controls.Add(kvp.Key);
                kvp.Key.TabIndex = tabIndex++;
                foreach (Control c in kvp.Value)
                {
                    c.Visible = isFirst;
                    this.Controls.Add(c);
                }
                isFirst = false;
            }

            cboSoundDevice.TabIndex = tabIndex++;

            if (!Lib.IsVistaOrLater)
            {
                chkVolumeControlsWindowsVolume.TabIndex = tabIndex++;
            }

            chkAutoClippingControl.TabIndex = tabIndex++;

            chkIncludeTagCloud.TabIndex     = tabIndex++;
            chkDisableScreensavers.TabIndex = tabIndex++;
            chkDisableScreensaversOnlyWhenPlaying.TabIndex = tabIndex++;
            chkShowGridOnSpectrum.TabIndex = tabIndex++;
            chkAutoCheckUpdates.TabIndex   = tabIndex++;
            chkDownloadCoverArt.TabIndex   = tabIndex++;
            cboArtSave.TabIndex            = tabIndex++;

            chkUseGlobalHotkeys.TabIndex     = tabIndex++;
            chkStopClearsNowPlaying.TabIndex = tabIndex++;
            chkSaveNowPlayingOnExit.TabIndex = tabIndex++;
            spnShortTracks.TabIndex          = tabIndex++;

            btnOK.TabIndex     = tabIndex++;
            btnCancel.TabIndex = tabIndex++;

            arrangeLayout();
        }