Exemple #1
0
        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();
            }
        }
Exemple #2
0
        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();
        }