Exemplo n.º 1
0
        public VisualizationBase(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
            : this()
        {
            VizPluginInfo       = vizPluginInfo;
            VisualizationWindow = vizCtrl;

            // Init BAssVis
            IntPtr hInstance = Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]);

            switch (VizPluginInfo.VisualizationType)
            {
            case VisualizationInfo.PluginType.Sonique:
                BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_SONIQUE, GUIGraphicsContext.form.Handle);
                _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_SONIQUE);
                break;

            case VisualizationInfo.PluginType.Winamp:
                BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_WINAMP, GUIGraphicsContext.form.Handle);
                _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_WINAMP);
                break;

            case VisualizationInfo.PluginType.Bassbox:
                BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_BASSBOX, GUIGraphicsContext.form.Handle);
                _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_BASSBOX);
                break;
            }
        }
        /// <summary>
        /// Retrieve Information about WMP Plugins
        /// </summary>
        /// <returns></returns>
        private List <VisualizationInfo> GetWMPPluginInfo()
        {
            List <VisualizationInfo> wmpPlugins = new List <VisualizationInfo>();

            try
            {
                using (RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\MediaPlayer\\Objects\\Effects"))
                {
                    string[] subKeyNames = key.GetSubKeyNames();


                    for (int i = 0; i < subKeyNames.Length; i++)
                    {
                        using (RegistryKey subKey = key.OpenSubKey(subKeyNames[i] + "\\Properties"))
                        {
                            string            sCLSID     = (string)subKey.GetValue("classid");
                            VisualizationInfo wmpVizInfo = LoadWMPPlugin(sCLSID);

                            if (wmpVizInfo != null && !wmpVizInfo.IsBlackListed)
                            {
                                wmpPlugins.Add(wmpVizInfo);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("VisualisationManager: Failed to get wmp plugin info - {0}", ex.ToString());
            }

            return(wmpPlugins);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Determines whether the member values of the specified VisualizationInfo object
        /// are the same as the current VisualizationInfo object
        /// <param name="vizInfo"></param>
        /// <returns>true if data is identical</returns>
        /// </summary>
        public bool IsIdenticalTo(VisualizationInfo vizInfo)
        {
            if (this._Name != vizInfo._Name)
            {
                return(false);
            }

            if (this._CLSID != vizInfo.CLSID)
            {
                return(false);
            }

            if (this.FilePath != vizInfo.FilePath)
            {
                return(false);
            }

            if (this.IsCOMPlugin != vizInfo.IsCOMPlugin)
            {
                return(false);
            }

            if (this.IsDummyPlugin != vizInfo.IsDummyPlugin)
            {
                return(false);
            }

            if (this.VisualizationType != vizInfo.VisualizationType)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
 private void SaveCurrentViz(VisualizationInfo vizPluginInfo)
 {
     using (Profile.Settings xmlwriter = new Profile.MPSettings())
     {
         xmlwriter.SetValue("musicvisualization", "name", vizPluginInfo.Name);
         xmlwriter.SetValue("musicvisualization", "vizType", ((int)vizPluginInfo.VisualizationType).ToString());
         xmlwriter.SetValue("musicvisualization", "path", vizPluginInfo.FilePath);
         xmlwriter.SetValue("musicvisualization", "clsid", vizPluginInfo.CLSID);
         xmlwriter.SetValue("musicvisualization", "preset", vizPluginInfo.PresetIndex.ToString());
     }
 }
 public SoundSpectrumViz(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
     : base(vizPluginInfo, vizCtrl)
 {
     Log.Info("Visualization Manager: Creating {0} callback...", vizPluginInfo.Name);
     SoundSpectrumInterop.SSCallback = new SoundSpectrumInterop.SSCallbackDelegate(SSCallbackFunc);
     SSVisualizationName             = vizPluginInfo.Name;
     using (Settings xmlreader = new MPSettings())
     {
         _autoHideMouse = xmlreader.GetValueAsBool("general", "autohidemouse", true);
     }
     Log.Info("Visualization Manager: Callback created.");
 }
        /// <summary>
        /// Load the specified WMP Plugin
        /// </summary>
        /// <param name="sCLSID"></param>
        /// <returns></returns>
        private VisualizationInfo LoadWMPPlugin(string sCLSID)
        {
            try
            {
                WMPVisualizationInfo wmpVizInfo = null;

                try
                {
                    wmpVizInfo = new WMPVisualizationInfo(sCLSID);

                    if (wmpVizInfo == null)
                    {
                        return(null);
                    }

                    string        vizName = wmpVizInfo.Title;
                    List <string> presets = wmpVizInfo.Presets;

                    VisualizationInfo vizPluginInfo = new VisualizationInfo(VisualizationInfo.PluginType.WMP, "", vizName, sCLSID,
                                                                            presets);
                    return(vizPluginInfo);
                }

                catch (Exception)
                {
                    return(null);
                }

                finally
                {
                    if (wmpVizInfo != null)
                    {
                        wmpVizInfo.SafeDispose();
                        wmpVizInfo = null;
                    }
                }
            }

            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return(null);
            }
        }
Exemplo n.º 7
0
        public void GetNextVis()
        {
            int i = GetCurrentVizIndex();

            if (i > -1 && i < _VisualizationPluginsInfo.Count - 1)
            {
                if (CreateVisualization(_VisualizationPluginsInfo[i + 1]))
                {
                    VizRenderWindow.Run = true;
                    VisualizationInfo currentVis = _VisualizationPluginsInfo[i + 1];
                    SaveCurrentViz(currentVis);
                }
            }
            else
            {
                // if last plugin entry reached then use the first plugin in the list
                CurrentViz = _VisualizationPluginsInfo[0].Name;
                OldVizType = VisualizationInfo.PluginType.None;
                GetNextVis();
            }
        }
Exemplo n.º 8
0
        public void GetPrevVis()
        {
            int i = GetCurrentVizIndex();

            if (i > 1) // We still have "None" in the List
            {
                if (CreateVisualization(_VisualizationPluginsInfo[i - 1]))
                {
                    VizRenderWindow.Run = true;
                    VisualizationInfo currentVis = _VisualizationPluginsInfo[i - 1];
                    SaveCurrentViz(currentVis);
                }
            }
            else
            {
                // if first plugin entry reached then use last entry in the list
                CurrentViz = _VisualizationPluginsInfo[_VisualizationPluginsInfo.Count - 1].Name;
                OldVizType = VisualizationInfo.PluginType.None;
                GetPrevVis();
            }
        }
 public bool CreateVisualization(VisualizationInfo vizPluginInfo)
 {
     return(InternalCreateVisualization(vizPluginInfo, false));
 }
Exemplo n.º 10
0
    public override void LoadSettings()
    {
      using (Settings xmlreader = new MPSettings())
      {
        // Player Settings
        audioPlayerComboBox.SelectedItem = xmlreader.GetValueAsString("audioplayer", "player", "BASS engine");
        enableMixing.Checked = xmlreader.GetValueAsBool("audioplayer", "mixing", false);

        // Get all available devices and add them to the combo box
        BASS_DEVICEINFO[] soundDevices = Bass.BASS_GetDeviceInfos();

        // For Directshow player, we need to have the exact wording here
        if (audioPlayerComboBox.SelectedIndex == 1)
        {
          soundDeviceComboBox.Items.Add("Default DirectSound Device");
        }
        else
        {
          soundDeviceComboBox.Items.Add("Default Sound Device");
        }

        // Fill the combo box, starting at 1 to skip the "No Sound" device
        for (int i = 1; i < soundDevices.Length; i++)
        {
          soundDeviceComboBox.Items.Add(soundDevices[i].name);
        }

        string soundDevice = xmlreader.GetValueAsString("audioplayer", "sounddevice", "None");

        // On first usage, we don't have any sound device
        if (soundDevice == "None")
        {
          soundDeviceComboBox.SelectedIndex = 0;
        }
        else
        {
          soundDeviceComboBox.SelectedItem = soundDevice;
        }

        int crossFadeMS = xmlreader.GetValueAsInt("audioplayer", "crossfade", 4000);

        if (crossFadeMS < 0)
        {
          crossFadeMS = 4000;
        }

        else if (crossFadeMS > hScrollBarCrossFade.Maximum)
        {
          crossFadeMS = hScrollBarCrossFade.Maximum;
        }

        hScrollBarCrossFade.Value = crossFadeMS;

        int bufferingMS = xmlreader.GetValueAsInt("audioplayer", "buffering", 5000);

        if (bufferingMS < hScrollBarBuffering.Minimum)
        {
          bufferingMS = hScrollBarBuffering.Minimum;
        }

        else if (bufferingMS > hScrollBarBuffering.Maximum)
        {
          bufferingMS = hScrollBarBuffering.Maximum;
        }

        hScrollBarBuffering.Value = bufferingMS;

        GaplessPlaybackChkBox.Checked = xmlreader.GetValueAsBool("audioplayer", "gaplessPlayback", false);
        FadeOnStartStopChkbox.Checked = xmlreader.GetValueAsBool("audioplayer", "fadeOnStartStop", true);
        StreamOutputLevelNud.Value = (decimal)xmlreader.GetValueAsInt("audioplayer", "streamOutputLevel", 85);

        // Visualization Settings
        int vizType = xmlreader.GetValueAsInt("musicvisualization", "vizType", (int)VisualizationInfo.PluginType.None);
        string vizName = xmlreader.GetValueAsString("musicvisualization", "name", "None");
        string vizPath = xmlreader.GetValueAsString("musicvisualization", "path", "");
        string vizClsid = xmlreader.GetValueAsString("musicvisualization", "clsid", "");
        int vizPreset = xmlreader.GetValueAsInt("musicvisualization", "preset", 0);

        if (vizType == (int)VisualizationInfo.PluginType.None
            && vizName == "None")
        {
          VizPluginInfo = new VisualizationInfo("None", true);
        }

        else
        {
          VizPluginInfo = new VisualizationInfo((VisualizationInfo.PluginType)vizType, vizPath, vizName, vizClsid,
                                                vizPreset);
        }

        int fps = xmlreader.GetValueAsInt("musicvisualization", "fps", 25);

        if (fps < (int)VisualizationFpsNud.Minimum)
        {
          fps = (int)VisualizationFpsNud.Minimum;
        }

        else if (fps > VisualizationFpsNud.Maximum)
        {
          fps = (int)VisualizationFpsNud.Maximum;
        }

        VisualizationFpsNud.Value = fps;

        EnableStatusOverlaysChkBox.Checked = xmlreader.GetValueAsBool("musicvisualization", "enableStatusOverlays",
                                                                      false);
        ShowTrackInfoChkBox.Checked = xmlreader.GetValueAsBool("musicvisualization", "showTrackInfo", true);
        EnableStatusOverlaysChkBox_CheckedChanged(null, null);

        // Playlist Settings
        string playListFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
        playListFolder += @"\My Playlists";
        playlistFolderTextBox.Text = xmlreader.GetValueAsString("music", "playlists", playListFolder);

        if (string.Compare(playlistFolderTextBox.Text, playListFolder) == 0)
        {
          if (Directory.Exists(playListFolder) == false)
          {
            try
            {
              Directory.CreateDirectory(playListFolder);
            }
            catch (Exception) {}
          }
        }

        repeatPlaylistCheckBox.Checked = xmlreader.GetValueAsBool("musicfiles", "repeat", false);
        autoShuffleCheckBox.Checked = xmlreader.GetValueAsBool("musicfiles", "autoshuffle", false);

        SavePlaylistOnExitChkBox.Checked = xmlreader.GetValueAsBool("musicfiles", "savePlaylistOnExit", true);
        ResumePlaylistChkBox.Checked = xmlreader.GetValueAsBool("musicfiles", "resumePlaylistOnMusicEnter", true);
        PlaylistCurrentCheckBox.Checked = xmlreader.GetValueAsBool("musicfiles", "playlistIsCurrent", true);

        String strSelectOption = xmlreader.GetValueAsString("musicfiles", "selectOption", "play");
        cmbSelectOption.Text = strSelectOption == "play" ? "Play" : "Queue";
        chkAddAllTracks.Checked = xmlreader.GetValueAsBool("musicfiles", "addall", true);

        // Misc Settings
        string playNowJumpTo = xmlreader.GetValueAsString("music", "playnowjumpto", JumpToValue0);

        switch (playNowJumpTo)
        {
          case JumpToValue0:
            PlayNowJumpToCmbBox.Text = JumpToOptions[0];
            break;

          case JumpToValue1:
            PlayNowJumpToCmbBox.Text = JumpToOptions[1];
            break;

          case JumpToValue2:
            PlayNowJumpToCmbBox.Text = JumpToOptions[2];
            break;

          case JumpToValue3:
            PlayNowJumpToCmbBox.Text = JumpToOptions[3];
            break;

          case JumpToValue4:
            PlayNowJumpToCmbBox.Text = JumpToOptions[4];
            break;

          case JumpToValue5:
            PlayNowJumpToCmbBox.Text = JumpToOptions[5];
            break;

          case JumpToValue6:
            PlayNowJumpToCmbBox.Text = JumpToOptions[6];
            break;

          default:
            PlayNowJumpToCmbBox.Text = JumpToOptions[0];
            break;
        }

        string showLyrics = xmlreader.GetValueAsString("musicmisc", "lyrics", LyricsValue0);

        switch (showLyrics)
        {
          case LyricsValue0:
            ShowLyricsCmbBox.Text = ShowLyricsOptions[0];
            break;

          case LyricsValue1:
            ShowLyricsCmbBox.Text = ShowLyricsOptions[1];
            break;

          case LyricsValue2:
            ShowLyricsCmbBox.Text = ShowLyricsOptions[2];
            break;

          default:
            ShowLyricsCmbBox.Text = ShowLyricsOptions[0];
            break;
        }

        ShowVizInNowPlayingChkBox.Checked = xmlreader.GetValueAsBool("musicmisc", "showVisInNowPlaying", false);
        checkBoxDisableCoverLookups.Checked = !(xmlreader.GetValueAsBool("musicmisc", "fetchlastfmcovers", true));
        checkBoxDisableAlbumLookups.Checked = !(xmlreader.GetValueAsBool("musicmisc", "fetchlastfmtopalbums", true));
        checkBoxDisableTagLookups.Checked = !(xmlreader.GetValueAsBool("musicmisc", "fetchlastfmtracktags", true));
        checkBoxSwitchArtistOnLastFMSubmit.Checked = xmlreader.GetValueAsBool("musicmisc", "switchArtistOnLastFMSubmit",
                                                                              false);

        string vuMeter = xmlreader.GetValueAsString("musicmisc", "vumeter", "none");

        switch (vuMeter)
        {
          case VUMeterValue0:
            radioButtonVUNone.Checked = true;
            break;

          case VUMeterValue1:
            radioButtonVUAnalog.Checked = true;
            break;

          case VUMeterValue2:
            radioButtonVULed.Checked = true;
            break;

          default:
            radioButtonVUNone.Checked = true;
            break;
        }
      }
    }
Exemplo n.º 11
0
        /// <summary>
        /// Search the Visaulation Path for supported Vis
        /// </summary>
        /// <returns></returns>
        public List <VisualizationInfo> GetVisualizationPluginsInfo()
        {
            _VisualizationPluginsInfo.Clear();
            try
            {
                _VisualizationPluginsInfo.Add(new VisualizationInfo("None", true));

                // Close any Visualisation, which we may have running, because of VizManager Init
                CloseCurrentVisualization();

                string skinFolderPath = Path.Combine(Application.StartupPath, @"musicplayer\plugins\visualizations");

                // Search for Sonique and Winamp Plugins
                string[] soniqueVisPaths = BassVis.BASSVIS_FindPlugins(BASSVISKind.BASSVISKIND_SONIQUE, skinFolderPath, true);

                // Note: Recursive Searches for Winamp Plugins are not supported
                // Winamp plugins expect itself to be stored in a folder named Plugins in the root of the executable. This is where we will search
                // So this is the folder where all the MP Plugins are stored as well
                skinFolderPath = Path.Combine(Application.StartupPath, @"plugins");
                string[] winampVisPaths = BassVis.BASSVIS_FindPlugins(BASSVISKind.BASSVISKIND_WINAMP, skinFolderPath, true);

                List <VisualizationInfo> wmpPluginsInfo = GetWMPPluginInfo();

                if (IsGForceInstalled())
                {
                    VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.GForce, string.Empty, "G-Force",
                                                                      string.Empty, null);
                    _VisualizationPluginsInfo.Add(vizInfo);
                }

                if (IsWhiteCapInstalled())
                {
                    VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.WhiteCap, string.Empty,
                                                                      "WhiteCap", string.Empty, null);
                    _VisualizationPluginsInfo.Add(vizInfo);
                }

                if (IsSoftSkiesInstalled())
                {
                    VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.SoftSkies, string.Empty,
                                                                      "SoftSkies", string.Empty, null);
                    _VisualizationPluginsInfo.Add(vizInfo);
                }

                if (wmpPluginsInfo != null)
                {
                    for (int i = 0; i < wmpPluginsInfo.Count; i++)
                    {
                        _VisualizationPluginsInfo.Add(wmpPluginsInfo[i]);
                    }
                }

                if (soniqueVisPaths != null && soniqueVisPaths[0] != "")
                {
                    BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_SONIQUE, VizRenderWindow.Handle);
                    _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_SONIQUE);
                    for (int i = 0; i < soniqueVisPaths.Length; i++)
                    {
                        string       filePath = soniqueVisPaths[i];
                        string       name     = Path.GetFileNameWithoutExtension(filePath);
                        BASSVIS_EXEC visExec  = new BASSVIS_EXEC(filePath);
                        visExec.SON_Flags      = BASSVISFlags.BASSVIS_NOINIT; // don't execute the plugin yet
                        visExec.SON_ConfigFile = Path.Combine(Path.GetDirectoryName(filePath), "vis.ini");

                        if (_visParam.VisHandle != 0)
                        {
                            int counter = 0;

                            bool bFree = BassVis.BASSVIS_Free(_visParam);
                            while ((!bFree) && (counter <= 10))
                            {
                                bFree = BassVis.BASSVIS_IsFree(_visParam);
                                System.Windows.Forms.Application.DoEvents();
                                counter++;
                            }
                            _visParam.VisHandle = 0;
                        }

                        BassVis.BASSVIS_ExecutePlugin(visExec, _visParam);

                        string pluginname = BassVis.BASSVIS_GetPluginName(_visParam);
                        if (pluginname != null)
                        {
                            name = pluginname;
                        }

                        VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.Sonique, filePath, name,
                                                                          string.Empty, null);
                        _VisualizationPluginsInfo.Add(vizInfo);
                    }
                    BassVis.BASSVIS_Quit(_visParam);
                }

                if (winampVisPaths != null && winampVisPaths[0] != "")
                {
                    _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_WINAMP);
                    for (int i = 0; i < winampVisPaths.Length; i++)
                    {
                        List <string> presets  = new List <string>();
                        string        filePath = winampVisPaths[i];
                        string        name     = Path.GetFileNameWithoutExtension(filePath);
                        _visParam.VisHandle = BassVis.BASSVIS_GetPluginHandle(BASSVISKind.BASSVISKIND_WINAMP, filePath);

                        string pluginname = BassVis.BASSVIS_GetPluginName(_visParam);
                        if (pluginname != null)
                        {
                            name = pluginname;
                        }

                        // Get modules
                        int numModules = BassVis.BASSVIS_GetModulePresetCount(_visParam, filePath);
                        if (numModules > 0)
                        {
                            if (numModules > 0)
                            {
                                for (int j = 0; j < numModules; j++)
                                {
                                    presets.Add(BassVis.BASSVIS_GetModulePresetName(_visParam, j, filePath));
                                }
                            }
                            VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.Winamp, filePath, name,
                                                                              string.Empty, presets);
                            if (!vizInfo.IsBlackListed)
                            {
                                _VisualizationPluginsInfo.Add(vizInfo);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("VisualisationManager: Failed to get viz plugins - {0}", ex.ToString());
            }
            return(_VisualizationPluginsInfo);
        }
Exemplo n.º 12
0
 public WinampViz(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
     : base(vizPluginInfo, vizCtrl)
 {
 }
Exemplo n.º 13
0
    /// <summary>
    /// Determines whether the member values of the specified VisualizationInfo object
    /// are the same as the current VisualizationInfo object
    /// <param name="vizInfo"></param>
    /// <returns>true if data is identical</returns>
    /// </summary>
    public bool IsIdenticalTo(VisualizationInfo vizInfo)
    {
      if (this._Name != vizInfo._Name)
      {
        return false;
      }

      if (this._CLSID != vizInfo.CLSID)
      {
        return false;
      }

      if (this.FilePath != vizInfo.FilePath)
      {
        return false;
      }

      if (this.IsCOMPlugin != vizInfo.IsCOMPlugin)
      {
        return false;
      }

      if (this.IsDummyPlugin != vizInfo.IsDummyPlugin)
      {
        return false;
      }

      if (this.VisualizationType != vizInfo.VisualizationType)
      {
        return false;
      }

      return true;
    }
Exemplo n.º 14
0
    public VisualizationBase(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
      : this()
    {
      VizPluginInfo = vizPluginInfo;
      VisualizationWindow = vizCtrl;

      // Init BAssVis
      IntPtr hInstance = Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]);
      switch (VizPluginInfo.VisualizationType)
      {
        case VisualizationInfo.PluginType.Sonique:
          BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_SONIQUE, GUIGraphicsContext.form.Handle);
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_SONIQUE);
          break;

        case VisualizationInfo.PluginType.Winamp:
          BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_WINAMP, GUIGraphicsContext.form.Handle);
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_WINAMP);
          break;

        case VisualizationInfo.PluginType.Bassbox:
          BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_BASSBOX, GUIGraphicsContext.form.Handle);
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_BASSBOX);
          break;
      }
    }
