예제 #1
0
파일: Main.cs 프로젝트: ta0soft/STEAMp3
        private void p_StreamTimer_Tick(object sender, EventArgs e)
        {
            if (Global.MainWindow.StationList.PlayingItem == null) return;

            p_Shoutcast = new Shoutcast(Global.MainWindow.StationList.PlayingItem.StreamURL, 15000);
            p_Shoutcast.TitleReceived += new Shoutcast.TitleReceivedEventHandler(p_Shoutcast_TitleReceived);
            p_Shoutcast.Connect(true);
        }
예제 #2
0
파일: Main.cs 프로젝트: ta0soft/STEAMp3
        public MediaPlayer()
        {
            try
            {
                p_ID3 = new UltraID3();

                p_WMP = new WindowsMediaPlayer();
                p_WMP.MediaError += new _WMPOCXEvents_MediaErrorEventHandler(p_WMP_MediaError);
                p_WMP.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(p_WMP_PlayStateChange);
                p_WMP.settings.autoStart = false;
                p_WMP.settings.enableErrorDialogs = false;
                p_WMP.uiMode = "invisible";
                //p_SoundEngine = new ISoundEngine(SoundOutputDriver.AutoDetect, SoundEngineOptionFlag.DefaultOptions);
                //p_Sound = null;

                Volume = Global.Settings.Volume;
                PlayMode = (PlayModes)Global.Settings.PlayMode;

                p_Timer = new Timer();
                p_Timer.Interval = 1000;
                p_Timer.Tick += new EventHandler(p_Timer_Tick);

                p_Timer2 = new Timer();
                p_Timer2.Interval = 100;
                p_Timer2.Tick += new EventHandler(p_Timer2_Tick);

                p_StreamTimer = new Timer();
                p_StreamTimer.Interval = 30000;
                p_StreamTimer.Tick += new EventHandler(p_StreamTimer_Tick);

                p_Devices = new List<COM.MMDevice>();
                p_Shoutcast = null;
                p_StreamTitle = string.Empty;
                //p_WebClient = null;

                COM.MMDeviceEnumerator devEnum = new COM.MMDeviceEnumerator();
                COM.MMDeviceCollection devCollection = devEnum.EnumerateAudioEndPoints(COM.EDataFlow.eRender, COM.EDeviceState.DEVICE_STATE_ACTIVE);

                p_CurrentDevice = devEnum.GetDefaultAudioEndpoint(COM.EDataFlow.eRender, COM.ERole.eMultimedia);
                p_DefaultDevice = p_CurrentDevice;

                p_Devices.Add(p_DefaultDevice);

                for (int i = 0; i < devCollection.Count; i++)
                {
                    if (devCollection[i].ID != p_DefaultDevice.ID) p_Devices.Add(devCollection[i]);
                }
            }
            catch { }
        }