public int ToggleMute() { int hr = 0; if ((graphBuilder == null) || (basicAudio == null)) { return(0); } // Read current volume hr = basicAudio.get_Volume(out currentVolume); if (hr == -1) //E_NOTIMPL { // Fail quietly if this is a video-only media file return(0); } else if (hr < 0) { return(hr); } // Switch volume levels if (currentVolume == VolumeFull) { currentVolume = VolumeSilence; } else { currentVolume = VolumeFull; } // Set new volume hr = basicAudio.put_Volume(currentVolume); return(hr); }
void Network_VolumeDown() { if (this.InvokeRequired) { Network.SimpleEvent d = new Network.SimpleEvent(Network_VolumeDown); this.Invoke(d); } else { if (audio_mixer != null) { audio_mixer.put_Volume(volume - 500); audio_mixer.get_Volume(out volume); Network.SendStatus(channel, volume, (this.currentState == PlayState.Running)); } } }
private bool IsMuted() { int volume; if (basicAudio == null) { return(true); } int hr = basicAudio.get_Volume(out volume); if (hr < 0) { //error - no sound return(true); } return(volume == VolumeSilence); }
protected override int GetAudioVolume() { int val = -1; if (isAudioAvailable) { int hr = basicAudio.get_Volume(out val); DsError.ThrowExceptionForHR(hr); } return(val); }
internal void trackBarVolume_ValueChanged(object sender, EventArgs e) { MainForm.Settings.Volume = this.trackBarVolume.Value; if (this.MainForm.GraphBuilder != null) { IBasicAudio basicAudio = this.MainForm.GraphBuilder.FilterGraph as IBasicAudio; if (basicAudio != null) { basicAudio.put_Volume(this.trackBarVolume.Value); int volume = 0; basicAudio.get_Volume(out volume); this.labelVolumeLevel.Text = volume.ToString(); return; } } this.labelVolumeLevel.Text = this.trackBarVolume.Value.ToString(); }
//set the trackBar1'value equel the video'progress private void updateTimeBarThread() { double time; int volu; while (true) { mediaPosition.get_CurrentPosition(out time); Console.WriteLine(time); basicAudio.get_Volume(out volu); Console.WriteLine(volu); this.BeginInvoke(new MethodInvoker(() => { trackBar1.Value = (int)time; })); Thread.Sleep(1000); } }
private void updateTimeBarThread() { long time; int volu; while (true) { try { MediaSeeking.GetCurrentPosition(out time); BasicAudio.get_Volume(out volu); this.BeginInvoke(new MethodInvoker(() => { trackBar1.Value = (int)time; })); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } Thread.Sleep(1000); } }
/// <summary> /// Mute or unmute the sound. /// </summary> public void Mute() { int hr = 0; // Stop and reset postion to beginning if ((_currentState == PlayState.Paused) || (_currentState == PlayState.Running)) { // Read current volume hr = _basicAudio.get_Volume(out _currentVolume); //E_NOTIMPL if (hr == -1) { // Fail quietly if this is a video-only media file return; } else if (hr < 0) { return; } // Switch volume levels if (_currentVolume == VolumeFull) { _currentVolume = VolumeSilence; } else { _currentVolume = VolumeFull; } // Set new volume hr = _basicAudio.put_Volume(_currentVolume); DsError.ThrowExceptionForHR(hr); } }
public bool GetVolume(out int volume) { return(_basicAudio.get_Volume(out volume) == DsHlp.S_OK); }