Exemplo n.º 15
0
 public WinampViz(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
   : base(vizPluginInfo, vizCtrl) {}
Exemplo n.º 16
0
    /// <summary>
    /// Load Settings
    /// </summary>
    private void LoadSettings()
    {
      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        int vizType = xmlreader.GetValueAsInt("musicvisualization", "vizType", (int)VisualizationInfo.PluginType.None);
        string vizName = xmlreader.GetValueAsString("musicvisualization", "name", "");
        string vizPath = xmlreader.GetValueAsString("musicvisualization", "path", "");
        string vizClsid = xmlreader.GetValueAsString("musicvisualization", "clsid", "");
        int vizPreset = xmlreader.GetValueAsInt("musicvisualization", "preset", 0);

        VizPluginInfo = new VisualizationInfo((VisualizationInfo.PluginType)vizType, vizPath, vizName, vizClsid,
                                              vizPreset);

        if (vizType == (int)VisualizationInfo.PluginType.Sonique)
        {
          VizPluginInfo.UseOpenGL = xmlreader.GetValueAsBool("musicvisualization", "useOpenGL", true);
          VizPluginInfo.RenderTiming = xmlreader.GetValueAsInt("musicvisualization", "renderTiming", 25);
          VizPluginInfo.ViewPortSize = xmlreader.GetValueAsInt("musicvisualization", "viewPort", 0);
        }

        VizFPS = xmlreader.GetValueAsInt("musicvisualization", "fps", 30);
      }
    }
