当前位置: 首页>>代码示例>>C#>>正文


C# PlayListPlayer.GetCurrentItem方法代码示例

本文整理汇总了C#中MediaPortal.Playlists.PlayListPlayer.GetCurrentItem方法的典型用法代码示例。如果您正苦于以下问题:C# PlayListPlayer.GetCurrentItem方法的具体用法?C# PlayListPlayer.GetCurrentItem怎么用?C# PlayListPlayer.GetCurrentItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MediaPortal.Playlists.PlayListPlayer的用法示例。


在下文中一共展示了PlayListPlayer.GetCurrentItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InsertItemButNotStartPlayingGivesNull

 public void InsertItemButNotStartPlayingGivesNull()
 {
   PlayListPlayer player = new PlayListPlayer();
   player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
   PlayList playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
   PlayListItem item1 = new PlayListItem();
   playlist.Add(item1);
   Assert.IsNull(player.GetCurrentItem());
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:9,代码来源:PlayListPlayerTest.cs

示例2: PlayMovesCurrentToItem

 public void PlayMovesCurrentToItem()
 {
   PlayListPlayer player = new PlayListPlayer();
   player.g_Player = this; //fake g_Player
   player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
   PlayList playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
   PlayListItem item1 = new PlayListItem();
   playlist.Add(item1);
   player.PlayNext();
   Assert.AreEqual(item1, player.GetCurrentItem());
   Assert.IsTrue(hasPlayBeenCalled);
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:12,代码来源:PlayListPlayerTest.cs

示例3: RenderVisualization

    public override int RenderVisualization()
    {
      try
      {
        if (VisualizationWindow == null || !VisualizationWindow.Visible || _visParam.VisHandle == 0)
        {
          return 0;
        }

        // Any is wrong with PlaybackStateChanged, if the songfile automatically changed
        // so i have create a new variable which fix this problem
        if (Bass != null)
        {
          if (Bass.CurrentFile != _OldCurrentFile && !Bass.IsRadio)
          {
            trackTag = TagReader.TagReader.ReadTag(Bass.CurrentFile);
            if (trackTag != null)
            {
              _songTitle = String.Format("{0} - {1}", trackTag.Artist, trackTag.Title);
              _OldCurrentFile = Bass.CurrentFile;
            }
            else
            {
              _songTitle = "   ";
            }
          }

          // Set Song information, so that the plugin can display it
          if (trackTag != null && !Bass.IsRadio)
          {
            _playlistPlayer = PlayListPlayer.SingletonPlayer;
            PlayListItem curPlaylistItem = _playlistPlayer.GetCurrentItem();

            MusicStream streams = Bass.GetCurrentStream();
            // Do not change this line many Plugins search for Songtitle with a number before.
            _mediaInfo.SongFile = Bass.CurrentFile;
            _mediaInfo.SongTitle = (_playlistPlayer.CurrentPlaylistPos + 1) + ". " + _songTitle;
            _mediaInfo.Position = (int)(1000 * Bass.CurrentPosition);
            _mediaInfo.Duration = (int)Bass.Duration;
            _mediaInfo.PlaylistLen = 1;
            _mediaInfo.PlaylistPos = _playlistPlayer.CurrentPlaylistPos;
          }
          else
          {
            if (Bass.IsRadio)
            {
              // Change TrackTag to StreamTag for Radio
              trackTag = Bass.GetStreamTags();
              if (trackTag != null)
              {
                // Artist and Title show better i think
                _songTitle = trackTag.Artist + ": " + trackTag.Title;
                _mediaInfo.SongTitle = _songTitle;
              }
              else
              {
                _songTitle = "   ";
              }
              _mediaInfo.Position = (int)(1000 * Bass.CurrentPosition);
            }
            else
            {
              _mediaInfo.Position = 0;
              _mediaInfo.Duration = 0;
              _mediaInfo.PlaylistLen = 0;
              _mediaInfo.PlaylistPos = 0;
            }
          }
        }

        if (IsPreviewVisualization)
        {
          _mediaInfo.SongTitle = "Mediaportal Preview";
        }
        BassVis.BASSVIS_SetInfo(_visParam, _mediaInfo);

        if (RenderStarted)
        {
          return 1;
        }

        int stream = 0;

        if (Bass != null)
        {
          stream = (int)Bass.GetCurrentVizStream();
        }

        // ckeck is playing
        int nReturn = BassVis.BASSVIS_SetPlayState(_visParam, BASSVIS_PLAYSTATE.IsPlaying);
        if (nReturn == Convert.ToInt32(BASSVIS_PLAYSTATE.Play) && (_visParam.VisHandle != 0))
        {
          // Do not Render without playing
          if (MusicPlayer.BASS.Config.MusicPlayer == AudioPlayer.WasApi)
          {
            RenderStarted = BassVis.BASSVIS_RenderChannel(_visParam, stream, true);
          }
          else
          {
          RenderStarted = BassVis.BASSVIS_RenderChannel(_visParam, stream, false);
//.........这里部分代码省略.........
开发者ID:edalex86,项目名称:MediaPortal-1,代码行数:101,代码来源:WinampViz.cs

示例4: RenderVisualization

    public override int RenderVisualization()
    {
      try
      {
        if (VisualizationWindow == null || !VisualizationWindow.Visible || _visParam.VisHandle == 0)
        {
          return 0;
        }

        // Set Song information, so that the plugin can display it
        if (trackTag != null && Bass != null)
        {
          _playlistPlayer = PlayListPlayer.SingletonPlayer;
          PlayListItem curPlaylistItem = _playlistPlayer.GetCurrentItem();

          _mediaInfo.Position = (int)Bass.CurrentPosition;
          _mediaInfo.Duration = (int)Bass.Duration;
          _mediaInfo.PlaylistLen = 1;
          _mediaInfo.PlaylistPos = _playlistPlayer.CurrentPlaylistPos;
        }
        else
        {
          _mediaInfo.Position = 0;
          _mediaInfo.Duration = 0;
          _mediaInfo.PlaylistLen = 0;
          _mediaInfo.PlaylistPos = 0;
        }
        if (IsPreviewVisualization)
        {
          _mediaInfo.SongTitle = "Mediaportal Preview";
        }
        BassVis.BASSVIS_SetInfo(_visParam, _mediaInfo);

        if (RenderStarted)
        {
          return 1;
        }

        int stream = 0;

        if (Bass != null)
        {
          stream = (int)Bass.GetCurrentVizStream();
        }

        BassVis.BASSVIS_SetPlayState(_visParam, BASSVIS_PLAYSTATE.Play);
        RenderStarted = BassVis.BASSVIS_RenderChannel(_visParam, stream);
      }

      catch (Exception) {}

      return 1;
    }
开发者ID:doskabouter,项目名称:MediaPortal-1,代码行数:53,代码来源:WinampViz.cs


注:本文中的MediaPortal.Playlists.PlayListPlayer.GetCurrentItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。