private void DetermineValue(int pValue, bool pFromForcage, ChangeOrigin pOrigin) { if (pFromForcage) { foreach (DmxValue value in mDmxValues) { if (pValue >= value.StartValue && pValue < value.EndValue) { for (int i = 0; i < value.AssociatedChannels.Count; i++) { value.AssociatedChannels[i].ForceValue(value.AssociatedValues[i], pOrigin); } break; } } } else { foreach (DmxValue value in mDmxValues) { if (pValue >= value.StartValue && pValue < value.EndValue) { for (int i = 0; i < value.AssociatedChannels.Count; i++) { value.AssociatedChannels[i].SetValue(value.AssociatedValues[i], pOrigin); } break; } } } }
private void CopyValue(int pValue, bool pFromForcage, ChangeOrigin pOrigin) { if (pFromForcage) { for (int i = 0; i < mCopyChannel.Count; i++) { if (mIsChannelInverted[i]) { ((Channel)(mCopyChannel[i])).ForceValue(255 - pValue, pOrigin); } else { ((Channel)(mCopyChannel[i])).ForceValue(pValue, pOrigin); } } } else { for (int i = 0; i < mCopyChannel.Count; i++) { if (mIsChannelInverted[i]) { ((Channel)(mCopyChannel[i])).SetValue(255 - pValue, pOrigin); } else { ((Channel)(mCopyChannel[i])).SetValue(pValue, pOrigin); } } } }
internal AutoChannel(Channel pChannel, ChangeOrigin pOrigin) { mProgressMode = false; mChannel = pChannel; mOrigin = pOrigin; mCurrentValue = mChannel.Value; mMaxRand = mMax - mMin; }
protected override void ChangeValue(int pValue, bool pFromForcage, ChangeOrigin pOrigin) { int ValueToSend = pValue; if (mPoursuit != null && mPoursuit.IsActive) { if (mFunction == ChannelFunction.Tilt) { ValueToSend = mPoursuit.SetTilt(pValue); } else { ValueToSend = mPoursuit.SetPan(pValue); } } mOutput.SetDmxValue(mAbsoluteNum, ValueToSend); }
/// <summary> /// force a value to the channel /// </summary> /// <param name="pValue">value ....</param> public void ForceValue(int pValue, ChangeOrigin pOrigin) { if (!mIsForced && OnForcedStateChanged != null) { this.mIsForced = true; OnForcedStateChanged(this, true); } //if the fixture is locked, only user is allowed to change value if (this.mLocked && pOrigin != ChangeOrigin.User) { return; } this.mIsForced = true; InternalChangeValue(pValue, true, pOrigin); }
protected override void ChangeValue(int pValue, bool pFromForcage, ChangeOrigin pOrigin) { ChangeOrigin newOrigin = pOrigin; if (pOrigin == ChangeOrigin.User || pOrigin == ChangeOrigin.Scene) { newOrigin = ChangeOrigin.Derivated; } switch (mVirtualType) { case VirtualChannelType.Copy: CopyValue(pValue, pFromForcage, newOrigin); return; case VirtualChannelType.ByValue: DetermineValue(pValue, pFromForcage, newOrigin); return; } }
private void InternalChangeValue(int pValue, bool pFromForcage, ChangeOrigin pOrigin) { //security check if (pValue < 0 || pValue >= 256) { throw new Exception("Value out of range"); } if (Framework.InvertChannelsInAutoMode) { if (pOrigin == ChangeOrigin.AutoMode || pOrigin == ChangeOrigin.Sound) { if (this.mInvertedInAutoMode) { pValue = mMaxInAutoMode + mMinInAutoMode - pValue; } } } if (this.IsInverted) { ChangeValue(255 - pValue, pFromForcage, pOrigin); } else { ChangeValue(pValue, pFromForcage, pOrigin); } if (this.OnValueChanged != null && pValue != mValue) { OnValueChanged(this, pValue); } mValue = pValue; }
/// <summary> /// set the value of the channel /// </summary> /// <param name="pValue">Value to set</param> public void SetValue(int pValue, ChangeOrigin pOrigin) { if (this.mIsForced) { return; } //if the fixture is locked, only user is allowed to change value if (this.mLocked && pOrigin != ChangeOrigin.User) { return; } //if the fixture is in scene mode, ignore xhange from beat detection or automatic mode if (this.mIsInSceneMode && (pOrigin == ChangeOrigin.AutoMode || pOrigin == ChangeOrigin.Sound)) { return; } InternalChangeValue(pValue, false, pOrigin); }
protected abstract void ChangeValue(int pValue, bool pFromForcage, ChangeOrigin pOrigin);