Пример #1
0
 private void Stop()
 {
     lock (parcelMusicLock)
     {
         playing = false;
         if (parcelStream != null)
         {
             parcelStream.Dispose();
         }
         parcelStream      = null;
         lblStation.Tag    = lblStation.Text = string.Empty;
         txtSongTitle.Text = string.Empty;
     }
 }
Пример #2
0
        public MediaConsole(RadegastInstance instance)
        {
            InitializeComponent();
            DisposeOnDetachedClose = false;
            Text = "Media";

            Disposed += new EventHandler(MediaConsole_Disposed);

            this.instance = instance;
            this.parcelStream = new Media.Stream();

            s = instance.GlobalSettings;

            // Set some defaults in case we don't have them in config
            audioVolume = 0.2f;
            objVolume.Value = 50;
            instance.MediaManager.ObjectVolume = 1f;

            // Restore settings
            if (s["parcel_audio_url"].Type != OSDType.Unknown)
                txtAudioURL.Text = s["parcel_audio_url"].AsString();
            if (s["parcel_audio_vol"].Type != OSDType.Unknown)
                audioVolume = (float)s["parcel_audio_vol"].AsReal();
            if (s["parcel_audio_play"].Type != OSDType.Unknown)
                cbPlayAudioStream.Checked = s["parcel_audio_play"].AsBoolean();
            if (s["parcel_audio_keep_url"].Type != OSDType.Unknown)
                cbKeep.Checked = s["parcel_audio_keep_url"].AsBoolean();
            if (s["object_audio_enable"].Type != OSDType.Unknown)
                cbObjSoundEnable.Checked = s["object_audio_enable"].AsBoolean();
            if (s["object_audio_vol"].Type != OSDType.Unknown)
            {
                instance.MediaManager.ObjectVolume = (float)s["object_audio_vol"].AsReal();
                objVolume.Value = (int)(50f * instance.MediaManager.ObjectVolume);
            }
            if (s["ui_audio_vol"].Type != OSDType.Unknown)
            {
                instance.MediaManager.UIVolume = (float)s["ui_audio_vol"].AsReal();
                UIVolume.Value = (int)(50f * instance.MediaManager.UIVolume);
            }

            volAudioStream.Value = (int)(audioVolume * 50);
            instance.MediaManager.ObjectEnable = cbObjSoundEnable.Checked;

            configTimer = new System.Threading.Timer(SaveConfig, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);

            if (!instance.MediaManager.SoundSystemAvailable)
            {
                foreach (Control c in pnlParcelAudio.Controls)
                    c.Enabled = false;
            }

            // GUI Events
            volAudioStream.Scroll += new EventHandler(volAudioStream_Scroll);
            txtAudioURL.TextChanged += new EventHandler(txtAudioURL_TextChanged);
            cbKeep.CheckedChanged += new EventHandler(cbKeep_CheckedChanged);
            cbPlayAudioStream.CheckedChanged += new EventHandler(cbPlayAudioStream_CheckedChanged);
            lblStation.Tag = lblStation.Text = string.Empty;
            lblStation.Click += new EventHandler(lblStation_Click);

            objVolume.Scroll += new EventHandler(volObject_Scroll);
            cbObjSoundEnable.CheckedChanged += new EventHandler(cbObjEnableChanged);

            // Network callbacks
            client.Parcels.ParcelProperties += new EventHandler<ParcelPropertiesEventArgs>(Parcels_ParcelProperties);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
Пример #3
0
 private void Stop()
 {
     lock (parcelMusicLock)
     {
         playing = false;
         if (parcelStream != null)
             parcelStream.Dispose();
         parcelStream = null;
         lblStation.Tag = lblStation.Text = string.Empty;
         txtSongTitle.Text = string.Empty;
     }
 }
Пример #4
0
 private void Play()
 {
     lock (parcelMusicLock)
     {
         Stop();
         playing = true;
         parcelStream = new Media.Stream();
         parcelStream.Volume = audioVolume;
         parcelStream.PlayStream(currentURL);
         parcelStream.OnStreamInfo += new Media.Stream.StreamInfoCallback(ParcelMusic_OnStreamInfo);
     }
 }
Пример #5
0
        public MediaConsole(RadegastInstance instance)
        {
            InitializeComponent();
            DisposeOnDetachedClose = false;
            Text = "Media";

            Disposed += new EventHandler(MediaConsole_Disposed);

            this.instance     = instance;
            this.parcelStream = new Media.Stream();

            s = instance.GlobalSettings;

            // Set some defaults in case we don't have them in config
            audioVolume     = 0.2f;
            objVolume.Value = 50;
            instance.MediaManager.ObjectVolume = 1f;

            // Restore settings
            if (s["parcel_audio_url"].Type != OSDType.Unknown)
            {
                txtAudioURL.Text = s["parcel_audio_url"].AsString();
            }
            if (s["parcel_audio_vol"].Type != OSDType.Unknown)
            {
                audioVolume = (float)s["parcel_audio_vol"].AsReal();
            }
            if (s["parcel_audio_play"].Type != OSDType.Unknown)
            {
                cbPlayAudioStream.Checked = s["parcel_audio_play"].AsBoolean();
            }
            if (s["parcel_audio_keep_url"].Type != OSDType.Unknown)
            {
                cbKeep.Checked = s["parcel_audio_keep_url"].AsBoolean();
            }
            if (s["object_audio_enable"].Type != OSDType.Unknown)
            {
                cbObjSoundEnable.Checked = s["object_audio_enable"].AsBoolean();
            }
            if (s["object_audio_vol"].Type != OSDType.Unknown)
            {
                instance.MediaManager.ObjectVolume = (float)s["object_audio_vol"].AsReal();
                objVolume.Value = (int)(50f * instance.MediaManager.ObjectVolume);
            }
            if (s["ui_audio_vol"].Type != OSDType.Unknown)
            {
                instance.MediaManager.UIVolume = (float)s["ui_audio_vol"].AsReal();
                UIVolume.Value = (int)(50f * instance.MediaManager.UIVolume);
            }

            volAudioStream.Value = (int)(audioVolume * 50);
            instance.MediaManager.ObjectEnable = cbObjSoundEnable.Checked;

            configTimer = new System.Threading.Timer(SaveConfig, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);

            if (!instance.MediaManager.SoundSystemAvailable)
            {
                foreach (Control c in pnlParcelAudio.Controls)
                {
                    c.Enabled = false;
                }
            }

            // GUI Events
            volAudioStream.Scroll            += new EventHandler(volAudioStream_Scroll);
            txtAudioURL.TextChanged          += new EventHandler(txtAudioURL_TextChanged);
            cbKeep.CheckedChanged            += new EventHandler(cbKeep_CheckedChanged);
            cbPlayAudioStream.CheckedChanged += new EventHandler(cbPlayAudioStream_CheckedChanged);
            lblStation.Tag    = lblStation.Text = string.Empty;
            lblStation.Click += new EventHandler(lblStation_Click);

            objVolume.Scroll += new EventHandler(volObject_Scroll);
            cbObjSoundEnable.CheckedChanged += new EventHandler(cbObjEnableChanged);

            // Network callbacks
            client.Parcels.ParcelProperties += new EventHandler <ParcelPropertiesEventArgs>(Parcels_ParcelProperties);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }