Ejemplo n.º 1
0
        private void ResetLayout()
        {
            foreach (LayoutItem li in SavedLayout)
            {
                switch (li.ObjectTypeId)
                {
                case 1:
                    VolumeLevel vl = GetMicrophone(li.ObjectId);
                    if (vl != null)
                    {
                        vl.Location = new Point(li.LayoutRectangle.X, li.LayoutRectangle.Y);
                        vl.Size     = new Size(li.LayoutRectangle.Width, li.LayoutRectangle.Height);
                    }
                    break;

                case 2:
                    CameraWindow cw = GetCameraWindow(li.ObjectId);
                    if (cw != null)
                    {
                        cw.Location = new Point(li.LayoutRectangle.X, li.LayoutRectangle.Y);
                        cw.Size     = new Size(li.LayoutRectangle.Width, li.LayoutRectangle.Height);
                    }
                    break;

                case 3:
                    FloorPlanControl fp = GetFloorPlan(li.ObjectId);
                    if (fp != null)
                    {
                        fp.Location = new Point(li.LayoutRectangle.X, li.LayoutRectangle.Y);
                        fp.Size     = new Size(li.LayoutRectangle.Width, li.LayoutRectangle.Height);
                    }
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            VolumeLevel vl = CameraControl.VolumeControl;

            if (radioButton1.Checked)
            {
                CameraControl.Camobject.settings.micpair = -1;
            }
            if (radioButton2.Checked)
            {
                var li = (ListItem)ddlMic.SelectedItem;
                CameraControl.Camobject.settings.micpair = Convert.ToInt32(li.Value);
                MainForm.NeedsRedraw = true;
            }
            if (radioButton3.Checked)
            {
                int micid = ((MainForm)this.Owner.Owner).AddMicrophone(0);
                if (micid != -1)
                {
                    CameraControl.Camobject.settings.micpair = micid;
                    MainForm.NeedsRedraw = true;
                }
            }
            if (vl != null && vl != CameraControl.VolumeControl)
            {
                vl.IsEdit = false;
            }
            if (CameraControl.VolumeControl != null)
            {
                CameraControl.VolumeControl.IsEdit = true;
            }
            Close();
            return;
        }
Ejemplo n.º 3
0
    private void ChangeVolume()
    {
        // button's image component.
        Image image = GetComponent <Image>();

        switch (volume)
        {
        case VolumeLevel.Max:

            volume       = VolumeLevel.Min;
            image.sprite = sMaxVol;
            GetComponent <Button>().image = image;
            SoundManager.instance.ChangeVolume(SoundManager.instance.maxVolume);
            break;

        case VolumeLevel.Min:

            volume       = VolumeLevel.Mute;
            image.sprite = sMinVol;
            SoundManager.instance.ChangeVolume(SoundManager.instance.minVolume);
            break;

        case VolumeLevel.Mute:

            volume       = VolumeLevel.Max;
            image.sprite = sMute;
            SoundManager.instance.ChangeVolume(SoundManager.instance.muteVolume);
            break;
        }

        GetComponent <Button>().image = image;
    }
Ejemplo n.º 4
0
 public VlcStream(VolumeLevel source) : base(null)
 {
     Source = source.Micobject.settings.sourcename;
     _timeoutMilliSeconds = Math.Max(5000, source.Micobject.settings.timeout);
     _connectMilliSeconds = Math.Max(_timeoutMilliSeconds, 10000);
     _options             = source.Micobject.settings.vlcargs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
     IsAudio = true;
 }
Ejemplo n.º 5
0
    void Start()
    {
        // add click listener.
        GetComponent <Button>().onClick.AddListener(() => ChangeVolume());

        // default volume to max settings
        volume = VolumeLevel.Max;

        // change it.
        ChangeVolume();
    }
Ejemplo n.º 6
0
 public RequestInfo GetRequestInfo()
 {
     return(new RequestInfo
     {
         Method = HttpMethod.Post,
         Path = "os/setappvolume",
         Query = new NameValueCollection()
         {
             { "process", Process },
             { "volumeLevel", VolumeLevel.ToString() },
             { "deviceIndex", Device },
         },
     });
 }
Ejemplo n.º 7
0
 public RequestInfo GetRequestInfo()
 {
     return(new RequestInfo
     {
         Method = HttpMethod.Post,
         Path = "os/setsysvolume",
         Query = new NameValueCollection()
         {
             { "volumeLevel", VolumeLevel.ToString() },
             { "component", Component },
             { "deviceIndex", Device },
         },
     });
 }
Ejemplo n.º 8
0
        public Analyzer(VolumeLevel vlevel)
        {
            deviceindex = Properties.Settings.Default.PlaybackDevice;
            MMDeviceEnumerator devices = new MMDeviceEnumerator();
            var devs = devices.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active);

            device  = devs[deviceindex];
            capture = new WasapiLoopbackCapture(device);
            capture.DataAvailable += Capture_DataAvailable;
            bwp = new BufferedWaveProvider(capture.WaveFormat);
            bwp.BufferLength            = BUFFERSIZE * 2;
            bwp.DiscardOnBufferOverflow = true;
            vl         = vlevel;
            t.Tick    += T_Tick;
            t.Interval = TimeSpan.FromMilliseconds(25);
        }
Ejemplo n.º 9
0
        private void SetVolume(AudioUnit audioUnit, VolumeLevel volumeLevel)
        {
            switch (volumeLevel)
            {
            case VolumeLevel.Max:
                audioUnit.SetVolume(1.0f);
                break;

            case VolumeLevel.Normal:
                audioUnit.SetVolume(0.5f);
                break;

            case VolumeLevel.Min:
                audioUnit.SetVolume(0.2f);
                break;
            }
        }
Ejemplo n.º 10
0
 public static float GetVolumeLevelValue(VolumeLevel idx)
 {
     return(volumes[(int)idx]);
 }
Ejemplo n.º 11
0
 public static void SetVolumeLevelValue(VolumeLevel idx, float value)
 {
     volumes[(int)idx] = value;
 }
Ejemplo n.º 12
0
        private void CheckJoystick()
        {
            if (_jst != null)
            {
                _jst.UpdateStatus();

                CameraWindow cw = null;
                VolumeLevel  vl = null;

                foreach (Control c in _pnlCameras.Controls)
                {
                    if (c.Focused)
                    {
                        cw = c as CameraWindow;
                        vl = c as VolumeLevel;
                        break;
                    }
                }

                for (int i = 0; i < _jst.Buttons.Length; i++)
                {
                    if (_jst.Buttons[i] != _buttonsLast[i] && _jst.Buttons[i])
                    {
                        int j = i + 1;

                        if (j == Conf.Joystick.Listen)
                        {
                            if (cw?.VolumeControl != null)
                            {
                                cw.VolumeControl.Listening = !cw.VolumeControl.Listening;
                            }
                            if (vl != null)
                            {
                                vl.Listening = !vl.Listening;
                            }
                        }

                        if (j == Conf.Joystick.Talk)
                        {
                            if (cw != null)
                            {
                                cw.Talking = !cw.Talking;
                                TalkTo(cw, cw.Talking);
                            }
                        }

                        if (j == Conf.Joystick.Previous)
                        {
                            ProcessKey("previous_control");
                        }

                        if (j == Conf.Joystick.Next)
                        {
                            ProcessKey("next_control");
                        }

                        if (j == Conf.Joystick.Play)
                        {
                            ProcessKey("play");
                        }

                        if (j == Conf.Joystick.Stop)
                        {
                            ProcessKey("stop");
                        }

                        if (j == Conf.Joystick.Record)
                        {
                            ProcessKey("record");
                        }

                        if (j == Conf.Joystick.Snapshot)
                        {
                            cw?.SaveFrame();
                        }

                        if (j == Conf.Joystick.MaxMin)
                        {
                            ProcessKey("maxmin");
                        }
                    }

                    _buttonsLast[i] = _jst.Buttons[i];
                }

                if (cw != null)
                {
                    _sentdirection = false;
                    int x = 0, y = 0;

                    double angle = -1000;

                    if (Conf.Joystick.XAxis < 0)
                    {
                        //dpad - handles x and y
                        int dpad = _jst.Dpads[(0 - Conf.Joystick.XAxis) - 1];
                        switch (dpad)
                        {
                        case 27000:
                            angle = 0;
                            break;

                        case 31500:
                            angle = Math.PI / 4;
                            break;

                        case 0:
                            angle = Math.PI / 2;
                            break;

                        case 4500:
                            angle = 3 * Math.PI / 4;
                            break;

                        case 9000:
                            angle = Math.PI;
                            break;

                        case 13500:
                            angle = -3 * Math.PI / 4;
                            break;

                        case 18000:
                            angle = -Math.PI / 2;
                            break;

                        case 22500:
                            angle = -Math.PI / 4;
                            break;
                        }
                    }
                    else
                    {
                        if (Conf.Joystick.XAxis > 0)
                        {
                            x = _jst.Axis[Conf.Joystick.XAxis - 1] - Conf.Joystick.CenterXAxis;
                        }

                        if (Conf.Joystick.YAxis > 0)
                        {
                            y = _jst.Axis[Conf.Joystick.YAxis - 1] - Conf.Joystick.CenterYAxis;
                        }

                        var d = Math.Sqrt((x * x) + (y * y));
                        if (d > 20)
                        {
                            angle = Math.Atan2(y, x);
                        }
                    }

                    if (angle > -1000)
                    {
                        if (Conf.Joystick.InvertYAxis)
                        {
                            angle = 0 - angle;
                        }
                        if (Conf.Joystick.InvertXAxis)
                        {
                            if (angle >= 0)
                            {
                                angle = Math.PI - angle;
                            }
                            else
                            {
                                angle = (0 - Math.PI) - angle;
                            }
                        }

                        cw.Calibrating = true;
                        cw.PTZ.SendPTZDirection(angle);
                        if (!cw.PTZ.DigitalPTZ)
                        {
                            _needstop = _sentdirection = true;
                        }
                    }

                    if (Conf.Joystick.ZAxis > 0)
                    {
                        var z = _jst.Axis[Conf.Joystick.ZAxis - 1] - Conf.Joystick.CenterZAxis;

                        if (Math.Abs(z) > 20)
                        {
                            if (Conf.Joystick.InvertZAxis)
                            {
                                z = 0 - z;
                            }
                            cw.Calibrating = true;
                            cw.PTZ.SendPTZCommand(z > 0 ? Enums.PtzCommand.ZoomIn : Enums.PtzCommand.ZoomOut);

                            if (!cw.PTZ.DigitalZoom)
                            {
                                _needstop = _sentdirection = true;
                            }
                        }
                    }

                    if (!_sentdirection && _needstop)
                    {
                        cw.PTZ.SendPTZCommand(Enums.PtzCommand.Stop);
                        _needstop = false;
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public void ProcessKey(string keycommand)
        {
            bool focussed = false;

            switch (keycommand.ToLower())
            {
            case "channelup":
            case "nexttrack":
            case "next_control":
                for (int i = 0; i < _pnlCameras.Controls.Count; i++)
                {
                    Control c = _pnlCameras.Controls[i];
                    if (c.Focused)
                    {
                        i++;
                        if (i == _pnlCameras.Controls.Count)
                        {
                            i = 0;
                        }
                        _pnlCameras.Controls[i].Focus();
                        focussed = true;
                        break;
                    }
                }
                if (!focussed && _pnlCameras.Controls.Count > 0)
                {
                    _pnlCameras.Controls[0].Focus();
                }
                break;

            case "channeldown":
            case "previoustrack":
            case "previous_control":
                for (int i = 0; i < _pnlCameras.Controls.Count; i++)
                {
                    Control c = _pnlCameras.Controls[i];
                    if (c.Focused)
                    {
                        i--;
                        if (i == -1)
                        {
                            i = _pnlCameras.Controls.Count - 1;
                        }
                        _pnlCameras.Controls[i].Focus();
                        focussed = true;
                        break;
                    }
                }

                if (!focussed && _pnlCameras.Controls.Count > 0)
                {
                    _pnlCameras.Controls[0].Focus();
                }
                break;

            case "play":
            case "pause":
                foreach (Control c in _pnlCameras.Controls)
                {
                    if (c.Focused)
                    {
                        if (c is CameraWindow)
                        {
                            CameraWindow cw = (CameraWindow)c;
                            if (cw.Camobject.settings.active)
                            {
                                Maximise(cw);
                            }
                            else
                            {
                                cw.Enable();
                            }
                        }
                        if (c is VolumeLevel)
                        {
                            VolumeLevel vw = (VolumeLevel)c;
                            if (vw.Micobject.settings.active)
                            {
                                Maximise(vw);
                            }
                            else
                            {
                                vw.Enable();
                            }
                        }
                        break;
                    }
                }
                break;

            case "stop":
                foreach (Control c in _pnlCameras.Controls)
                {
                    if (c.Focused)
                    {
                        if (c is CameraWindow)
                        {
                            ((CameraWindow)c).Disable();
                        }
                        if (c is VolumeLevel)
                        {
                            ((VolumeLevel)c).Disable();
                        }
                        break;
                    }
                }
                break;

            case "record":
                foreach (Control c in _pnlCameras.Controls)
                {
                    if (c.Focused)
                    {
                        if (c is CameraWindow)
                        {
                            ((CameraWindow)c).RecordSwitch(!((CameraWindow)c).Recording);
                        }
                        if (c is VolumeLevel)
                        {
                            ((VolumeLevel)c).RecordSwitch(!((VolumeLevel)c).Recording);
                        }
                        break;
                    }
                }
                break;

            case "zoom":
                foreach (Control c in _pnlCameras.Controls)
                {
                    if (c.Focused)
                    {
                        if (c is CameraWindow || c is VolumeLevel || c is FloorPlanControl)
                        {
                            Maximise(c);
                            break;
                        }
                    }
                }
                break;

            case "standby":
            case "back":
            case "power":
                Close();
                break;
            }
        }
Ejemplo n.º 14
0
 public CloneStream(VolumeLevel source)
 {
     _source = source;
 }
Ejemplo n.º 15
0
 public CloneStream()
 {
     _source = null;
 }
Ejemplo n.º 16
0
        //*YL*-----------------------------------------------------
        private void ylResetLayout()
        {
            int iCameraCt = 4;

            foreach (LayoutItem li in SavedLayout)
            {
                switch (li.ObjectTypeId)
                {
                case 1:
                    VolumeLevel vl = GetMicrophone(li.ObjectId);
                    if (vl != null)
                    {
                        vl.Location = new Point(li.LayoutRectangle.X, li.LayoutRectangle.Y);
                        vl.Size     = new Size(li.LayoutRectangle.Width, li.LayoutRectangle.Height);
                    }
                    break;

                case 2:
                    CameraWindow cw = GetCameraWindow(li.ObjectId);
                    //System.Console.WriteLine("***** Name: " + li.ObjectId.ToString() + "****" + this.Width.ToString() + "x" + this.Height.ToString());
                    //System.Console.WriteLine("***** Name: <" + strNodeName + "><" + cw.Camobject.name + ">\t****\t" + this.Width.ToString() + "x" + this.Height.ToString());


                    /*
                     * string strWindowName = "";
                     * if ((cw.Camobject.name.IndexOf("NAE", StringComparison.OrdinalIgnoreCase) >= 0) || (cw.Camobject.name.IndexOf("Art", StringComparison.OrdinalIgnoreCase) >= 0))
                     * {
                     *  strWindowName = "NAE";
                     * }
                     * else if (cw.Camobject.name.IndexOf("Broadway", StringComparison.OrdinalIgnoreCase) >= 0)
                     * {
                     *  strWindowName = "Broadway";
                     * }
                     * else if (cw.Camobject.name.IndexOf("Leytonstone", StringComparison.OrdinalIgnoreCase) >= 0)
                     * {
                     *  strWindowName = "Leytonstone";
                     * }
                     * else if (cw.Camobject.name.IndexOf("Mill", StringComparison.OrdinalIgnoreCase) >= 0)
                     * {
                     *  strWindowName = "Mill";
                     * }
                     */


                    if (cw != null)
                    {
                        //cw.Location = new Point(li.LayoutRectangle.X, li.LayoutRectangle.Y);
                        //cw.Size = new Size(li.LayoutRectangle.Width, li.LayoutRectangle.Height);

                        iCameraCt--;

                        if (string.Compare(strNodeName, cw.strWindowName, true) == 0)
                        {
                            cw.bLocalCam = true;
                        }
                        else
                        {
                            cw.bLocalCam = false;
                        }

                        if (string.Compare(strActiveNode, cw.strWindowName, true) == 0)
                        {
                            cw.bInteraction = true;
                        }
                        else
                        {
                            cw.bInteraction = false;
                        }

                        //*****************************************************
                        cw.iLayout = iStateLayout;

                        if (this.iOnscreenMsgCt == 0)
                        {
                            cw.strOnscreenMsg    = this.strOnscreenMsg;
                            cw.iOnscreenMsgX     = this.iOnscreenMsgX;
                            cw.iOnscreenMsgY     = this.iOnscreenMsgY;
                            cw.iOnscreenMsgStyle = this.iOnscreenMsgStyle;
                            cw.iOnscreenMsgXx    = this.iOnscreenMsgXx;
                            cw.iOnscreenMsgYy    = this.iOnscreenMsgYy;
                        }
                        //*****************************************************

                        if (iStateLayout == 1)
                        {
                            int ww    = this.Width / 2 - iBGA;
                            int hh    = this.Height / 2 - iBGA;
                            int iBGA2 = iBGA / 2;
                            int iBGA3 = iBGA + iBGA2;

                            //if (iCameraCt == 3)
                            if (string.Compare(cw.strWindowName, "NAE", true) == 0)
                            {
                                cw.Location = new Point(iBGA2, iBGA2);
                                cw.Size     = new Size(ww, hh);
                            }
                            //else if (iCameraCt == 2)
                            else if (string.Compare(cw.strWindowName, "Broadway", true) == 0)
                            {
                                cw.Location = new Point(iBGA3 + ww, iBGA2);
                                cw.Size     = new Size(ww, hh);
                            }
                            //else if (iCameraCt == 1)
                            else if (string.Compare(cw.strWindowName, "Leytonstone", true) == 0)
                            {
                                cw.Location = new Point(iBGA2, iBGA3 + hh);
                                cw.Size     = new Size(ww, hh);
                            }
                            //else if (iCameraCt == 0)
                            else if (string.Compare(cw.strWindowName, "Mill", true) == 0)
                            {
                                cw.Location = new Point(iBGA3 + ww, iBGA3 + hh);
                                cw.Size     = new Size(ww, hh);
                            }
                        }
                        else if (iStateLayout == 2)
                        {
                            //if (iCameraCt == 3)
                            if (string.Compare(cw.strWindowName, "NAE", true) == 0)
                            {
                                cw.Location = new Point(0, 0);
                                cw.Size     = new Size(iWw, iWh);
                            }
                            //else if (iCameraCt == 2)
                            else if (string.Compare(cw.strWindowName, "Broadway", true) == 0)
                            {
                                cw.Location = new Point(iWw, 0);
                                cw.Size     = new Size(iWw, iWh);
                            }
                            //else if (iCameraCt == 1)
                            else if (string.Compare(cw.strWindowName, "Leytonstone", true) == 0)
                            {
                                cw.Location = new Point(iWw * 2, 0);
                                cw.Size     = new Size(iWw, iWh);
                            }
                            //else if (iCameraCt == 0)
                            else if (string.Compare(cw.strWindowName, "Mill", true) == 0)
                            {
                                cw.Location = new Point(iWw * 3, 0);
                                cw.Size     = new Size(iWw, iWh);
                            }
                        }
                        else if ((iStateLayout == 3) || (iStateLayout == 4))
                        {
                            int topline = this.Height - iWh;

                            //if (string.Compare(strNodeName, strWindowName, true) == 0)
                            if (cw.bLocalCam)
                            {
                                //cw.Location = new Point(25, 0);
                                //cw.Size = new Size(700, 1050);
                                cw.Location = new Point(0, 0);
                                cw.Size     = new Size(this.Width, this.Height);
                                cw.SendToBack();
                            }
                            else if (iCameraCt == 3)
                            {
                                cw.Location = new Point(0, topline);
                                cw.Size     = new Size(iWw, iWh);
                            }
                            else if (iCameraCt == 2)
                            {
                                cw.Location = new Point(iWw, topline);
                                cw.Size     = new Size(iWw, iWh);
                            }
                            else if (iCameraCt == 1)
                            {
                                cw.Location = new Point(iWw * 2, topline);
                                cw.Size     = new Size(iWw, iWh);
                            }
                            else if (iCameraCt == 0)
                            {
                                cw.Location = new Point(iWw * 3, topline);
                                cw.Size     = new Size(iWw, iWh);
                            }
                        }
                    }
                    break;

                case 3:
                    FloorPlanControl fp = GetFloorPlan(li.ObjectId);
                    if (fp != null)
                    {
                        fp.Location = new Point(li.LayoutRectangle.X, li.LayoutRectangle.Y);
                        fp.Size     = new Size(li.LayoutRectangle.Width, li.LayoutRectangle.Height);
                    }
                    break;
                }
            }
        }