Ejemplo n.º 1
0
 protected virtual void Tick(object sender, EventArgs e)
 {
     if (_up)
     {
         _current += _increment;
         if (_current >= _end)
         {
             Finish();
         }
         else
         {
             foreach (Photon pair in _chans)
             {
                 DMXController.SetLevel(_setterName, pair.Channel, Convert.ToInt32(Math.Floor((_level * _current * pair.Intensity) / 65025)));
             }
         }
     }
     else
     {
         _current -= _increment;
         if (_current <= _end)
         {
             Finish();
         }
         else
         {
             foreach (Photon pair in _chans)
             {
                 DMXController.SetLevel(_setterName, pair.Channel, Convert.ToInt32(Math.Floor((_level * _current * pair.Intensity) / 65025)));
             }
         }
     }
 }
Ejemplo n.º 2
0
        public void MoveTo(Point point, double fadeTime, string sender)
        {
            if (!HasPan || !HasTilt)
            {
                throw new FixtureNotMovableException();
            }

            if (fadeTime == 0)
            {
                int tiltCoarse = (int)point.Y / 256;
                int tiltFine   = (int)point.Y % 256;
                int panCoarse  = (int)point.X / 256;
                int panFine    = (int)point.X % 256;
                DMXController.SetLevel(Name, GetTiltCoarseAttr.Photons[0].Channel, tiltCoarse);
                DMXController.SetLevel(Name, GetTiltFineAttr.Photons[0].Channel, tiltFine);
                DMXController.SetLevel(Name, GetPanCoarseAttr.Photons[0].Channel, panCoarse);
                DMXController.SetLevel(Name, GetPanFineAttr.Photons[0].Channel, panFine);
            }
            else
            {
                //Tilt
                PanTiltCoarseFineFader fader = new PanTiltCoarseFineFader(sender, GetTiltCoarseAttr.Photons[0].Channel, GetTiltFineAttr.Photons[0].Channel, (int)point.Y, GetPanCoarseAttr.Photons[0].Channel, GetPanFineAttr.Photons[0].Channel, (int)point.X, fadeTime);

                lock (m_lock)
                {
                    fader.Run(new FaderDoneCallback(DoneMoving));
                    Monitor.Wait(m_lock);
                }
            }
        }
Ejemplo n.º 3
0
        public void SetLevel(int intensity, string sender)
        {
            if (_snapOn && intensity > 0)
            {
                intensity = 255;
            }

            foreach (Photon photon in _photons)
            {
                DMXController.SetLevel(sender, photon.Channel, (int)(intensity * photon.Intensity / 255.0));
            }
        }
Ejemplo n.º 4
0
 protected virtual void Finish()
 {
     if (_timer != null)
     {
         _timer.Stop();
     }
     foreach (Photon pair in _chans)
     {
         DMXController.SetLevel(_setterName, pair.Channel, (_level * _end * pair.Intensity) / 65025);
     }
     if (_callback != null)
     {
         _callback();
     }
 }
Ejemplo n.º 5
0
 public override void Kill()
 {
     if (_timer != null)
     {
         _timer.Stop();
     }
     foreach (Photon pair in _chans)
     {
         DMXController.SetLevel(_setterName, pair.Channel, 0);
     }
     if (_callback != null)
     {
         _callback();
     }
 }
Ejemplo n.º 6
0
 protected override void Tick(object sender, EventArgs e)
 {
     if (_up)
     {
         //The normal "superclass" variables store the Pan values.
         _current     += _increment;
         _tiltCurrent += _tiltIncrement;
         if (_current >= _end)
         {
             Finish();
         }
         else
         {
             double fine   = _current % 256;
             double coarse = _current / 256;
             DMXController.SetLevel(_setterName, _panFineChannel, Convert.ToInt32(Math.Floor((_level * fine) / 255)));
             DMXController.SetLevel(_setterName, _panCoarseChannel, Convert.ToInt32(Math.Floor((_level * coarse) / 255)));
             double tiltFine   = _tiltCurrent % 256;
             double tiltCoarse = _tiltCurrent / 256;
             DMXController.SetLevel(_setterName, _tiltFineChannel, Convert.ToInt32(Math.Floor((_level * tiltFine) / 255)));
             DMXController.SetLevel(_setterName, _tiltCoarseChannel, Convert.ToInt32(Math.Floor((_level * tiltCoarse) / 255)));
         }
     }
     else
     {
         _current     -= _increment;
         _tiltCurrent -= _tiltIncrement;
         if (_current <= _end)
         {
             Finish();
         }
         else
         {
             double fine   = _current % 256;
             double coarse = _current / 256;
             DMXController.SetLevel(_setterName, _panFineChannel, Convert.ToInt32(Math.Floor((_level * fine) / 255)));
             DMXController.SetLevel(_setterName, _panCoarseChannel, Convert.ToInt32(Math.Floor((_level * coarse) / 255)));
             double tiltFine   = _tiltCurrent % 256;
             double tiltCoarse = _tiltCurrent / 256;
             DMXController.SetLevel(_setterName, _tiltFineChannel, Convert.ToInt32(Math.Floor((_level * tiltFine) / 255)));
             DMXController.SetLevel(_setterName, _tiltCoarseChannel, Convert.ToInt32(Math.Floor((_level * tiltCoarse) / 255)));
         }
     }
 }
Ejemplo n.º 7
0
        protected override void Finish()
        {
            if (_timer != null)
            {
                _timer.Stop();
            }
            //just to make sure it ends at the right values for sure.
            double fine   = _end % 256;
            double coarse = _end / 256;

            DMXController.SetLevel(_setterName, _panFineChannel, Convert.ToInt32(Math.Floor((_level * fine) / 255)));
            DMXController.SetLevel(_setterName, _panCoarseChannel, Convert.ToInt32(Math.Floor((_level * coarse) / 255)));
            double tiltFine   = _tiltEnd % 256;
            double tiltCoarse = _tiltEnd / 256;

            DMXController.SetLevel(_setterName, _tiltFineChannel, Convert.ToInt32(Math.Floor((_level * tiltFine) / 255)));
            DMXController.SetLevel(_setterName, _tiltCoarseChannel, Convert.ToInt32(Math.Floor((_level * tiltCoarse) / 255)));
            if (_callback != null)
            {
                _callback();
            }
        }
Ejemplo n.º 8
0
 public void StopColorStrip()
 {
     DMXController.SetLevel("static", startChannel, 0);
 }
Ejemplo n.º 9
0
 /*
  * Generic level setter. Gets called from subclasses.
  * Appends "fix." to the beginning of the senderName for HTP purposes.
  */
 public void SetLevel(int intensity, int channel)
 {
     DMXController.SetLevel(("fix." + name), channel, intensity);
 }