Esempio n. 1
0
 private void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
 {
     if (volumenew == true)
     {
         SoundPlayer snd = new SoundPlayer(Properties.Resources.volumenew);
         snd.Play();
     }
     else if (radioButton3.Checked == true)
     {
         if (customfile == null)
         {
             MessageBox.Show("select a file first!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             SoundPlayer snd = new SoundPlayer(customfile);
             snd.Play();
         }
     }
     else
     {
         SoundPlayer snd = new SoundPlayer(Properties.Resources.volume);
         snd.Play();
     }
 }
        public void OnNotify(IntPtr NotifyData)
        {
            //Since AUDIO_VOLUME_NOTIFICATION_DATA is dynamic in length based on the
            //number of audio channels available we cannot just call PtrToStructure
            //to get all data, thats why it is split up into two steps, first the static
            //data is marshalled into the data structure, then with some IntPtr math the
            //remaining floats are read from memory.
            //
            AudioVolumeNotificationDataStruct data = (AudioVolumeNotificationDataStruct)Marshal.PtrToStructure(NotifyData, typeof(AudioVolumeNotificationDataStruct));

            //Determine offset in structure of the first float
            IntPtr Offset = Marshal.OffsetOf(typeof(AudioVolumeNotificationDataStruct), "ChannelVolume");
            //Determine offset in memory of the first float
            IntPtr FirstFloatPtr = (IntPtr)((long)NotifyData + (long)Offset);

            float[] voldata = new float[data.nChannels];

            //Read all floats from memory.
            for (int i = 0; i < data.nChannels; i++)
            {
                voldata[i] = (float)Marshal.PtrToStructure(FirstFloatPtr, typeof(float));
            }

            //Create combined structure and Fire Event in parent class.
            AudioVolumeNotificationData NotificationData = new AudioVolumeNotificationData(data.guidEventContext, data.bMuted, data.fMasterVolume, voldata);
            _Parent.FireNotification(NotificationData);
        }
 void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
 {
     if (this.InvokeRequired)
     {
         object[] Params = new object[1];
         Params[0] = data;
         this.Invoke(new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification), Params);
     }
     else
     {
         micphone_trackbar.Value = (int)(data.MasterVolume * 100);
     }
 }
Esempio n. 4
0
        // Token: 0x06000048 RID: 72 RVA: 0x00004274 File Offset: 0x00002474
        public void OnNotify(IntPtr notifyData)
        {
            AudioVolumeNotificationDataStruct audioVolumeNotificationDataStruct = (AudioVolumeNotificationDataStruct)Marshal.PtrToStructure(notifyData, typeof(AudioVolumeNotificationDataStruct));
            IntPtr value = Marshal.OffsetOf(typeof(AudioVolumeNotificationDataStruct), "ChannelVolume");
            IntPtr ptr   = (IntPtr)((long)notifyData + (long)value);

            float[] array = new float[audioVolumeNotificationDataStruct.nChannels];
            int     num   = 0;

            while ((long)num < (long)((ulong)audioVolumeNotificationDataStruct.nChannels))
            {
                array[num] = (float)Marshal.PtrToStructure(ptr, typeof(float));
                num++;
            }
            AudioVolumeNotificationData notificationData = new AudioVolumeNotificationData(audioVolumeNotificationDataStruct.guidEventContext, audioVolumeNotificationDataStruct.bMuted, audioVolumeNotificationDataStruct.fMasterVolume, array);

            this.parent.FireNotification(notificationData);
        }
Esempio n. 5
0
        // play sounds

        private void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
        {
            if (Settings.Default.newvol == true)
            {
                SoundPlayer snd = new SoundPlayer(Properties.Resources.volumenew);
                snd.Play();
            }
            else if (radioButton3.Checked == true)
            {
                SoundPlayer snd = new SoundPlayer(customfile);
                snd.Play();
            }
            else
            {
                SoundPlayer snd = new SoundPlayer(Properties.Resources.volume);
                snd.Play();
            }
        }
Esempio n. 6
0
		void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
		{
			if (data.EventContext == Guid.Empty)
				return;
			if (this.InvokeRequired)
				this.Invoke((MethodInvoker)delegate() { AudioEndpointVolume_OnVolumeNotification(data); });
			else
			{
				mediaSliderVolume.Value = (int)(data.MasterVolume * 100);
				outputBindingSource.ResetBindings(false);
			}
		}
Esempio n. 7
0
 private static void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
 {
     TrayIcon.Text = ToolTipFromVolume();
     TrayIcon.Icon = IconFromVolume();
 }
Esempio n. 8
0
 internal void FireNotification(AudioVolumeNotificationData NotificationData)
 {
     AudioEndpointVolumeNotificationDelegate del = OnVolumeNotification;
     if (del != null)
     {
         del(NotificationData);
     }
 }
 private void SpeakerAudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
 {
     if (this.InvokeRequired)
     {
         object[] Params = new object[1];
         Params[0] = data;
         this.Invoke(new AudioEndpointVolumeNotificationDelegate(SpeakerAudioEndpointVolume_OnVolumeNotification), Params);
     }
     else
     {
         speaker_volume.Value = (int)(data.MasterVolume * 100);
     }
 }
Esempio n. 10
0
 internal void FireNotification(AudioVolumeNotificationData notificationData)
 {
     OnVolumeNotification?.Invoke(notificationData);
 }
Esempio n. 11
0
        private void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
        {
            _isMuted = data.Muted;

            UpdateIsMuted();
        }
Esempio n. 12
0
 void mmDeviceVolume_OnVolumeNotification(AudioVolumeNotificationData data)
 {
     Dispatcher.BeginInvoke(new Action<float>((level) =>
     {
         lock (SuppressLevelLock)
         {
             SuppressLevelEvent = true;
             LevelScalar = level;
             SuppressLevelEvent = false;
         }
     }), data.MasterVolume);
 }
Esempio n. 13
0
 void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
 {
     try
     {
         this.Invoke(new Action(delegate()
         {
             UpdateVolume();
             UpdateMuted();
         }));
     }
     catch
     {
     }
 }