Example #1
0
        public SpotifireServer(string password = null)
        {
            if (Instance != null)
            {
                throw new InvalidOperationException("Can't have 2 servers!");
            }
            Instance = this;

            this.password = password;
            this.spotify  = Spotify.CreateSession(Program.applicationKey, Program.cacheLocation, Program.settingsLocation, Program.userAgent);
            this.spotify.SetPrefferedBitrate(sp_bitrate.BITRATE_320k);

            this.spotify.LoginComplete  += new SessionEventHandler(spotify_LoginComplete);
            this.spotify.LogoutComplete += new SessionEventHandler(spotify_LogoutComplete);
            this.spotify.MusicDeliver   += new MusicDeliveryEventHandler(spotify_MusicDeliver);
            this.spotify.EndOfTrack     += new SessionEventHandler(spotify_EndOfTrack);

            this.spotify.StartPlayback += new SessionEventHandler(spotify_StartPlayback);
            this.spotify.StopPlayback  += new SessionEventHandler(spotify_StopPlayback);

            this.playQueue = new LiveQueue <ITrack>();

            this.messageQueue  = new Queue <ClientAction>();
            this.messageLock   = new AutoResetEvent(false);
            this.messageThread = new Thread(new ThreadStart(MessageThread));
            this.messageThread.IsBackground = true;
            this.messageThread.Start();

            player = new BASSPlayer();
        }
Example #2
0
 internal Enumerator(LiveQueue <T> q)
 {
     this.q      = q;
     currentEnum = default(Queue <T> .Enumerator);
     currentArr  = -1;
 }