コード例 #1
0
 public MusicPlayerController(ISession session, IMusicPlayer musicPlayer)
 {
     _musicPlayer = musicPlayer;
     _session = session;
     _session.EndOfTrack += OnEndOfTrack;
     _timer = new Timer();
     _timer.Elapsed += OnTimerElapsed;
     _timer.Interval = 100;
 }
コード例 #2
0
ファイル: MusicService.cs プロジェクト: Jc54/PlayMe
	    public MusicService(ILogger logger,
			IMusicProviderFactory musicProviderFactory,
			IAutoPlay autoplayer,
            IDataService<QueuedTrack> queuedTrackDataService,
			IDataService<User> adminUserDataService,
			ISearchSuggestionService searchSuggestionService,
			IRickRollService rickRollService,
			IBroadcastService broadcastService,
			ISoundBoardService soundBoardService,
            ISkipHelper skipHelper,
            IVolume volume,
            IQueueManager queueManager,
            IAlreadyQueuedHelper alreadyQueuedHelper,
            IMusicPlayer musicPlayer,
            ICallbackClient callbackClient,
            IUserService userService,
			IVetoHelper vetoHelper,
            IQueueRuleHelper queueRuleHelper,
            ISettings settings,
            ISearchRuleHelper searchRuleHelper
            )
		{
	        this.vetoHelper = vetoHelper;
	        this.callbackClient = callbackClient;
	        this.alreadyQueuedHelper = alreadyQueuedHelper;
	        this.queueManager = queueManager;
	        this.broadcastService = broadcastService;
			this.rickRollService = rickRollService;
			this.logger = logger;
			this.musicProviderFactory = musicProviderFactory;
			this.autoplayer = autoplayer;
			this.queuedTrackDataService = queuedTrackDataService;
			this.adminUserDataService = adminUserDataService;
			this.searchSuggestionService = searchSuggestionService;
			this.soundBoardService = soundBoardService;
			this.skipHelper = skipHelper;
            this.volume = volume;
            this.musicPlayer = musicPlayer;
	        this.callbackClient = callbackClient;
            this.userService = userService;            
            this.queueRuleHelper = queueRuleHelper;
	        this.settings = settings;

	        this.searchRuleHelper = searchRuleHelper;
	        foreach (var provider in musicProviderFactory.GetAllMusicProviders())
			{
				provider.TrackEnded += musicProvider_TrackEnded;        
			}

			if (settings.AutoStart)
			{
			    PlayNextTrack();
			}
		}
コード例 #3
0
ファイル: ConsoleSession.cs プロジェクト: mesenev/hubbl
 public ConsoleSession(NetworkSettings settings, IMusicPlayer player)
 {
     _player = player;
     var interfaces = NetworkInterface.GetAllNetworkInterfaces();
     _settings = settings;
     _user = new HubblUser
     {
         Id = interfaces.First().Id,
         Title = Environment.MachineName,
         IsHub = true,
         Hub = Environment.MachineName
     };
 }
コード例 #4
0
ファイル: MusicFileEngine.cs プロジェクト: charlesj/Grease
        /// <summary>
        /// Initializes a new instance of the <see cref="MusicFileEngine"/> class.
        /// </summary>
        /// <param name="player">
        /// The player.
        /// </param>
        /// <param name="library">The music library</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if arguments are null.  Don't do that.  Except for Path. Path can be null.  I don't know why.
        /// </exception>
        public MusicFileEngine(IMusicPlayer player, IMusicLibrary library)
        {
            this.Library = library;
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }

            if (library == null)
            {
                throw new ArgumentNullException("library");
            }

            this.player = player;
            this.player.PropertyChanged += this.PlayerOnPropertyChanged;
            this.player.TrackEnded += this.PlayerOnTrackEnded;
            this.currentlyPlaying = false;
        }
コード例 #5
0
        public PlayerViewModel(IMusicPlayer iMusicPlayer, IPlayListFactory iPlayListFactory)
        {
            _IMusicPlayer = iMusicPlayer;
            _IPlayListFactory = iPlayListFactory;

            _IMusicPlayer.TrackEvent += OnTrackEvent;
            _IMusicPlayer.TrackPlaying += TrackPlaying;

            _PlayList = _IPlayListFactory.CreateAlbumPlayList("Memory PlayList");
            _IMusicPlayer.PlayList = _PlayList; 
            _PlayedAlbums = new CollectionWithDetailVM<IAlbum>(_PlayList.Albums);

            Play = RelayCommand.Instanciate(()=>_IMusicPlayer.Mode = PlayMode.Play);
            Pause = RelayCommand.Instanciate(() => _IMusicPlayer.Mode = PlayMode.Paused);
            VolumeUp = RelayCommand.Instanciate(() => _IMusicPlayer.Volume += 0.1);
            VolumeDown = RelayCommand.Instanciate(() => _IMusicPlayer.Volume -= 0.1);
            Like = RelayCommand.Instanciate(DoLike);
            SeeNextAlbum = _PlayedAlbums.Next;
            SeePreviousAlbum = _PlayedAlbums.Previous;
            PlayAlbum = RelayCommand.Instanciate(DoPlayAlbum);

            //call  to activate listeners
            var pa = this.PlayingAlbum;
        }
コード例 #6
0
 public CannotQueueTrackDisabledProviderQueueRule(IMusicPlayer musicPlayer)
 {
     this.musicPlayer = musicPlayer;
 }
コード例 #7
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if(m_MusicPlayer != null)
            {
                m_MusicPlayer.Dispose();
                m_MusicPlayer = null;
            }

            if(m_ProgressTimer != null)
            {
                m_ProgressTimer.Stop();
                m_ProgressTimer.Dispose();
                m_ProgressTimer = null;
            }

            if(m_OpenFileDialog != null)
            {
                m_OpenFileDialog.Dispose();
                m_OpenFileDialog = null;
            }
        }
コード例 #8
0
        public void LoadFile(string file)
        {
            if(File.Exists(file))
            {
                if(m_MusicPlayer != null)
                {
                    m_MusicPlayer.Dispose();
                    m_MusicPlayer = null;
                }

                using(var fileStream = File.OpenRead(file))
                {
                    m_MusicPlayer = new IrrKlangMusicPlayer(file) { Volume = GetConvertedFloatValue(Volume) };
                    playerContainer.Text = string.Format("Ambient Track - [{0}]",
                                                         Path.GetFileNameWithoutExtension(file));

                    m_OpenFileDialog.FileName = file;
                }
            }
        }
コード例 #9
0
 public CannotQueueTrackAlreadyPlayingQueueRule(IMusicPlayer musicPlayer)
 {
     this.musicPlayer = musicPlayer;
 }
コード例 #10
0
 public Jukebox(IEnumerable<string> playlist, IMusicPlayer player)
 {
     _playlist = playlist;
     _player = player;
 }
コード例 #11
0
 public MusicPlayerInstance(IMusicPlayer musicService)
 {
     Player = musicService;
     instance = this;
 }