private void CameraMicSource_Load(object sender, EventArgs e) { int micind = 0, ind = 0; foreach (objectsMicrophone om in MainForm.Microphones) { objectsMicrophone om1 = om; if ( MainForm.Cameras.Count(p => p.settings.micpair == om1.id && p.id != CameraControl.Camobject.id) == 0) { ddlMic.Items.Add(new ListItem(om.name, om.id.ToString())); if (CameraControl.Camobject.settings.micpair == om.id) { micind = ind; radioButton2.Checked = true; } ind++; } } if (ddlMic.Items.Count == 0) { ddlMic.Enabled = false; radioButton2.Enabled = false; } else { ddlMic.SelectedIndex = micind; } if (!radioButton2.Checked) { radioButton1.Checked = true; } _loaded = true; }
private void Form1_Load(object sender, EventArgs e) { try { Mic = AddMicrophone(); //取得输出设备 var d = DirectSoundOut.Devices; if (d != null) { foreach (var dev in d) { ddlAudioOut.Add(new ListItem(dev.Description, new string[] { dev.Guid.ToString() })); } } sw = new Stopwatch(); speakTime = new Timer(1000); speakTime.AutoReset = true; //用来记录F2按下的时间 checkF2HotKey = new Timer(100); checkF2HotKey.AutoReset = true; checkF2HotKey.Elapsed += CheckF2HotKey_Elapsed; } catch (Exception ex) { logger.Error(ex.Message); } }
/// <summary> /// 连接主端,获取音频信号并播放 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void connectButton_Click(object sender, EventArgs e) { string str = textBox1.Text; if (!string.IsNullOrEmpty(str)) { OutMic = AddMicrophone(); OutMic.settings.sourcename = str; OutMic.settings.deviceout = ((ListItem)ddlAudioOut.SelectedItem).Value[0]; if (OutVolumeLevel == null) { OutVolumeLevel = new VolumeLevel(OutMic); } else { OutVolumeLevel.Micobject = OutMic; } this.panel.Controls.Add(OutVolumeLevel); OutVolumeLevel.Dock = DockStyle.Fill; OutVolumeLevel.ParentForm = this; OutVolumeLevel.Listening = true; OutVolumeLevel.Refresh(); OutVolumeLevel.Enable(); //OutVolumeLevel.Invalidate(); } }
/// <summary> /// Initializes a new instance of the <see cref="VlcStream"/> class. /// </summary> /// /// <param name="source">URL, which provides VLCstream.</param> /// <param name="arguments"></param> public VlcStream(objectsMicrophone source, string[] arguments) : base(null) { _audiosource = source; _arguments = arguments; TimeOut = source.settings.timeout; _modeAudio = true; }
public MediaStream(objectsMicrophone source) : base(null) { _audiosource = source; _inputFormat = null; IsAudio = true; _timeoutMicroSeconds = Math.Max(5000000, source.settings.timeout * 1000); _options = source.settings.ffmpeg; }
/// <summary> /// 开始结束的Label和Panel均绑定此事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lb_BeingOver_MouseClick(object sender, MouseEventArgs e) { Thread th = null; try { UpdateBeginButton(isBegin); if (!isBegin) { //设置F2热键的ID为100,注册热键 //logger.Info("注册系统热键F2键。"); //HotKey.RegisterHotKey(Handle, 100, HotKey.KeyModifiers.None, Keys.F2); isBegin = true; Mic = AddMicrophone(); //if (ddlAudioOut.Count > 0 && !string.IsNullOrEmpty(clientIP)) //{ // Mic.settings.sourcename = clientIP; // Mic.settings.active = true; // Mic.settings.deviceout = ((ListItem)ddlAudioOut[0]).Value[0]; // MicVolumeLevel = new SendVolumeLevel(Mic); // MicVolumeLevel.AudioMode = 0; // MicVolumeLevel.Enable(); //} ChildThreadException = null; ChildThreadException += new ChildThreadExceptionHandler(Import_ChildThreadException); th = new Thread(new System.Threading.ThreadStart(MicVolumeLevelEnable)); th.IsBackground = true; th.Start(); } else { //logger.Info("取消注册系统热键F2键。"); //HotKey.UnregisterHotKey(Handle, 100); isBegin = false; if (MicVolumeLevel != null) { //断开语音传输 MicVolumeLevel.Disable(); } if (th != null) { th.Abort(); } speakTime.Stop(); sw.Stop(); sw.Reset(); logger.Info("结束指挥!!!计时器停止。"); } } catch (SocketException) { } catch (Exception be) { logger.Error("指挥操作出现异常。Exception:{0}", be.Message); } }
private void MainForm_Load(object sender, EventArgs e) { //设置F2热键的ID为100,注册热键 HotKey.RegisterHotKey(Handle, 100, HotKey.KeyModifiers.None, Keys.F2); Mic = AddMicrophone(); try { MWS = new iSpyLANServer(this); MWS.StartServer(); //输入设备 int _i = 0; for (int n = 0; n < WaveIn.DeviceCount; n++) { ddlDevice.Items.Add(WaveIn.GetCapabilities(n).ProductName); if (WaveIn.GetCapabilities(n).ProductName == Mic.settings.sourcename) { selind = _i; } _i++; } ddlDevice.Enabled = true; if (selind > -1) { ddlDevice.SelectedIndex = selind; } else { if (ddlDevice.Items.Count == 0) { ddlDevice.Items.Add(NoDevices); ddlDevice.Enabled = false; } else { ddlDevice.SelectedIndex = 0; } } } catch (ApplicationException ex) { ddlDevice.Items.Add(NoDevices); ddlDevice.Enabled = false; MessageBox.Show(ex.ToString()); } _updateTime = new Timer(500); _updateTime.Elapsed += _updateTime_Elapsed; _updateTime.AutoReset = true; _updateTime.Start(); //用来记录F2按下的时间 checkF2HotKey = new Timer(500); checkF2HotKey.AutoReset = true; checkF2HotKey.Elapsed += CheckF2HotKey_Elapsed; }
public MediaStream(objectsMicrophone source) : base(null) { _audiosource = source; _inputFormat = null; _modeAudio = true; _timeout = source.settings.timeout; _analyzeDuration = source.settings.analyzeduration; _options = source.settings.ffmpeg; }
public VolumeLevel(objectsMicrophone om) { InitializeComponent(); SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true); Margin = new Padding(0, 0, 0, 0); Padding = new Padding(0, 0, 5, 5); BorderStyle = BorderStyle.None; BackColor = iSpyServer.Default.BackColor; Micobject = om; }
public SendVolumeLevel(objectsMicrophone om, int mode, Form1 form) { InitializeComponent(); SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true); Margin = new Padding(0, 0, 0, 0); Padding = new Padding(0, 0, 5, 5); BorderStyle = BorderStyle.None; BackColor = Color.Gray; Micobject = om; audioMode = mode; ParentForm = form; }
private void button1_Click(object sender, EventArgs e) { string str = textBox1.Text; if (!string.IsNullOrEmpty(str)) { OutMic = AddMicrophone(); OutMic.settings.sourcename = str; OutMic.settings.active = true; OutMic.settings.deviceout = ((ListItem)ddlAudioOut.SelectedItem).Value[0]; OutVolumeLevel = new VolumeLevel(OutMic); this.panel2.Controls.Add(OutVolumeLevel); OutVolumeLevel.Dock = DockStyle.Fill; OutVolumeLevel.Listening = true; // OutVolumeLevel.Enable(); OutVolumeLevel.Apply(); } }
private void ShowObjects() { lbObjects.Items.Clear(); foreach (objectsCamera oc in MainForm.Cameras) { objectsCamera oc1 = oc; if (_floorPlanEntries.SingleOrDefault(p => p.id == oc1.id && p.type == "camera") == null) { lbObjects.Items.Add(new ListItem(oc.name, oc.id, "camera")); } } foreach (objectsMicrophone om in MainForm.Microphones) { objectsMicrophone om1 = om; if (_floorPlanEntries.SingleOrDefault(p => p.id == om1.id && p.type == "microphone") == null) { lbObjects.Items.Add(new ListItem(om.name, om.id, "microphone")); } } }
private void Form1_Load(object sender, EventArgs e) { try { this.AudioNotify.Visible = true; this.WindowState = FormWindowState.Minimized; this.ShowInTaskbar = false; this.Hide(); Mic = AddMicrophone(); for (int n = 0; n < WaveIn.DeviceCount; n++) { ddlDevice.Add(WaveIn.GetCapabilities(n).ProductName); } OutVolumeLevel = new VolumeLevel(Mic, this); OutVolumeLevel.Listening = true; OutVolumeLevel.Enable(); Logger.Info("窗口加载完成。"); } catch (Exception ex) { Logger.Info("窗口加载出现异常。" + ex.Message); } }
public VolumeLevel(objectsMicrophone om, MainForm mainForm) { InitializeComponent(); SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true); Margin = new Padding(0, 0, 0, 0); Padding = new Padding(0, 0, 5, 5); BorderStyle = BorderStyle.None; BackgroundColor = MainForm.BackgroundColor; Micobject = om; MainClass = mainForm; ErrorHandler += VolumeLevel_ErrorHandler; _toolTipMic = new ToolTip { AutomaticDelay = 500, AutoPopDelay = 1500 }; }
internal void EditMicrophone(objectsMicrophone om) { VolumeLevel vlf = null; for (int index = 0; index < _pnlCameras.Controls.Count; index++) { Control c = _pnlCameras.Controls[index]; if (c.GetType() != typeof(VolumeLevel)) continue; var vl = (VolumeLevel)c; if (vl.Micobject.id == om.id) { vlf = vl; break; } } if (vlf != null) { TopMost = false; var am = new AddMicrophone { VolumeLevel = vlf }; am.ShowDialog(this); am.Dispose(); TopMost = MainForm.Conf.AlwaysOnTop; } }
private VolumeLevel NewVolumeLevel(int audioSourceIndex) { var om = new objectsMicrophone { alerts = new objectsMicrophoneAlerts(), detector = new objectsMicrophoneDetector(), notifications = new objectsMicrophoneNotifications(), recorder = new objectsMicrophoneRecorder(), schedule = new objectsMicrophoneSchedule { entries = new objectsMicrophoneScheduleEntry [ 0 ] }, settings = new objectsMicrophoneSettings(), id = -1, directory = MainForm.RandomString(5), x = Convert.ToInt32(MainForm.Random.NextDouble() * 100), y = Convert.ToInt32(MainForm.Random.NextDouble() * 100), width = 160, height = 40, description = "", newrecordingcount = 0, name = LocRm.GetString("Microphone") + " " + MainForm.NextMicrophoneId }; om.settings.typeindex = audioSourceIndex; om.settings.deletewav = true; om.settings.ffmpeg = MainForm.Conf.FFMPEG_Microphone; om.settings.buffer = 4; om.settings.samples = 8000; om.settings.bits = 16; om.settings.gain = 100; om.settings.channels = 1; om.settings.decompress = true; om.settings.smsnumber = MainForm.MobileNumber; om.settings.emailaddress = MainForm.EmailAddress; om.settings.active = false; om.settings.notifyondisconnect = false; if (VlcHelper.VlcInstalled) om.settings.vlcargs = "-I" + NL + "dummy" + NL + "--ignore-config"; else om.settings.vlcargs = ""; om.settings.storagemanagement = new objectsMicrophoneSettingsStoragemanagement { enabled = false, maxage = 72, maxsize = 1024 }; om.detector.sensitivity = 60; om.detector.nosoundinterval = 30; om.detector.soundinterval = 0; om.detector.recordondetect = true; om.alerts.mode = "sound"; om.alerts.minimuminterval = 180; om.alerts.executefile = ""; om.alerts.active = true; om.alerts.alertoptions = "false,false"; om.alerts.trigger = ""; om.recorder.inactiverecord = 5; om.recorder.maxrecordtime = 900; om.notifications.sendemail = false; om.notifications.sendsms = false; om.schedule.active = false; om.alertevents = new objectsMicrophoneAlertevents { entries = new objectsMicrophoneAlerteventsEntry[] { } }; var volumeControl = new VolumeLevel(om) { BackColor = MainForm.Conf.BackColor.ToColor() }; _pnlCameras.Controls.Add(volumeControl); volumeControl.Location = new Point(om.x, om.y); volumeControl.Size = new Size(160, 40); volumeControl.BringToFront(); SetMicrophoneEvents(volumeControl); if (MainForm.Conf.AutoLayout) LayoutObjects(0, 0); volumeControl.Tag = GetControlIndex(); return volumeControl; }
private void Form1_Load(object sender, EventArgs e) { Mic = AddMicrophone(); EncoderParams = new EncoderParameters(1) { Param = { [0] = new EncoderParameter( System.Drawing.Imaging.Encoder.Quality, 75) } }; try { MWS = new iSpyLANServer(this); MWS.StartServer(); //获取输入设备 int _i = 0; for (int n = 0; n < WaveIn.DeviceCount; n++) { ddlDevice.Items.Add(WaveIn.GetCapabilities(n).ProductName); if (WaveIn.GetCapabilities(n).ProductName == Mic.settings.sourcename) { selind = _i; } _i++; } ddlDevice.Enabled = true; if (selind > -1) { ddlDevice.SelectedIndex = selind; } else { if (ddlDevice.Items.Count == 0) { ddlDevice.Items.Add(NoDevices); ddlDevice.Enabled = false; } else { ddlDevice.SelectedIndex = 0; } } //取得输出设备 int i = 0, j = 0; var d = DirectSoundOut.Devices; if (d != null) { foreach (var dev in d) { ddlAudioOut.Items.Add(new ListItem(dev.Description, new string[] { dev.Guid.ToString() })); if (dev.Guid.ToString() == AudioOutDevice) { i = j; } j++; } if (ddlAudioOut.Items.Count > 0) { ddlAudioOut.SelectedIndex = i; } else { ddlAudioOut.Enabled = false; } } } catch (ApplicationException ex) { ddlDevice.Items.Add(NoDevices); ddlDevice.Enabled = false; ddlAudioOut.Items.Add(NoDevices); ddlAudioOut.Enabled = false; } _updateTime = new Timer(500); _updateTime.Elapsed += _updateTime_Elapsed; _updateTime.AutoReset = true; _updateTime.Start(); }
public static string AlertSummary(objectsActionsEntry e) { string t = "Unknown"; bool b; switch (e.type.ToUpperInvariant()) { case "EXE": t = LocRm.GetString("ExecuteFile") + ": " + e.param1; break; case "URL": t = LocRm.GetString("CallURL") + ": " + e.param1; Boolean.TryParse(e.param2, out b); if (b) { t += " (POST grab)"; } break; case "NM": t = e.param1 + " " + e.param2 + ":" + e.param3 + " (" + e.param4 + ")"; break; case "S": t = LocRm.GetString("PlaySound") + ": " + e.param1; break; case "ATC": t = LocRm.GetString("SoundThroughCamera") + ": " + e.param1; break; case "SW": t = LocRm.GetString("ShowWindow"); break; case "B": t = LocRm.GetString("Beep"); break; case "M": t = LocRm.GetString("Maximise"); break; case "MO": t = LocRm.GetString("SwitchMonitorOn"); break; case "TA": { string[] op = e.param1.Split(','); string n = "[removed]"; int id = Convert.ToInt32(op[1]); switch (op[0]) { case "1": objectsMicrophone om = MainForm.Microphones.FirstOrDefault(p => p.id == id); if (om != null) { n = om.name; } break; case "2": objectsCamera oc = MainForm.Cameras.FirstOrDefault(p => p.id == id); if (oc != null) { n = oc.name; } break; } t = LocRm.GetString("TriggerAlertOn") + " " + n; } break; case "SOO": { string[] op = e.param1.Split(','); string n = "[removed]"; int id = Convert.ToInt32(op[1]); switch (op[0]) { case "1": objectsMicrophone om = MainForm.Microphones.FirstOrDefault(p => p.id == id); if (om != null) { n = om.name; } break; case "2": objectsCamera oc = MainForm.Cameras.FirstOrDefault(p => p.id == id); if (oc != null) { n = oc.name; } break; } t = LocRm.GetString("SwitchObjectOn") + " " + n; } break; case "SOF": { string[] op = e.param1.Split(','); string n = "[removed]"; int id; int.TryParse(op[1], out id); switch (op[0]) { case "1": objectsMicrophone om = MainForm.Microphones.FirstOrDefault(p => p.id == id); if (om != null) { n = om.name; } break; case "2": objectsCamera oc = MainForm.Cameras.FirstOrDefault(p => p.id == id); if (oc != null) { n = oc.name; } break; } t = LocRm.GetString("SwitchObjectOff") + " " + n; } break; case "E": t = LocRm.GetString("SendEmail") + ": " + e.param1; if (e.param2 != "") { bool.TryParse(e.param2, out b); if (b) { t += " (include grab)"; } } break; case "SMS": t = LocRm.GetString("SendSMS") + ": " + e.param1; break; case "TM": t = LocRm.GetString("SendTwitterMessage"); break; } return(t); }
internal void DisplayMicrophone(objectsMicrophone mic) { var micControl = new VolumeLevel(mic); SetMicrophoneEvents(micControl); micControl.BackColor = iSpyServer.Default.BackColor; _pnlCameras.Controls.Add(micControl); micControl.Location = new Point(mic.x, mic.y); micControl.Size = new Size(mic.width, mic.height); micControl.BringToFront(); if (mic.settings.active) micControl.Enable(); }
internal void DisplayMicrophone(objectsMicrophone mic) { var micControl = new VolumeLevel(mic); SetMicrophoneEvents(micControl); micControl.BackColor = Conf.BackColor.ToColor(); _pnlCameras.Controls.Add(micControl); micControl.Location = new Point(mic.x, mic.y); micControl.Size = new Size(mic.width, mic.height); micControl.BringToFront(); micControl.Tag = GetControlIndex(); if (Conf.AutoSchedule && mic.schedule.active && mic.schedule.entries.Count() > 0) { mic.settings.active = false; micControl.ApplySchedule(); } else { if (mic.settings.active) micControl.Enable(); } string path = Conf.MediaDirectory + "audio\\" + mic.directory + "\\"; if (!Directory.Exists(path)) Directory.CreateDirectory(path); }
private VolumeLevel NewVolumeLevel(int audioSourceIndex) { var om = new objectsMicrophone { alerts = new objectsMicrophoneAlerts(), detector = new objectsMicrophoneDetector(), notifications = new objectsMicrophoneNotifications(), recorder = new objectsMicrophoneRecorder(), schedule = new objectsMicrophoneSchedule { entries = new objectsMicrophoneScheduleEntry [ 0 ] }, settings = new objectsMicrophoneSettings(), id = -1, directory = RandomString(5), x = Convert.ToInt32(Random.NextDouble() * 100), y = Convert.ToInt32(Random.NextDouble() * 100), width = 160, height = 40, description = "", newrecordingcount = 0 }; string friendlyName = LocRm.GetString("Microphone") + " " + NextMicrophoneId; string t = friendlyName; int i = 1; while (Microphones.FirstOrDefault(p => p.name == t) != null) { t = friendlyName + " (" + i + ")"; i++; } om.name = t; om.settings.typeindex = audioSourceIndex; om.settings.deletewav = true; om.settings.ffmpeg = Conf.FFMPEG_Microphone; om.settings.buffer = 4; om.settings.samples = 8000; om.settings.bits = 16; om.settings.gain = 100; om.settings.channels = 1; om.settings.decompress = true; om.settings.smsnumber = MobileNumber; om.settings.emailaddress = EmailAddress; om.settings.active = false; om.settings.notifyondisconnect = false; om.settings.directoryIndex = Conf.MediaDirectories.First().ID; om.settings.vlcargs = VlcHelper.VlcInstalled ? "--rtsp-caching=100" : ""; om.settings.storagemanagement = new objectsMicrophoneSettingsStoragemanagement { enabled = false, maxage = 72, maxsize = 1024 }; om.detector.sensitivity = 60; om.detector.minsensitivity = 60; om.detector.maxsensitivity = 100; om.detector.nosoundinterval = 30; om.detector.soundinterval = 0; om.detector.recordondetect = Conf.DefaultRecordOnDetect; om.detector.recordonalert = Conf.DefaultRecordOnAlert; om.alerts.mode = "sound"; om.alerts.minimuminterval = 180; om.alerts.executefile = ""; om.alerts.active = true; om.alerts.alertoptions = "false,false"; om.alerts.trigger = ""; om.recorder.inactiverecord = 5; om.recorder.maxrecordtime = 900; om.notifications.sendemail = false; om.notifications.sendsms = false; om.schedule.active = false; om.alertevents = new objectsMicrophoneAlertevents { entries = new objectsMicrophoneAlerteventsEntry[] { } }; var volumeControl = new VolumeLevel(om,this) { BackColor = Conf.BackColor.ToColor() }; _pnlCameras.Controls.Add(volumeControl); volumeControl.Location = new Point(om.x, om.y); volumeControl.Size = new Size(160, 40); volumeControl.BringToFront(); SetMicrophoneEvents(volumeControl); if (Conf.AutoLayout) LayoutObjects(0, 0); volumeControl.Tag = GetControlIndex(); return volumeControl; }
public void DisplayMicrophone(objectsMicrophone mic) { var micControl = new VolumeLevel(mic,this); SetMicrophoneEvents(micControl); micControl.BackColor = Conf.BackColor.ToColor(); _pnlCameras.Controls.Add(micControl); micControl.Location = new Point(mic.x, mic.y); micControl.Size = new Size(mic.width, mic.height); micControl.BringToFront(); micControl.Tag = GetControlIndex(); try { string path = Helper.GetMediaDirectory(1, mic.id) + "audio\\" + mic.directory + "\\"; if (!Directory.Exists(path)) Directory.CreateDirectory(path); } catch (Exception ex) { LogExceptionToFile(ex); } micControl.GetFiles(); }
public VolumeLevel(objectsMicrophone om, FrmVoiceListener parent) { Micobject = om; Parent = parent; }
internal void EditMicrophone(objectsMicrophone om) { VolumeLevel vlf = null; foreach (Control c in _pnlCameras.Controls) { if (c.GetType() == typeof (VolumeLevel)) { var vl = (VolumeLevel) c; if (vl.Micobject.id == om.id) { vlf = vl; break; } } } if (vlf != null) { var am = new AddMicrophone {VolumeLevel = vlf}; am.ShowDialog(this); am.Dispose(); } }
private objectsMicrophone AddMicrophone() { objectsMicrophone Mic = new objectsMicrophone { alerts = new objectsMicrophoneAlerts(), detector = new objectsMicrophoneDetector(), notifications = new objectsMicrophoneNotifications(), recorder = new objectsMicrophoneRecorder(), schedule = new objectsMicrophoneSchedule { entries = new objectsMicrophoneScheduleEntry [ 0 ] } }; Mic.settings = new objectsMicrophoneSettings(); Mic.id = 1; //om.directory = RandomString(5); Mic.x = 0; Mic.y = 0; Mic.width = 160; Mic.height = 40; Mic.name = "MIC"; Mic.description = ""; Mic.newrecordingcount = 0; int port = 257; //foreach (objectsMicrophone om2 in Microphones) //{ // if (om2.port > port) // port = om2.port + 1; //} Mic.port = port; Mic.settings.typeindex = 0; // if (audioSourceIndex == 2) // om.settings.typeindex = 1; Mic.settings.deletewav = true; Mic.settings.buffer = 4; Mic.settings.samples = 8000; Mic.settings.bits = 16; Mic.settings.channels = 1; Mic.settings.decompress = true; Mic.settings.active = false; Mic.settings.notifyondisconnect = false; Mic.detector.sensitivity = 60; Mic.detector.nosoundinterval = 30; Mic.detector.soundinterval = 0; Mic.detector.recordondetect = true; Mic.alerts.mode = "sound"; Mic.alerts.minimuminterval = 60; Mic.alerts.executefile = ""; Mic.alerts.active = false; Mic.alerts.alertoptions = "false,false"; Mic.recorder.inactiverecord = 5; Mic.recorder.maxrecordtime = 900; Mic.notifications.sendemail = false; Mic.notifications.sendsms = false; Mic.schedule.active = false; return(Mic); }
private void AddMicrophone(int audioSourceIndex) { var om = new objectsMicrophone { alerts = new objectsMicrophoneAlerts(), detector = new objectsMicrophoneDetector(), notifications = new objectsMicrophoneNotifications(), recorder = new objectsMicrophoneRecorder(), schedule = new objectsMicrophoneSchedule { entries = new objectsMicrophoneScheduleEntry [ 0 ] } }; om.settings = new objectsMicrophoneSettings(); om.id = -1; om.directory = RandomString(5); om.x = 0; om.y = 0; om.width = 160; om.height = 40; om.name = ""; om.description = ""; om.newrecordingcount = 0; int port = 257; foreach (objectsMicrophone om2 in Microphones) { if (om2.port > port) port = om2.port + 1; } om.port = port; om.settings.typeindex = 0; if (audioSourceIndex == 2) om.settings.typeindex = 1; om.settings.deletewav = true; om.settings.ffmpeg = iSpyServer.Default.FFMPEG_Microphone; om.settings.buffer = 4; om.settings.samples = 22050; om.settings.bits = 16; om.settings.channels = 1; om.settings.decompress = true; om.settings.smsnumber = MobileNumber; om.settings.emailaddress = EmailAddress; om.settings.active = false; om.settings.notifyondisconnect = false; om.detector.sensitivity = 60; om.detector.nosoundinterval = 30; om.detector.soundinterval = 0; om.detector.recordondetect = true; om.alerts.mode = "sound"; om.alerts.minimuminterval = 60; om.alerts.executefile = ""; om.alerts.active = false; om.alerts.alertoptions = "false,false"; om.recorder.inactiverecord = 5; om.recorder.maxrecordtime = 900; om.notifications.sendemail = false; om.notifications.sendsms = false; om.schedule.active = false; var volumeControl = new VolumeLevel(om) {BackColor = iSpyServer.Default.BackColor}; _pnlCameras.Controls.Add(volumeControl); volumeControl.Location = new Point(om.x, om.y); volumeControl.Size = new Size(160, 40); volumeControl.BringToFront(); SetMicrophoneEvents(volumeControl); var am = new AddMicrophone {VolumeLevel = volumeControl}; am.ShowDialog(this); if (am.DialogResult == DialogResult.OK) { am.VolumeLevel.Micobject.id = iSpyServer.Default.NextMicrophoneID; iSpyServer.Default.NextMicrophoneID++; Microphones.Add(om); SetNewStartPosition(); NeedsSync = true; } else { volumeControl.Disable(); _pnlCameras.Controls.Remove(volumeControl); volumeControl.Dispose(); } am.Dispose(); }
internal void EditMicrophone(objectsMicrophone om, IWin32Window owner = null) { VolumeLevel vlf = null; for (int index = 0; index < _pnlCameras.Controls.Count; index++) { Control c = _pnlCameras.Controls[index]; if (c.GetType() != typeof(VolumeLevel)) continue; var vl = (VolumeLevel)c; if (vl.Micobject.id == om.id) { vlf = vl; break; } } if (vlf != null) { var am = new AddMicrophone { VolumeLevel = vlf, MainClass = this }; am.ShowDialog(owner ?? this); am.Dispose(); } }
private void SetMic(string s, objectsMicrophone om) { switch (s) { case "Groups": om.settings.accessgroups = OM.settings.accessgroups; break; case "Sound Detector Settings": om.detector.gain = OM.detector.gain; om.detector.maxsensitivity = OM.detector.maxsensitivity; om.detector.minsensitivity = OM.detector.minsensitivity; om.detector.sensitivity = OM.detector.sensitivity; break; case "Alert Settings": om.alerts.active = OM.alerts.active; om.alerts.mode = OM.alerts.mode; om.alerts.groupname = OM.alerts.groupname; om.alerts.resetinterval = OM.alerts.resetinterval; om.alerts.minimuminterval = OM.alerts.minimuminterval; break; case "Actions: Alert": { CopyActions(OM.id, om.id, 1, "alert"); } break; case "Actions: Connection Lost": { CopyActions(OM.id, om.id, 1, "disconnect"); } break; case "Actions: Reconnect": { CopyActions(OM.id, om.id, 1, "reconnect"); } break; case "Recording Mode": om.detector.recordonalert = OM.detector.recordonalert; om.detector.recordondetect = OM.detector.recordondetect; break; case "Recording Settings (excluding triggers)": om.settings.buffer = OM.settings.buffer; om.detector.recordondetect = OM.detector.recordondetect; om.detector.recordonalert = OM.detector.recordonalert; om.recorder.inactiverecord = OM.recorder.inactiverecord; om.recorder.maxrecordtime = OM.recorder.maxrecordtime; om.recorder.minrecordtime = OM.recorder.minrecordtime; break; case "Schedule": { om.schedule.entries = OM.schedule.entries.ToArray(); om.schedule.active = OM.schedule.active; } break; case "Storage Settings (excluding directory)": om.settings.storagemanagement.archive = OM.settings.storagemanagement.archive; om.settings.storagemanagement.enabled = OM.settings.storagemanagement.enabled; om.settings.storagemanagement.maxage = OM.settings.storagemanagement.maxage; om.settings.storagemanagement.maxsize = OM.settings.storagemanagement.maxsize; break; } }
public SendVolumeLevel(objectsMicrophone om) { Micobject = om; }