Beispiel #1
0
 private void ChangeSoundDevice(SoundDevice soundDevice)
 {
     // Check recording state
      RecordingState state = this.recorder.State;
      // Debug.Assert(state == RecordingState.Idle);
      if (state != RecordingState.Idle) {
     return;
      }
      SoundSettings soundSettings = this.SoundSettings;
      if (soundDevice != null) {
     soundSettings.DeviceId = soundDevice.Id;
     if (soundSettings.Format == null) {
        soundSettings.Format = SoundProvider.SuggestFormat(soundDevice.Id, null, null, null);
        this.configuration.Sound.DeviceId = soundDevice.Id;
     }
      }
      else {
     soundSettings.DeviceId = null;
     this.configuration.Sound = soundSettings;
      }
      this.SoundSettings = soundSettings;
 }
Beispiel #2
0
 private void OnConfigurationChanged()
 {
     // General
      GeneralSettings generalSettings = this.configuration.General;
      this.chkMinimizeOnRecord.Checked = generalSettings.MinimizeOnRecord;
      this.chkHideFromTaskbar.Checked = generalSettings.HideFromTaskbar;
      this.txtOutputDirectory.Text = generalSettings.OutputDirectory;
      // Hotkeys
      HotKeySettings hotKeys = this.configuration.HotKeys;
      this.chkGlobalHotKeys.Checked = hotKeys.Global;
      this.hkCancel.Value = hotKeys.Cancel;
      this.hkPause.Value = hotKeys.Pause;
      this.hkRecord.Value = hotKeys.Record;
      this.hkStop.Value = hotKeys.Stop;
      // Mouse
      MouseSettings mouse = this.configuration.Mouse;
      this.chkRecordCursor.Checked = mouse.RecordCursor;
      this.chkHighlighCursor.Checked = mouse.HighlightCursor;
      this.cursorHighlightOptions.Color = mouse.HighlightCursorColor;
      this.cursorHighlightOptions.Radious = mouse.HighlightCursorRadious;
      // Sound
      SoundSettings sound = this.configuration.Sound;
      SoundDevice soundDevice = null;
      if (!string.IsNullOrEmpty(sound.DeviceId)) {
     soundDevice = new SoundDevice(sound.DeviceId);
      }
      this.soundDeviceSelector.SoundDevice = soundDevice;
      SoundFormat soundFormat = sound.Format;
      if (soundFormat != null) {
     this.cmbSoundFormatTag.SelectedItem = soundFormat.Tag;
     if (soundFormat != null && !this.cmbSoundFormat.Items.Contains(soundFormat)) {
        this.cmbSoundFormat.Items.Add(soundFormat);
     }
     this.cmbSoundFormat.SelectedItem = soundFormat;
      }
      // Tracking
      // this.trackerSelector.TrackingSettings = this.configuration.Tracking;
      // Video
      VideoSettings video = this.configuration.Video;
      this.cmbSoundFormat.Text = video.Fps.ToString();
      this.videoQuality = video.Quality;
      this.videoFps = video.Fps;
      this.cmbFps.Text = this.videoFps.ToString();
      this.tbQuality.Value = this.videoQuality;
      // Watermark
      WatermarkSettings watermark = this.configuration.Watermark;
      this.chkWatermark.Checked = watermark.Display;
      this.txtWatermark.Text = watermark.Text;
      this.watermarkOptions.WatermarkAlignment = watermark.Alignment;
      this.watermarkOptions.WatermarkColor = watermark.Color;
      this.watermarkOptions.WatermarkFont = watermark.Font;
      this.watermarkOptions.WatermarkMargin = watermark.Margin;
      this.watermarkOptions.WatermarkOutline = watermark.Outline;
      this.watermarkOptions.WatermarkOutlineColor = watermark.OutlineColor;
      this.watermarkOptions.WatermarkRightToLeft = watermark.RightToLeft;
      this.watermarkOptions.WatermarkText = watermark.Text;
      //
      this.UpdateHighlightImage();
      this.UpdateVideoQualityControls();
 }
Beispiel #3
0
 public SoundDevice[] GetDevices()
 {
     // Create a DEVICE object to get device info
      WSSoundInterop.DEVICE device = new WSSoundInterop.DEVICE();
      device.nMaxDesc = WSSoundInterop.WS_MAXNAMELEN;
      device.nMaxId = WSSoundInterop.WS_MAXNAMELEN;
      device.nMaxName = WSSoundInterop.WS_MAXNAMELEN;
      // Create device list to add devices into it during enumeration
      callbackDevices = new List<WSSoundInterop.DEVICE>();
      // Enumerate devices
      int hr = WSSoundInterop.WSEnumDevices(this.pws, ref device, this.deviceCallback);
      if (hr != 0) {
     throw new SoundException("WSGetNumDevices", hr);
      }
      // Convert returned DEVICEs to SoundDevice
      int nDevices = callbackDevices.Count;
      SoundDevice[] soundDevices = new SoundDevice[nDevices];
      for (int i = 0; i < nDevices; i++) {
     device = callbackDevices[i];
     // Is device input or ouput (loopback)
     WSSoundInterop.DeviceType type = (WSSoundInterop.DeviceType)device.dwType;
     bool isLoopback = type == WSSoundInterop.DeviceType.Output;
     // Create Sound Device
     SoundDevice soundDevice = new SoundDevice(device.szId, device.szName, isLoopback, device.szDescription);
     soundDevices.SetValue(soundDevice, i);
      }
      callbackDevices.Clear();
      return soundDevices;
 }
 public string GetDeviceDisplayText(SoundDevice device)
 {
     if (device == null || string.IsNullOrEmpty(device.Id)) {
     return noSoundRecording;
      }
      switch (this.displayProperty) {
     case SoundDeviceDisplayProperty.Description:
        return device.Description;
     case SoundDeviceDisplayProperty.Name:
        return device.Name;
     default:
        throw new InvalidOperationException();
      }
 }
Beispiel #5
0
 public SoundDevice[] GetDevices()
 {
     uint numDevices = MMInterop.waveInGetNumDevs();
      List<SoundDevice> devices = new List<SoundDevice>((int)numDevices);
      for (uint i = 0; i < numDevices; i++) {
     // Get device capabilities
     MMInterop.WAVEINCAPS caps = new MMInterop.WAVEINCAPS();
     int mmr = MMInterop.waveInGetDevCaps(i, ref caps, (uint)Marshal.SizeOf(caps));
     if (mmr == MMInterop.MMSYSERR_NODRIVER) {
        // No device driver is present.
        continue;
     }
     if (mmr != 0) {
        throw new SoundException("waveInGetDevCaps", mmr);
     }
     // Compare device name to loopback device names to see if
     // it is a loopback device
     bool isLoopback = false;
     foreach (string loopbackName in loopbackDeviceNames) {
        if (loopbackName.Equals(caps.szPname)) {
           isLoopback = true;
           break;
        }
     }
     SoundDevice device = new SoundDevice(i.ToString(), caps.szPname, isLoopback);
     devices.Add(device);
      }
      return devices.ToArray();
 }