Exemplo n.º 17
0
 public SoundSpectrumViz(VisualizationInfo vizPluginInfo)
 {
     SSVisualizationName = vizPluginInfo.Name;
 }
Exemplo n.º 18
0
    /// <summary>
    /// Determines whether the member values of the specified VisualizationInfo object
    /// are the same as the current VisualizationInfo object
    /// <param name="vizInfo"></param>
    /// <returns>true if data is identical</returns>
    /// </summary>
    public bool IsIdenticalTo(VisualizationInfo vizInfo, bool doSimpleCheck)
    {
      if (this._Name != vizInfo._Name)
      {
        return false;
      }

      if (this._CLSID != vizInfo.CLSID)
      {
        return false;
      }

      if (this.FilePath != vizInfo.FilePath)
      {
        return false;
      }

      if (this.IsCOMPlugin != vizInfo.IsCOMPlugin)
      {
        return false;
      }

      if (this.IsDummyPlugin != vizInfo.IsDummyPlugin)
      {
        return false;
      }

      if (this.PresetIndex != vizInfo.PresetIndex)
      {
        return false;
      }

      if (this.VisualizationType != vizInfo.VisualizationType)
      {
        return false;
      }

      if (!doSimpleCheck)
      {
        if (this.HasPresets != vizInfo.HasPresets)
        {
          return false;
        }


        if (this.PresetNames.Count != vizInfo.PresetNames.Count)
        {
          return false;
        }

        for (int i = 0; i < this.PresetNames.Count; i++)
        {
          if (this.PresetNames[i] != vizInfo.PresetNames[i])
          {
            return false;
          }
        }
      }

      return true;
    }
 private void SaveCurrentViz(VisualizationInfo vizPluginInfo)
 {
   using (Profile.Settings xmlwriter = new Profile.MPSettings())
   {
     xmlwriter.SetValue("musicvisualization", "name", vizPluginInfo.Name);
     xmlwriter.SetValue("musicvisualization", "vizType", ((int)vizPluginInfo.VisualizationType).ToString());
     xmlwriter.SetValue("musicvisualization", "path", vizPluginInfo.FilePath);
     xmlwriter.SetValue("musicvisualization", "clsid", vizPluginInfo.CLSID);
     xmlwriter.SetValue("musicvisualization", "preset", vizPluginInfo.PresetIndex.ToString());
   }
 }
    private bool InternalCreateVisualization(VisualizationInfo vizPluginInfo, bool isPreview)
    {
      // Close VisualType is not a BassVis Kind
      if (vizPluginInfo.VisualizationType != VisualizationInfo.PluginType.Sonique &&
          vizPluginInfo.VisualizationType != VisualizationInfo.PluginType.Winamp &&
          vizPluginInfo.VisualizationType != VisualizationInfo.PluginType.Bassbox)
      {
        CloseCurrentVisualization();
      }
      else
      {
        if (OldVizType != vizPluginInfo.VisualizationType)
        {
          CloseCurrentVisualization();
          OldVizType = vizPluginInfo.VisualizationType;
        }
        else
        {
          switch (OldVizType)
          {
            case VisualizationInfo.PluginType.None:
            case VisualizationInfo.PluginType.Unknown:
              return false;

            case VisualizationInfo.PluginType.Sonique:
              {
                if (Viz.VizParam != null)
                {
                  Log.Info("Visualization Manager: Free Sonique visualization...");
                  BassVis.BASSVIS_Free(Viz.VizParam);
                  bool bFree = BassVis.BASSVIS_IsFree(Viz.VizParam);
                  if (bFree)
                  {
                    Viz.VizParam.VisHandle = 0;
                    Log.Info("Visualization Manager: Sonique visualization " + OldViz + " free succes");
                  }
                }
                break;
              }
            case VisualizationInfo.PluginType.Winamp:
              {
                if (Viz.VizParam != null)
                {
                  Log.Info("Visualization Manager: Free Winamp visualization...");
                  BassVis.BASSVIS_Free(Viz.VizParam);
                  bool bFree = BassVis.BASSVIS_IsFree(Viz.VizParam);
                  if (bFree)
                  {
                    Viz.VizParam.VisHandle = 0;
                    Log.Info("Visualization Manager: Winamp visualization " + OldViz + " free succes");
                  }
                }
                break;
              }

            case VisualizationInfo.PluginType.Bassbox:
              {
                if (Viz.VizParam != null)
                {
                  Log.Info("Visualization Manager: Free Bassbox visualization...");
                  BassVis.BASSVIS_Free(Viz.VizParam);
                  bool bFree = BassVis.BASSVIS_IsFree(Viz.VizParam);
                  if (bFree)
                  {
                    Viz.VizParam.VisHandle = 0;
                    Log.Info("Visualization Manager: Bassbox visualization " + OldViz + " free succes");
                  }
                }
                break;
              }
          }
        }
      }

      CurrentVizType = vizPluginInfo.VisualizationType;
      OldViz = vizPluginInfo.Name;
      CurrentViz = OldViz;

      switch (CurrentVizType)
      {
        case VisualizationInfo.PluginType.None:
        case VisualizationInfo.PluginType.Unknown:
          return false;

        case VisualizationInfo.PluginType.GForce:
          {
            Log.Info("Visualization Manager: Creating new G-Force visualization...");
            Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.WhiteCap:
          {
            Log.Info("Visualization Manager: Creating new WhiteCap visualization...");
            Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.SoftSkies:
          {
            Log.Info("Visualization Manager: Creating new SoftSkies visualization...");
            Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.Sonique:
          {
            Log.Info("Visualization Manager: Creating new Sonique visualization...");
            VizRenderWindow.Refresh();
            Viz = new SoniqueViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.Winamp:
          {
            Log.Info("Visualization Manager: Creating new Winamp visualization...");
            VizRenderWindow.Refresh();
            Viz = new WinampViz(vizPluginInfo, VizRenderWindow);          
            break;
          }

        case VisualizationInfo.PluginType.Bassbox:
          {
            Log.Info("Visualization Manager: Creating new Bassbox visualization...");
            VizRenderWindow.Refresh();
            Viz = new BassboxViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.WMP:
          {
            Log.Info("Visualization Manager: Creating new Windows Media Player visualization...");
            Viz = new WMPViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        default:
          return false;
      }

      VizRenderWindow.Visualization = Viz;

      if (Viz == null)
      {
        return false;
      }

      ((VisualizationBase)Viz).VisualizationCreated +=
        new VisualizationBase.VisualizationCreatedDelegate(OnVisualizationCreated);

      bool result = false;

      if (isPreview)
      {
        VizRenderWindow.IsPreviewVisualization = true;
        result = Viz.InitializePreview();
      }

      else
      {
        VizRenderWindow.IsPreviewVisualization = false;
        result = Viz.Initialize();
      }

      return result;
    }
Exemplo n.º 21
0
    public VisualizationBase(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
      : this()
    {
      VizPluginInfo = vizPluginInfo;
      VisualizationWindow = vizCtrl;

      // Init of BassVis should only used if the BASSVISKind changed remove also here
      switch (VizPluginInfo.VisualizationType)
      {
        case VisualizationInfo.PluginType.Sonique:
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_SONIQUE);
          break;

        case VisualizationInfo.PluginType.Winamp:
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_WINAMP);
          break;

        case VisualizationInfo.PluginType.Bassbox:
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_BASSBOX);
          break;

        case VisualizationInfo.PluginType.WMP:
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_WMP);
          break;
      } 
    }
    /// <summary>
    /// Search the Visaulation Path for supported Vis
    /// </summary>
    /// <returns></returns>
    public List<VisualizationInfo> GetVisualizationPluginsInfo()
    {

      _VisualizationPluginsInfo.Clear();
      try
      {
        _VisualizationPluginsInfo.Add(new VisualizationInfo("None", true));

        // Close any Visualisation, which we may have running, because of VizManager Init
        CloseCurrentVisualization();

        string skinFolderPath = Path.Combine(Application.StartupPath, @"musicplayer\plugins\visualizations");

        // Search for Sonique and Winamp Plugins
        string[] soniqueVisPaths = BassVis.BASSVIS_FindPlugins(BASSVISKind.BASSVISKIND_SONIQUE, skinFolderPath, true);

        // Note: Recursive Searches for Winamp Plugins are not supported
        // Winamp plugins expect itself to be stored in a folder named Plugins in the root of the executable. This is where we will search
        // So this is the folder where all the MP Plugins are stored as well
        skinFolderPath = Path.Combine(Application.StartupPath, @"plugins");
        string[] winampVisPaths = BassVis.BASSVIS_FindPlugins(BASSVISKind.BASSVISKIND_WINAMP, skinFolderPath, true);

        List<VisualizationInfo> wmpPluginsInfo = GetWMPPluginInfo();

        if (IsGForceInstalled())
        {
          VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.GForce, string.Empty, "G-Force",
                                                            string.Empty, null);
          _VisualizationPluginsInfo.Add(vizInfo);
        }

        if (IsWhiteCapInstalled())
        {
          VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.WhiteCap, string.Empty,
                                                            "WhiteCap", string.Empty, null);
          _VisualizationPluginsInfo.Add(vizInfo);
        }

        if (IsSoftSkiesInstalled())
        {
          VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.SoftSkies, string.Empty,
                                                            "SoftSkies", string.Empty, null);
          _VisualizationPluginsInfo.Add(vizInfo);
        }

        if (wmpPluginsInfo != null)
        {
          for (int i = 0; i < wmpPluginsInfo.Count; i++)
          {
            _VisualizationPluginsInfo.Add(wmpPluginsInfo[i]);
          }
        }

        if (soniqueVisPaths != null && soniqueVisPaths[0] != "")
        {
          BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_SONIQUE, VizRenderWindow.Handle);
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_SONIQUE);
          for (int i = 0; i < soniqueVisPaths.Length; i++)
          {
            string filePath = soniqueVisPaths[i];
            string name = Path.GetFileNameWithoutExtension(filePath);
            BASSVIS_EXEC visExec = new BASSVIS_EXEC(filePath);
            visExec.SON_Flags = BASSVISFlags.BASSVIS_NOINIT; // don't execute the plugin yet
            visExec.SON_ConfigFile = Path.Combine(Path.GetDirectoryName(filePath), "vis.ini");

            if (_visParam.VisHandle != 0)
            {
              int counter = 0;

              bool bFree = BassVis.BASSVIS_Free(_visParam);
              while ((!bFree) && (counter <= 10))
              {
                bFree = BassVis.BASSVIS_IsFree(_visParam);
                System.Windows.Forms.Application.DoEvents();
                counter++;
              }
              _visParam.VisHandle = 0;
            }

            BassVis.BASSVIS_ExecutePlugin(visExec, _visParam);

            string pluginname = BassVis.BASSVIS_GetPluginName(_visParam);
            if (pluginname != null)
            {
              name = pluginname;
            }

            VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.Sonique, filePath, name,
                                                              string.Empty, null);
            _VisualizationPluginsInfo.Add(vizInfo);
          }
          BassVis.BASSVIS_Quit(_visParam);
        }

        if (winampVisPaths != null && winampVisPaths[0] != "")
        {
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_WINAMP);
          for (int i = 0; i < winampVisPaths.Length; i++)
          {
            List<string> presets = new List<string>();
            string filePath = winampVisPaths[i];
            string name = Path.GetFileNameWithoutExtension(filePath);
            _visParam.VisHandle = BassVis.BASSVIS_GetPluginHandle(BASSVISKind.BASSVISKIND_WINAMP, filePath);

            string pluginname = BassVis.BASSVIS_GetPluginName(_visParam);
            if (pluginname != null)
              name = pluginname;

            // Get modules
            int numModules = BassVis.BASSVIS_GetModulePresetCount(_visParam, filePath);
            if (numModules > 0)
            {
              if (numModules > 0)
              {
                for (int j = 0; j < numModules; j++)
                {
                  presets.Add(BassVis.BASSVIS_GetModulePresetName(_visParam, j, filePath));
                }
              }
              VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.Winamp, filePath, name,
                                                                string.Empty, presets);
              if (!vizInfo.IsBlackListed)
              {
                _VisualizationPluginsInfo.Add(vizInfo);
              }
            }
          }
        }
      }
      catch (Exception ex)
      {
        Log.Error("VisualisationManager: Failed to get viz plugins - {0}", ex.ToString());
      }
      return _VisualizationPluginsInfo;
    }
