Esempio n. 1
0
        private void EffectThread()
        {
            while (HaltVibThread == false)
            {
                for (int x = 0; x < SCPConstants.MAX_XINPUT_DEVICES; x++)
                {
                    FFBDevice srcDevice = devices[x];
                    if (srcDevice.DeviceActive == FFBDevice.DeviceState.Deactivated || DeactivateIfNeeded((uint)x + 1))
                    {
                        //Don't send VibCommands to from
                        //inactive devices
                        continue;
                    }

                    EffectReturnValue VibValues = new EffectReturnValue(0, 0);
                    if (!srcDevice.DevicePaused)
                    {
                        List<BaseEffectBlock> EffectsCopy = new List<BaseEffectBlock>();
                        lock (vibThreadSentry)
                        {
                            foreach (BaseEffectBlock eff in srcDevice.EffectBlocks.Values)
                            {
                                EffectsCopy.Add(eff);
                            }
                        }
                        //Appy Gain before or after summation?
                        foreach (BaseEffectBlock eff in EffectsCopy)
                        {
                            if (eff.isPaused)
                            {
                                continue;
                            }
                            VibValues += eff.Effect();
                        }
                    }

                    VibValues.MotorLeft = (VibValues.MotorLeft * srcDevice.DeviceGain);
                    VibValues.MotorRight = (VibValues.MotorRight * srcDevice.DeviceGain);
                    if (VibrationCommand != null)
                        VibrationCommand((uint)(x + 1), VibValues);
                }
                System.Threading.Thread.Sleep(5);
            }

            for (int x = 0; x < SCPConstants.MAX_XINPUT_DEVICES; x++)
            {
                DeactivateIfNeeded((uint)x + 1);
            }
        }
Esempio n. 2
0
 protected void Rumble(uint parDsID, EffectReturnValue e)
 {
     if (m_VibProxy != null)
     {
         Proxy.Rumble((DsPadId)(parDsID - 1), ScaleLargeMotor(e.MotorLeft), ScaleSmallMotor(e.MotorRight)); //large moter + small moter
         //Trace.WriteLine("Dev(" + parDsID + "), Vibration Left : " + ScaleLargeMotor(e.MotorLeft));
     }
 }
Esempio n. 3
0
 private void VibEventProxy(uint parvjid, EffectReturnValue e)
 {
     if (VibrationCommand == null)
         return;
     VibrationCommand(GetDSFromvj(parvjid), e);
 }