@@ -36,13 +36,17 @@ public partial class MainWindow
3636 [ NotNull ]
3737 private readonly VibeGraphTab _graphTab ;
3838
39+ [ NotNull ]
40+ private readonly VibeConfigTab _vibeTab ;
41+
3942 private IpcServerChannel _xinputHookServer ;
4043 private string _channelName ;
4144 private List < ButtplugDeviceInfo > _devices = new List < ButtplugDeviceInfo > ( ) ;
4245 private Vibration _lastVibration = new Vibration ( ) ;
4346 private Vibration _lastSentVibration = new Vibration ( ) ;
4447 private Timer runTimer ;
4548 private Timer commandTimer ;
49+ private double _vibrationMultiplier = 1 ;
4650
4751 public MainWindow ( )
4852 {
@@ -70,6 +74,10 @@ public MainWindow()
7074 ButtplugTab . AddDevicePanel ( _bpServer ) ;
7175 ButtplugTab . SelectedDevicesChanged += OnSelectedDevicesChanged ;
7276
77+ _vibeTab = new VibeConfigTab ( ) ;
78+ _vibeTab . MultiplierChanged += MultiplierChanged ;
79+ ButtplugTab . SetOtherTab2 ( "Vibe Config" , _vibeTab ) ;
80+
7381 var config = new ButtplugConfig ( "Buttplug" ) ;
7482 ButtplugTab . GetAboutControl ( ) . CheckUpdate ( config , "buttplug-csharp" ) ;
7583
@@ -82,6 +90,11 @@ public MainWindow()
8290 ServicePointManager . SecurityProtocol = SecurityProtocolType . Tls | SecurityProtocolType . Ssl3 | SecurityProtocolType . Tls12 ;
8391 }
8492
93+ private void MultiplierChanged ( object sender , double vibeMultiplier )
94+ {
95+ _vibrationMultiplier = vibeMultiplier ;
96+ }
97+
8598 public void AddPoint ( object o , ElapsedEventArgs e )
8699 {
87100 _graphTab . AddVibrationValue ( _lastVibration . LeftMotorSpeed , _lastVibration . RightMotorSpeed ) ;
@@ -142,14 +155,17 @@ await Dispatcher.Invoke(async () =>
142155 {
143156 continue ;
144157 }
158+ double vibeSpeed = ( _lastVibration . LeftMotorSpeed + _lastVibration . RightMotorSpeed ) / ( 2.0 * 65535.0 ) ;
145159 await _bpServer . SendMessage ( new SingleMotorVibrateCmd ( device . Index ,
146- ( _lastVibration . LeftMotorSpeed + _lastVibration . RightMotorSpeed ) / ( 2.0 * 65535 .0) ) ) ;
160+ Math . Min ( vibeSpeed * _vibrationMultiplier , 1 .0) ) ) ;
147161 }
148162 } ) ;
149163 }
150164
151165 private void OnVibrationCommand ( object aObj , Vibration aVibration )
152166 {
167+ aVibration . LeftMotorSpeed = Convert . ToUInt16 ( aVibration . LeftMotorSpeed * _vibrationMultiplier > 65535 ? 65535 : aVibration . LeftMotorSpeed * _vibrationMultiplier ) ;
168+ aVibration . RightMotorSpeed = Convert . ToUInt16 ( aVibration . RightMotorSpeed * _vibrationMultiplier > 65535 ? 65535 : aVibration . RightMotorSpeed * _vibrationMultiplier ) ;
153169 _lastVibration = aVibration ;
154170 }
155171
0 commit comments