Exemplo n.º 23
0
        private bool InternalCreateVisualization(VisualizationInfo vizPluginInfo, bool isPreview)
        {
            // Close VisualType is not a BassVis Kind
            if (vizPluginInfo.VisualizationType != VisualizationInfo.PluginType.Sonique &&
                vizPluginInfo.VisualizationType != VisualizationInfo.PluginType.Winamp &&
                vizPluginInfo.VisualizationType != VisualizationInfo.PluginType.Bassbox)
            {
                CloseCurrentVisualization();
            }
            else
            {
                if (OldVizType != vizPluginInfo.VisualizationType)
                {
                    CloseCurrentVisualization();
                    OldVizType = vizPluginInfo.VisualizationType;
                }
                else
                {
                    switch (OldVizType)
                    {
                    case VisualizationInfo.PluginType.None:
                    case VisualizationInfo.PluginType.Unknown:
                        return(false);

                    case VisualizationInfo.PluginType.Sonique:
                    {
                        if (Viz.VizParam != null)
                        {
                            Log.Info("Visualization Manager: Free Sonique visualization...");
                            BassVis.BASSVIS_Free(Viz.VizParam);
                            bool bFree = BassVis.BASSVIS_IsFree(Viz.VizParam);
                            if (bFree)
                            {
                                Viz.VizParam.VisHandle = 0;
                                Log.Info("Visualization Manager: Sonique visualization " + OldViz + " free succes");
                            }
                        }
                        break;
                    }

                    case VisualizationInfo.PluginType.Winamp:
                    {
                        if (Viz.VizParam != null)
                        {
                            Log.Info("Visualization Manager: Free Winamp visualization...");
                            BassVis.BASSVIS_Free(Viz.VizParam);
                            bool bFree = BassVis.BASSVIS_IsFree(Viz.VizParam);
                            if (bFree)
                            {
                                Viz.VizParam.VisHandle = 0;
                                Log.Info("Visualization Manager: Winamp visualization " + OldViz + " free succes");
                            }
                        }
                        break;
                    }

                    case VisualizationInfo.PluginType.Bassbox:
                    {
                        if (Viz.VizParam != null)
                        {
                            Log.Info("Visualization Manager: Free Bassbox visualization...");
                            BassVis.BASSVIS_Free(Viz.VizParam);
                            bool bFree = BassVis.BASSVIS_IsFree(Viz.VizParam);
                            if (bFree)
                            {
                                Viz.VizParam.VisHandle = 0;
                                Log.Info("Visualization Manager: Bassbox visualization " + OldViz + " free succes");
                            }
                        }
                        break;
                    }
                    }
                }
            }

            CurrentVizType = vizPluginInfo.VisualizationType;
            OldViz         = vizPluginInfo.Name;
            CurrentViz     = OldViz;

            switch (CurrentVizType)
            {
            case VisualizationInfo.PluginType.None:
            case VisualizationInfo.PluginType.Unknown:
                return(false);

            case VisualizationInfo.PluginType.GForce:
            {
                Log.Info("Visualization Manager: Creating new G-Force visualization...");
                Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.WhiteCap:
            {
                Log.Info("Visualization Manager: Creating new WhiteCap visualization...");
                Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.SoftSkies:
            {
                Log.Info("Visualization Manager: Creating new SoftSkies visualization...");
                Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.Sonique:
            {
                Log.Info("Visualization Manager: Creating new Sonique visualization...");
                VizRenderWindow.Refresh();
                Viz = new SoniqueViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.Winamp:
            {
                Log.Info("Visualization Manager: Creating new Winamp visualization...");
                VizRenderWindow.Refresh();
                Viz = new WinampViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.Bassbox:
            {
                Log.Info("Visualization Manager: Creating new Bassbox visualization...");
                VizRenderWindow.Refresh();
                Viz = new BassboxViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.WMP:
            {
                Log.Info("Visualization Manager: Creating new Windows Media Player visualization...");
                Viz = new WMPViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            default:
                return(false);
            }

            VizRenderWindow.Visualization = Viz;

            if (Viz == null)
            {
                return(false);
            }

            ((VisualizationBase)Viz).VisualizationCreated +=
                new VisualizationBase.VisualizationCreatedDelegate(OnVisualizationCreated);

            bool result = false;

            if (isPreview)
            {
                VizRenderWindow.IsPreviewVisualization = true;
                result = Viz.InitializePreview();
            }

            else
            {
                VizRenderWindow.IsPreviewVisualization = false;
                result = Viz.Initialize();
            }

            return(result);
        }
    /// <summary>
    /// Load the specified WMP Plugin
    /// </summary>
    /// <param name="sCLSID"></param>
    /// <returns></returns>
    private VisualizationInfo LoadWMPPlugin(string sCLSID)
    {
      try
      {
        WMPVisualizationInfo wmpVizInfo = null;

        try
        {
          wmpVizInfo = new WMPVisualizationInfo(sCLSID);

          if (wmpVizInfo == null)
          {
            return null;
          }

          string vizName = wmpVizInfo.Title;
          List<string> presets = wmpVizInfo.Presets;

          VisualizationInfo vizPluginInfo = new VisualizationInfo(VisualizationInfo.PluginType.WMP, "", vizName, sCLSID,
                                                                  presets);
          return vizPluginInfo;
        }

        catch (Exception)
        {
          return null;
        }

        finally
        {
          if (wmpVizInfo != null)
          {
            wmpVizInfo.SafeDispose();
            wmpVizInfo = null;
          }
        }
      }

      catch (Exception ex)
      {
        Debug.WriteLine(ex.Message);
        return null;
      }
    }
Exemplo n.º 25
0
 public WMPViz(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
   : base(vizPluginInfo, vizCtrl)
 {
   _IsPreviewVisualization = false;
 }
    private bool InternalCreateVisualization(VisualizationInfo vizPluginInfo, bool isPreview)
    {
      CloseCurrentVisualization();
      CurrentVizType = vizPluginInfo.VisualizationType;

      switch (CurrentVizType)
      {
        case VisualizationInfo.PluginType.None:
        case VisualizationInfo.PluginType.Unknown:
          return false;

        case VisualizationInfo.PluginType.GForce:
          {
            Log.Info("Visualization Manager: Creating new G-Force visualization...");
            Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.WhiteCap:
          {
            Log.Info("Visualization Manager: Creating new WhiteCap visualization...");
            Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.SoftSkies:
          {
            Log.Info("Visualization Manager: Creating new SoftSkies visualization...");
            Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.Sonique:
          {
            Log.Info("Visualization Manager: Creating new Sonique visualization...");
            Viz = new SoniqueViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.Winamp:
          {
            Log.Info("Visualization Manager: Creating new Winamp visualization...");
            Viz = new WinampViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.WMP:
          {
            Log.Info("Visualization Manager: Creating new Windows Media Player visualization...");
            Viz = new WMPViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        default:
          return false;
      }

      VizRenderWindow.Visualization = Viz;

      if (Viz == null)
      {
        return false;
      }

      ((VisualizationBase)Viz).VisualizationCreated +=
        new VisualizationBase.VisualizationCreatedDelegate(OnVisualizationCreated);

      bool result = false;

      if (isPreview)
      {
        VizRenderWindow.IsPreviewVisualization = true;
        result = Viz.InitializePreview();
      }

      else
      {
        VizRenderWindow.IsPreviewVisualization = false;
        result = Viz.Initialize();
      }

      return result;
    }
Exemplo n.º 27
0
    /// <summary>
    /// Load Settings
    /// </summary>
    private void LoadSettings()
    {
      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        _SoundDevice = xmlreader.GetValueAsString("audioplayer", "sounddevice", "Default Sound Device");
        int vizType = xmlreader.GetValueAsInt("musicvisualization", "vizType", (int)VisualizationInfo.PluginType.None);
        string vizName = xmlreader.GetValueAsString("musicvisualization", "name", "");
        string vizPath = xmlreader.GetValueAsString("musicvisualization", "path", "");
        string vizClsid = xmlreader.GetValueAsString("musicvisualization", "clsid", "");
        int vizPreset = xmlreader.GetValueAsInt("musicvisualization", "preset", 0);

        VizPluginInfo = new VisualizationInfo((VisualizationInfo.PluginType)vizType, vizPath, vizName, vizClsid,
                                              vizPreset);

        VizFPS = xmlreader.GetValueAsInt("musicvisualization", "fps", 30);
        _StreamVolume = xmlreader.GetValueAsInt("audioplayer", "streamOutputLevel", 85);
        _BufferingMS = xmlreader.GetValueAsInt("audioplayer", "buffering", 5000);

        if (_BufferingMS <= 0)
        {
          _BufferingMS = 1000;
        }

        else if (_BufferingMS > 8000)
        {
          _BufferingMS = 8000;
        }

        _CrossFadeIntervalMS = xmlreader.GetValueAsInt("audioplayer", "crossfade", 4000);

        if (_CrossFadeIntervalMS < 0)
        {
          _CrossFadeIntervalMS = 0;
        }

        else if (_CrossFadeIntervalMS > 16000)
        {
          _CrossFadeIntervalMS = 16000;
        }

        _DefaultCrossFadeIntervalMS = _CrossFadeIntervalMS;

        _SoftStop = xmlreader.GetValueAsBool("audioplayer", "fadeOnStartStop", true);

        _Mixing = xmlreader.GetValueAsBool("audioplayer", "mixing", false);

        _useASIO = xmlreader.GetValueAsBool("audioplayer", "asio", false);
        _asioDevice = xmlreader.GetValueAsString("audioplayer", "asiodevice", "None");
        _asioBalance = (float)xmlreader.GetValueAsInt("audioplayer", "asiobalance", 0) / 100.00f;

        bool doGaplessPlayback = xmlreader.GetValueAsBool("audioplayer", "gaplessPlayback", false);

        if (doGaplessPlayback)
        {
          _CrossFadeIntervalMS = 200;
          _playBackType = (int)PlayBackType.GAPLESS;
        }
        else
        {
          if (_CrossFadeIntervalMS == 0)
          {
            _playBackType = (int)PlayBackType.NORMAL;
            _CrossFadeIntervalMS = 100;
          }
          else
          {
            _playBackType = (int)PlayBackType.CROSSFADE;
          }
        }
      }
    }
Exemplo n.º 28
0
 public SoundSpectrumViz(VisualizationInfo vizPluginInfo)
 {
   SSVisualizationName = vizPluginInfo.Name;
 }
 public bool CreatePreviewVisualization(VisualizationInfo vizPluginInfo)
 {
   return InternalCreateVisualization(vizPluginInfo, true);
 }
Exemplo n.º 30
0
    private void VisualizationsCmbBox_SelectedIndexChanged(object sender, EventArgs e)
    {
      int selIndex = VisualizationsCmbBox.SelectedIndex;

      if (VisualizationsCmbBox.Items.Count <= 1 || selIndex < 0)
      {
        return;
      }

      if (IVizMgr == null)
      {
        return;
      }

      VizPluginInfo = (VisualizationInfo)VisualizationsCmbBox.SelectedItem;

      if (VizPluginInfo == null || VizPluginInfo.IsDummyPlugin)
      {
        return;
      }

      VizPresetsCmbBox.Items.Clear();

      if (VizPluginInfo.VisualizationType == VisualizationInfo.PluginType.Winamp)
      {
        groupBoxWinampVis.Enabled = true;
      }
      else
      {
        groupBoxWinampVis.Enabled = false;
      }

      if (VizPluginInfo.HasPresets)
      {
        VizPresetsCmbBox.Items.AddRange(VizPluginInfo.PresetNames.ToArray());
        //SuppressVisualizationRestart = true;
        VizPresetsCmbBox.SelectedIndex = VizPluginInfo.PresetIndex;
        VizPresetsCmbBox.Enabled = VizPresetsCmbBox.Items.Count > 1;
        //SuppressVisualizationRestart = false;
      }
      else
      {
        VizPresetsCmbBox.Enabled = false;
      }
    }
Exemplo n.º 31
0
 public SoundSpectrumViz(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
   : base(vizPluginInfo, vizCtrl)
 {
   Log.Info("Visualization Manager: Creating {0} callback...", vizPluginInfo.Name);
   SoundSpectrumInterop.SSCallback = new SoundSpectrumInterop.SSCallbackDelegate(SSCallbackFunc);
   SSVisualizationName = vizPluginInfo.Name;
   using (Settings xmlreader = new MPSettings())
   {
     _autoHideMouse = xmlreader.GetValueAsBool("general", "autohidemouse", true);
   }
   Log.Info("Visualization Manager: Callback created.");
 }
Exemplo n.º 32
0
 public WMPViz(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
     : base(vizPluginInfo, vizCtrl)
 {
     _IsPreviewVisualization = false;
 }
Exemplo n.º 33
0
    public override void LoadSettings()
    {
      using (Settings xmlreader = new MPSettings())
      {
        // Player Settings
        // Get first the sound device, so that it is available, when updating the combo
        _soundDevice = xmlreader.GetValueAsString("audioplayer", "sounddevice", "None");
        _soundDeviceID = xmlreader.GetValueAsString("audioplayer", "sounddeviceid", "");

        string strAudioPlayer = xmlreader.GetValueAsString("audioplayer", "playerId", "0");
        int audioPlayer = (int)AudioPlayer.Bass; // Default to BASS Player
        try
        {
          audioPlayer = Convert.ToInt16(strAudioPlayer);
        }
        catch (Exception) // We end up here in the conversion Phase, where we have still a string ioncluded
        { }

        audioPlayerComboBox.SelectedIndex = audioPlayer;

        #region General Bass Player Settings

        int crossFadeMS = xmlreader.GetValueAsInt("audioplayer", "crossfade", 4000);

        if (crossFadeMS < 0)
        {
          crossFadeMS = 4000;
        }

        else if (crossFadeMS > trackBarCrossfade.Maximum)
        {
          crossFadeMS = trackBarCrossfade.Maximum;
        }

        trackBarCrossfade.Value = crossFadeMS;

        int bufferingMS = xmlreader.GetValueAsInt("audioplayer", "buffering", 500);

        if (bufferingMS < trackBarBuffering.Minimum)
        {
          bufferingMS = trackBarBuffering.Minimum;
        }

        else if (bufferingMS > trackBarBuffering.Maximum)
        {
          bufferingMS = trackBarBuffering.Maximum;
        }

        trackBarBuffering.Value = bufferingMS;

        EnableReplayGainChkBox.Checked = xmlreader.GetValueAsBool("audioplayer", "enableReplayGain", false);
        EnableAlbumReplayGainChkBox.Checked = xmlreader.GetValueAsBool("audioplayer", "enableAlbumReplayGain", false);
        GaplessPlaybackChkBox.Checked = xmlreader.GetValueAsBool("audioplayer", "gaplessPlayback", false);
        UseSkipStepsCheckBox.Checked = xmlreader.GetValueAsBool("audioplayer", "useSkipSteps", false);
        FadeOnStartStopChkbox.Checked = xmlreader.GetValueAsBool("audioplayer", "fadeOnStartStop", true);
        StreamOutputLevelNud.Value = (decimal)xmlreader.GetValueAsInt("audioplayer", "streamOutputLevel", 85);

        cbUpmixMono.SelectedIndex = xmlreader.GetValueAsInt("audioplayer", "upMixMono", 0);
        cbUpmixStereo.SelectedIndex = xmlreader.GetValueAsInt("audioplayer", "upMixStereo", 0);
        cbUpmixQuadro.SelectedIndex = xmlreader.GetValueAsInt("audioplayer", "upMixQuadro", 0);
        cbUpmixFiveDotOne.SelectedIndex = xmlreader.GetValueAsInt("audioplayer", "upMixFiveDotOne", 0);

        chkEnableResumeSupport.Checked = xmlreader.GetValueAsBool("audioplayer", "enableResume", false);
        tbResumeAfter.Text = xmlreader.GetValueAsString("audioplayer", "resumeAfter", "0");
        cbResumeSelect.Text = xmlreader.GetValueAsString("audioplayer", "resumeSelect", "");
        tbResumeSearchValue.Text = xmlreader.GetValueAsString("audioplayer", "resumeSearch", "");

        #endregion

        #region BASS ASIO

        hScrollBarBalance.Value = xmlreader.GetValueAsInt("audioplayer", "asiobalance", 0);


        #endregion

        #region BASS WASAPI

        WasapiExclusiveModeCkBox.Checked = xmlreader.GetValueAsBool("audioplayer", "wasapiExclusive", true);
        WasApiSpeakersCombo.SelectedIndex = xmlreader.GetValueAsInt("audioplayer", "wasApiSpeakers", 1);

        #endregion

        #region Visualization Settings
        int vizType = xmlreader.GetValueAsInt("musicvisualization", "vizType", (int)VisualizationInfo.PluginType.None);
        string vizName = xmlreader.GetValueAsString("musicvisualization", "name", "None");
        string vizPath = xmlreader.GetValueAsString("musicvisualization", "path", "");
        string vizClsid = xmlreader.GetValueAsString("musicvisualization", "clsid", "");
        int vizPreset = xmlreader.GetValueAsInt("musicvisualization", "preset", 0);

        if (vizType == (int)VisualizationInfo.PluginType.None
            && vizName == "None")
        {
          VizPluginInfo = new VisualizationInfo("None", true);
        }

        else
        {
          VizPluginInfo = new VisualizationInfo((VisualizationInfo.PluginType)vizType, vizPath, vizName, vizClsid,
                                                vizPreset);
        }

        int fps = xmlreader.GetValueAsInt("musicvisualization", "fps", 25);

        if (fps < (int)VisualizationFpsNud.Minimum)
        {
          fps = (int)VisualizationFpsNud.Minimum;
        }

        else if (fps > VisualizationFpsNud.Maximum)
        {
          fps = (int)VisualizationFpsNud.Maximum;
        }

        VisualizationFpsNud.Value = fps;

        EnableStatusOverlaysChkBox.Checked = xmlreader.GetValueAsBool("musicvisualization", "enableStatusOverlays",
                                                                      false);
        ShowTrackInfoChkBox.Checked = xmlreader.GetValueAsBool("musicvisualization", "showTrackInfo", true);
        EnableStatusOverlaysChkBox_CheckedChanged(null, null);

        #endregion

        #region Playlist Settings
        string playListFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
        playListFolder += @"\My Playlists";
        playlistFolderTextBox.Text = xmlreader.GetValueAsString("music", "playlists", playListFolder);

        if (string.Compare(playlistFolderTextBox.Text, playListFolder) == 0)
        {
          if (Directory.Exists(playListFolder) == false)
          {
            try
            {
              Directory.CreateDirectory(playListFolder);
            }
            catch (Exception) { }
          }
        }

        repeatPlaylistCheckBox.Checked = xmlreader.GetValueAsBool("musicfiles", "repeat", false);
        autoShuffleCheckBox.Checked = xmlreader.GetValueAsBool("musicfiles", "autoshuffle", false);

        SavePlaylistOnExitChkBox.Checked = xmlreader.GetValueAsBool("musicfiles", "savePlaylistOnExit", true);
        ResumePlaylistChkBox.Checked = xmlreader.GetValueAsBool("musicfiles", "resumePlaylistOnMusicEnter", true);
        PlaylistCurrentCheckBox.Checked = xmlreader.GetValueAsBool("musicfiles", "playlistIsCurrent", true);

        String strSelectOption = xmlreader.GetValueAsString("musicfiles", "selectOption", "play");
        cmbSelectOption.Text = strSelectOption == "play" ? "Play" : "Queue";
        chkAddAllTracks.Checked = xmlreader.GetValueAsBool("musicfiles", "addall", true);
        #endregion

        #region Misc Settings
        string playNowJumpTo = xmlreader.GetValueAsString("music", "playnowjumpto", JumpToValue0);

        switch (playNowJumpTo)
        {
          case JumpToValue0:
            PlayNowJumpToCmbBox.Text = JumpToOptions[0];
            break;

          case JumpToValue1:
            PlayNowJumpToCmbBox.Text = JumpToOptions[1];
            break;

          case JumpToValue2:
            PlayNowJumpToCmbBox.Text = JumpToOptions[2];
            break;

          case JumpToValue3:
            PlayNowJumpToCmbBox.Text = JumpToOptions[3];
            break;

          case JumpToValue4:
            PlayNowJumpToCmbBox.Text = JumpToOptions[4];
            break;

          case JumpToValue5:
            PlayNowJumpToCmbBox.Text = JumpToOptions[5];
            break;

          case JumpToValue6:
            PlayNowJumpToCmbBox.Text = JumpToOptions[6];
            break;

          default:
            PlayNowJumpToCmbBox.Text = JumpToOptions[0];
            break;
        }

        string showLyrics = xmlreader.GetValueAsString("musicmisc", "lyrics", LyricsValue0);

        switch (showLyrics)
        {
          case LyricsValue0:
            ShowLyricsCmbBox.Text = ShowLyricsOptions[0];
            break;

          case LyricsValue1:
            ShowLyricsCmbBox.Text = ShowLyricsOptions[1];
            break;

          case LyricsValue2:
            ShowLyricsCmbBox.Text = ShowLyricsOptions[2];
            break;

          default:
            ShowLyricsCmbBox.Text = ShowLyricsOptions[0];
            break;
        }

        ShowVizInNowPlayingChkBox.Checked = xmlreader.GetValueAsBool("musicmisc", "showVisInNowPlaying", false);
        checkBoxDisableCoverLookups.Checked = !(xmlreader.GetValueAsBool("musicmisc", "fetchlastfmcovers", true));
        checkBoxDisableAlbumLookups.Checked = !(xmlreader.GetValueAsBool("musicmisc", "fetchlastfmtopalbums", true));
        checkBoxDisableTagLookups.Checked = !(xmlreader.GetValueAsBool("musicmisc", "fetchlastfmtracktags", true));
        checkBoxSwitchArtistOnLastFMSubmit.Checked = xmlreader.GetValueAsBool("musicmisc", "switchArtistOnLastFMSubmit",
                                                                              false);

        string vuMeter = xmlreader.GetValueAsString("musicmisc", "vumeter", "none");

        switch (vuMeter)
        {
          case VUMeterValue0:
            radioButtonVUNone.Checked = true;
            break;

          case VUMeterValue1:
            radioButtonVUAnalog.Checked = true;
            break;

          case VUMeterValue2:
            radioButtonVULed.Checked = true;
            break;

          default:
            radioButtonVUNone.Checked = true;
            break;
        }
        #endregion
      }
    }
Exemplo n.º 34
0
    /// <summary>
    /// Search the Visaulation Path for supported Vis
    /// </summary>
    /// <returns></returns>
    public List<VisualizationInfo> GetVisualizationPluginsInfo()
    {

      _VisualizationPluginsInfo.Clear();
      try
      {
        _VisualizationPluginsInfo.Add(new VisualizationInfo("None", true));

        // Close any Visualisation, which we may have running, because of VizManager Init
        if (Viz != null)
          CloseCurrentVisualization();

        string skinFolderPath = Path.Combine(Application.StartupPath, @"musicplayer\plugins\visualizations");

        // Search for Sonique Plugins
        string[] soniqueVisPaths = BassVis.BASSVIS_FindPlugins(BASSVISKind.BASSVISKIND_SONIQUE, skinFolderPath, true);

        // Search for Bassbox Plugins
        skinFolderPath = Path.Combine(Application.StartupPath, @"BBPlugin");
        string[] bassboxVisPaths = BassVis.BASSVIS_FindPlugins(BASSVISKind.BASSVISKIND_BASSBOX, skinFolderPath, true);

        // Note: Recursive Searches for Winamp Plugins are not supported
        // Winamp plugins expect itself to be stored in a folder named Plugins in the root of the executable. This is where we will search
        // So this is the folder where all the MP Plugins are stored as well
        skinFolderPath = Path.Combine(Application.StartupPath, @"plugins");
        string[] winampVisPaths = BassVis.BASSVIS_FindPlugins(BASSVISKind.BASSVISKIND_WINAMP, skinFolderPath, true);

        string[] wmpFilelist = BassVis.BASSVIS_FindPlugins(BASSVISKind.BASSVISKIND_WMP, string.Empty, false);

        if (wmpFilelist != null)
        {
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_WMP);
          foreach (string name in wmpFilelist)
          {
            if (!string.IsNullOrEmpty(name))
            {
              List<string> presets = new List<string>();
              // Get presets count
              int NumPresets = BassVis.BASSVIS_GetModulePresetCount(_visParam, name);
              string pluginname = BassVis.BASSVIS_GetPluginName(_visParam);

              if (NumPresets > 0)
              {
                for (int i = 0; i <= (NumPresets - 1); i++)
                {
                  presets.Add(BassVis.BASSVIS_GetModulePresetName(_visParam, i, name));
                }
              }

              VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.WMP, string.Empty, name,
                                                                presets);
              _VisualizationPluginsInfo.Add(vizInfo);
            }
          }
        }

        if (soniqueVisPaths != null && soniqueVisPaths[0] != "")
        {
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_SONIQUE);
          for (int i = 0; i < soniqueVisPaths.Length; i++)
          {
            string filePath = soniqueVisPaths[i];
            string name = Path.GetFileNameWithoutExtension(filePath);
            _visParam.VisHandle = BassVis.BASSVIS_GetModuleHandle(BASSVISKind.BASSVISKIND_SONIQUE, filePath);

            string pluginname = BassVis.BASSVIS_GetPluginName(_visParam);
            if (pluginname != null)
            {
              name = pluginname;
            }

            VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.Sonique, filePath, name,
                                                              null);
            _VisualizationPluginsInfo.Add(vizInfo);

            if (_visParam.VisHandle != 0)
            {
              BassVis.BASSVIS_Free(_visParam);
              bool bFree = BassVis.BASSVIS_IsFree(_visParam);
              if (bFree)
              {
                _visParam.VisHandle = 0;
              }
              else
              {
                Log.Warn("VisualisationManager: Failed to unload Sonique viz module - {0}", name);
                _visParam.VisHandle = 0;
              }
            }
          }
        }

        if (winampVisPaths != null && winampVisPaths[0] != "")
        {
          _visParam = new BASSVIS_PARAM(BASSVISKind.BASSVISKIND_WINAMP);
          for (int i = 0; i < winampVisPaths.Length; i++)
          {
            List<string> presets = new List<string>();
            string filePath = winampVisPaths[i];
            string name = Path.GetFileNameWithoutExtension(filePath);
            _visParam.VisHandle = BassVis.BASSVIS_GetModuleHandle(BASSVISKind.BASSVISKIND_WINAMP, filePath);

            string pluginname = BassVis.BASSVIS_GetPluginName(_visParam);
            if (pluginname != null)
              name = pluginname;

            // Get modules
            int numModules = BassVis.BASSVIS_GetModulePresetCount(_visParam, filePath);
            if (numModules > 0)
            {
              for (int j = 0; j < numModules; j++)
              {
                presets.Add(BassVis.BASSVIS_GetModulePresetName(_visParam, j, filePath));
              }
            }
            VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.Winamp, filePath, name,
                                                                presets);
            _VisualizationPluginsInfo.Add(vizInfo);
          }
        }

        if (bassboxVisPaths != null && bassboxVisPaths[0] != "")
        {
          // use only Filename BassBox can have Presetnames double
          for (int i = 0; i < bassboxVisPaths.Length; i++)
          {
            string filePath = bassboxVisPaths[i];
            string name = Path.GetFileNameWithoutExtension(filePath);

            VisualizationInfo vizInfo = new VisualizationInfo(VisualizationInfo.PluginType.Bassbox, filePath, name,
                                                              null);
            _VisualizationPluginsInfo.Add(vizInfo);
          }
        }
      }
      catch (Exception ex)
      {
        Log.Error("VisualisationManager: Failed to get viz plugins - {0}", ex.ToString());
      }
      return _VisualizationPluginsInfo;
    }
Exemplo n.º 35
0
    private bool InternalCreateVisualization(VisualizationInfo vizPluginInfo, bool isPreview)
    {
      if (OldVizType != vizPluginInfo.VisualizationType)
      {
        if (Viz != null)
          CloseCurrentVisualization();
        switch (vizPluginInfo.VisualizationType)
        {
          case VisualizationInfo.PluginType.Sonique:
            BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_SONIQUE, GUIGraphicsContext.form.Handle);
            break;

          case VisualizationInfo.PluginType.Winamp:
            BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_WINAMP, GUIGraphicsContext.form.Handle);
            break;

          case VisualizationInfo.PluginType.Bassbox:
            BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_BASSBOX, GUIGraphicsContext.form.Handle);
            break;

          case VisualizationInfo.PluginType.WMP:
            BassVis.BASSVIS_Init(BASSVISKind.BASSVISKIND_WMP, GUIGraphicsContext.form.Handle);
            GetVisualizationPluginsInfo();
            break;
        }
        OldVizType = vizPluginInfo.VisualizationType;
      }
      else
      {
        switch (OldVizType)
        {
          case VisualizationInfo.PluginType.None:
          case VisualizationInfo.PluginType.Unknown:
            return false;

          case VisualizationInfo.PluginType.Sonique:
            {
              if (Viz.VizParam != null)
              {
                Log.Info("Visualization Manager: Free Sonique visualization...");
                BassVis.BASSVIS_Free(Viz.VizParam);
                bool bFree = BassVis.BASSVIS_IsFree(Viz.VizParam);
                if (bFree)
                {
                  Viz.VizParam.VisHandle = 0;
                  Log.Info("Visualization Manager: Sonique visualization " + OldViz + " free succes");
                }
              }
              break;
            }

          case VisualizationInfo.PluginType.Winamp:
            {
              if (Viz.VizParam != null)
              {
                Log.Info("Visualization Manager: Free Winamp visualization...");
                BassVis.BASSVIS_Free(Viz.VizParam);
                bool bFree = BassVis.BASSVIS_IsFree(Viz.VizParam);
                if (bFree)
                {
                  Viz.VizParam.VisHandle = 0;
                  Log.Info("Visualization Manager: Winamp visualization " + OldViz + " free succes");
                }
              }
              break;
            }

          case VisualizationInfo.PluginType.Bassbox:
            {
              if (Viz.VizParam != null)
              {
                Log.Info("Visualization Manager: Free Bassbox visualization...");
                BassVis.BASSVIS_Free(Viz.VizParam);
                bool bFree = BassVis.BASSVIS_IsFree(Viz.VizParam);
                if (bFree)
                {
                  Viz.VizParam.VisHandle = 0;
                  Log.Info("Visualization Manager: Bassbox visualization " + OldViz + " free succes");
                }
              }
              break;
            }

          case VisualizationInfo.PluginType.WMP:
            {
              if (Viz.VizParam != null)
              {
                Log.Info("Visualization Manager: Free WMP visualization...");
                BassVis.BASSVIS_Free(Viz.VizParam);
                bool bFree = BassVis.BASSVIS_IsFree(Viz.VizParam);
                if (bFree)
                {
                  Viz.VizParam.VisHandle = 0;
                  Log.Info("Visualization Manager: WMP visualization " + OldViz + " free succes");
                }
              }
              break;
            }
        }
      }

      CurrentVizType = vizPluginInfo.VisualizationType;
      OldViz = vizPluginInfo.Name;
      CurrentViz = OldViz;

      switch (CurrentVizType)
      {
        case VisualizationInfo.PluginType.None:
        case VisualizationInfo.PluginType.Unknown:
          return false;

        case VisualizationInfo.PluginType.Sonique:
          {
            Log.Info("Visualization Manager: Creating new Sonique visualization...");
            VizRenderWindow.Refresh();
            Viz = new SoniqueViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.Winamp:
          {
            Log.Info("Visualization Manager: Creating new Winamp visualization...");
            VizRenderWindow.Refresh();
            Viz = new WinampViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.Bassbox:
          {
            Log.Info("Visualization Manager: Creating new Bassbox visualization...");
            VizRenderWindow.Refresh();
            Viz = new BassboxViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        case VisualizationInfo.PluginType.WMP:
          {
            Log.Info("Visualization Manager: Creating new Windows Media Player visualization...");
            Viz = new WMPViz(vizPluginInfo, VizRenderWindow);
            break;
          }

        default:
          return false;
      }

      VizRenderWindow.Visualization = Viz;

      if (Viz == null)
      {
        return false;
      }

      ((VisualizationBase)Viz).VisualizationCreated +=
        new VisualizationBase.VisualizationCreatedDelegate(OnVisualizationCreated);

      bool result = false;

      if (isPreview)
      {
        VizRenderWindow.IsPreviewVisualization = true;
        result = Viz.InitializePreview();
      }

      else
      {
        VizRenderWindow.IsPreviewVisualization = false;
        result = Viz.Initialize();
      }

      return result;
    }
Exemplo n.º 36
0
 public bool CreateVisualization(VisualizationInfo vizPluginInfo)
 {
   return InternalCreateVisualization(vizPluginInfo, false);
 }
Exemplo n.º 37
0
        private bool InternalCreateVisualization(VisualizationInfo vizPluginInfo, bool isPreview)
        {
            CloseCurrentVisualization();
            CurrentVizType = vizPluginInfo.VisualizationType;

            switch (CurrentVizType)
            {
            case VisualizationInfo.PluginType.None:
            case VisualizationInfo.PluginType.Unknown:
                return(false);

            case VisualizationInfo.PluginType.GForce:
            {
                Log.Info("Visualization Manager: Creating new G-Force visualization...");
                Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.WhiteCap:
            {
                Log.Info("Visualization Manager: Creating new WhiteCap visualization...");
                Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.SoftSkies:
            {
                Log.Info("Visualization Manager: Creating new SoftSkies visualization...");
                Viz = new SoundSpectrumViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.Sonique:
            {
                Log.Info("Visualization Manager: Creating new Sonique visualization...");
                Viz = new SoniqueViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.Winamp:
            {
                Log.Info("Visualization Manager: Creating new Winamp visualization...");
                Viz = new WinampViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            case VisualizationInfo.PluginType.WMP:
            {
                Log.Info("Visualization Manager: Creating new Windows Media Player visualization...");
                Viz = new WMPViz(vizPluginInfo, VizRenderWindow);
                break;
            }

            default:
                return(false);
            }

            VizRenderWindow.Visualization = Viz;

            if (Viz == null)
            {
                return(false);
            }

            ((VisualizationBase)Viz).VisualizationCreated +=
                new VisualizationBase.VisualizationCreatedDelegate(OnVisualizationCreated);

            bool result = false;

            if (isPreview)
            {
                VizRenderWindow.IsPreviewVisualization = true;
                result = Viz.InitializePreview();
            }

            else
            {
                VizRenderWindow.IsPreviewVisualization = false;
                result = Viz.Initialize();
            }

            return(result);
        }
Exemplo n.º 38
0
 private void SaveCurrentViz(VisualizationInfo vizPluginInfo)
 {
   using (Profile.Settings xmlwriter = new Profile.MPSettings())
   {
     xmlwriter.SetValue("musicvisualization", "name", vizPluginInfo.Name);
     xmlwriter.SetValue("musicvisualization", "vizType", ((int)vizPluginInfo.VisualizationType).ToString());
     xmlwriter.SetValue("musicvisualization", "path", vizPluginInfo.FilePath);
     xmlwriter.SetValue("musicvisualization", "preset", vizPluginInfo.PresetIndex.ToString());
     // save only new PluginIndex if BASSVISKind WMP
     if (vizPluginInfo.VisualizationType == VisualizationInfo.PluginType.WMP)
       xmlwriter.SetValue("musicvisualization", "plgIndex", vizPluginInfo.PlgIndex.ToString());
   }
 }
Exemplo n.º 39
0
 public bool CreatePreviewVisualization(VisualizationInfo vizPluginInfo)
 {
     return(InternalCreateVisualization(vizPluginInfo, true));
 }
Exemplo n.º 40
0
    /// <summary>
    /// Load Settings
    /// </summary>
    private void LoadSettings()
    {
      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        int vizType = xmlreader.GetValueAsInt("musicvisualization", "vizType", (int)VisualizationInfo.PluginType.None);
        string vizName = xmlreader.GetValueAsString("musicvisualization", "name", "");
        string vizPath = xmlreader.GetValueAsString("musicvisualization", "path", "");
        string vizClsid = xmlreader.GetValueAsString("musicvisualization", "clsid", "");
        int vizPreset = xmlreader.GetValueAsInt("musicvisualization", "preset", 0);

        VizPluginInfo = new VisualizationInfo((VisualizationInfo.PluginType)vizType, vizPath, vizName, vizClsid,
                                              vizPreset);

        VizFPS = xmlreader.GetValueAsInt("musicvisualization", "fps", 30);
      }
    }
Exemplo n.º 41
0
    /// <summary>
    /// Create the Visualisation
    /// </summary>
    /// <param name="vizPluginInfo"></param>
    /// <returns></returns>
    public bool CreateVisualization(VisualizationInfo vizPluginInfo)
    {
      if (vizPluginInfo == null || vizPluginInfo.VisualizationType == VisualizationInfo.PluginType.None ||
          VizWindow == null)
      {
        return false;
      }

      Log.Info("BASS: Creating visualization...");
      VizPluginInfo = vizPluginInfo;

      bool result = true;

      try
      {
        result = VizManager.CreateVisualization(vizPluginInfo);
        Log.Debug("BASS: Create visualization {0}", (result ? "succeeded" : "failed"));
      }

      catch (Exception ex)
      {
        Log.Error("BASS: Error creating visualization - {0}", ex.Message);
        result = false;
      }

      return result;
    }
Exemplo n.º 42
0
    private string _songTitle = "   "; // Title of the song played
    #endregion

    #region Constructors/Destructors

    public BassboxViz(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
      : base(vizPluginInfo, vizCtrl)
    {
    }
Exemplo n.º 43
0
        /// <summary>
        /// Determines whether the member values of the specified VisualizationInfo object
        /// are the same as the current VisualizationInfo object
        /// <param name="vizInfo"></param>
        /// <returns>true if data is identical</returns>
        /// </summary>
        public bool IsIdenticalTo(VisualizationInfo vizInfo, bool doSimpleCheck)
        {
            if (this._Name != vizInfo._Name)
            {
                return(false);
            }

            if (this._CLSID != vizInfo.CLSID)
            {
                return(false);
            }

            if (this.FilePath != vizInfo.FilePath)
            {
                return(false);
            }

            if (this.IsCOMPlugin != vizInfo.IsCOMPlugin)
            {
                return(false);
            }

            if (this.IsDummyPlugin != vizInfo.IsDummyPlugin)
            {
                return(false);
            }

            if (this.PresetIndex != vizInfo.PresetIndex)
            {
                return(false);
            }

            if (this.VisualizationType != vizInfo.VisualizationType)
            {
                return(false);
            }

            if (!doSimpleCheck)
            {
                if (this.HasPresets != vizInfo.HasPresets)
                {
                    return(false);
                }


                if (this.PresetNames.Count != vizInfo.PresetNames.Count)
                {
                    return(false);
                }

                for (int i = 0; i < this.PresetNames.Count; i++)
                {
                    if (this.PresetNames[i] != vizInfo.PresetNames[i])
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 44
0
 public SoniqueViz(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
     : base(vizPluginInfo, vizCtrl)
 {
 }
Exemplo n.º 45
0
 public SoniqueViz(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
   : base(vizPluginInfo, vizCtrl) {}
Exemplo n.º 46
0
        private string _songTitle      = "   "; // Title of the song played
        #endregion

        #region Constructors/Destructors

        public BassboxViz(VisualizationInfo vizPluginInfo, VisualizationWindow vizCtrl)
            : base(vizPluginInfo, vizCtrl)
        {
        }