How to use the buttplug.FleshlightLaunchFW12Cmd function in buttplug

To help you get started, we’ve selected a few buttplug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github metafetish / syncydink / tests / haptics-tests.ts View on Github external
it("Should zip multiple command arrays correctly", async () => {
    const fleshlightMap = new Map();
    const fleshlightCommands = [new FleshlightLaunchFW12Cmd(10, 20),
                                new FleshlightLaunchFW12Cmd(20, 30),
                                new FleshlightLaunchFW12Cmd(30, 40)];
    fleshlightMap.set(1, [fleshlightCommands[0]]);
    fleshlightMap.set(3, [fleshlightCommands[1]]);
    fleshlightMap.set(5, [fleshlightCommands[2]]);
    fleshlightMap.set(10, [fleshlightCommands[0]]);
    const vibrateMap = new Map();
    const vibrateCommands = [new SingleMotorVibrateCmd(10),
                             new SingleMotorVibrateCmd(20),
                             new SingleMotorVibrateCmd(30)];
    vibrateMap.set(1, [vibrateCommands[0]]);
    vibrateMap.set(2, [vibrateCommands[1]]);
    vibrateMap.set(4, [vibrateCommands[2]]);
    // Map with no messages
    const emptyMap = new Map();
    const commandArray = HapticCommandToButtplugMessage.ZipCommandMaps([fleshlightMap, vibrateMap, emptyMap]);
    const expectedCommandArray = new Map();
github metafetish / syncydink / tests / haptics-tests.ts View on Github external
it("Should zip multiple command arrays correctly", async () => {
    const fleshlightMap = new Map();
    const fleshlightCommands = [new FleshlightLaunchFW12Cmd(10, 20),
                                new FleshlightLaunchFW12Cmd(20, 30),
                                new FleshlightLaunchFW12Cmd(30, 40)];
    fleshlightMap.set(1, [fleshlightCommands[0]]);
    fleshlightMap.set(3, [fleshlightCommands[1]]);
    fleshlightMap.set(5, [fleshlightCommands[2]]);
    fleshlightMap.set(10, [fleshlightCommands[0]]);
    const vibrateMap = new Map();
    const vibrateCommands = [new SingleMotorVibrateCmd(10),
                             new SingleMotorVibrateCmd(20),
                             new SingleMotorVibrateCmd(30)];
    vibrateMap.set(1, [vibrateCommands[0]]);
    vibrateMap.set(2, [vibrateCommands[1]]);
    vibrateMap.set(4, [vibrateCommands[2]]);
    // Map with no messages
    const emptyMap = new Map();
    const commandArray = HapticCommandToButtplugMessage.ZipCommandMaps([fleshlightMap, vibrateMap, emptyMap]);
    const expectedCommandArray = new Map();
    expectedCommandArray.set(1, [fleshlightCommands[0], vibrateCommands[0]]);
github metafetish / syncydink / tests / haptics-tests.ts View on Github external
it("Should zip multiple command arrays correctly", async () => {
    const fleshlightMap = new Map();
    const fleshlightCommands = [new FleshlightLaunchFW12Cmd(10, 20),
                                new FleshlightLaunchFW12Cmd(20, 30),
                                new FleshlightLaunchFW12Cmd(30, 40)];
    fleshlightMap.set(1, [fleshlightCommands[0]]);
    fleshlightMap.set(3, [fleshlightCommands[1]]);
    fleshlightMap.set(5, [fleshlightCommands[2]]);
    fleshlightMap.set(10, [fleshlightCommands[0]]);
    const vibrateMap = new Map();
    const vibrateCommands = [new SingleMotorVibrateCmd(10),
                             new SingleMotorVibrateCmd(20),
                             new SingleMotorVibrateCmd(30)];
    vibrateMap.set(1, [vibrateCommands[0]]);
    vibrateMap.set(2, [vibrateCommands[1]]);
    vibrateMap.set(4, [vibrateCommands[2]]);
    // Map with no messages
    const emptyMap = new Map();
    const commandArray = HapticCommandToButtplugMessage.ZipCommandMaps([fleshlightMap, vibrateMap, emptyMap]);
github metafetish / syncydink / src / utils / HapticsToButtplug.ts View on Github external
currentTime = aCommand.Time;
      currentPosition = aCommand.Position;

      timeDelta = currentTime - lastTime;

      positionDelta = Math.abs(currentPosition - lastPosition);
      speed = Math.floor(25000 * Math.pow(((timeDelta * 90) / positionDelta), -1.05));

      // Clamp speed on 20 <= x <= 80 so we don't crash or break the launch.
      speed = Math.min(Math.max(speed, 5), 90);

      positionGoal = Math.floor(((currentPosition / 99) * range) + ((99 - range) / 2));
      // Set movement to happen at the PREVIOUS time, since we're moving toward
      // the goal position with this command, and want to arrive there by the
      // current time.
      commands.set(lastTime, [new FleshlightLaunchFW12Cmd(speed, positionGoal)]);
      lastTime = aCommand.Time;
      lastPosition = aCommand.Position;
    }
    return commands;
  }
github metafetish / syncydink / src / utils / HapticsToButtplug.ts View on Github external
currentSpeed = 20;
      }

      lastTime = aCommand.Time;
      lastPosition = aCommand.Position;
      lastSpeed = currentSpeed;

      if (timeDelta <= 150) {
        if (limitedSpeed === 0) {
          limitedSpeed = currentSpeed;
        }
        commands.set(currentTime, [new FleshlightLaunchFW12Cmd(limitedSpeed, currentPosition > 2 ? 5 : 95)]);
        continue;
      }
      limitedSpeed = 0;
      commands.set(currentTime, [new FleshlightLaunchFW12Cmd(currentSpeed, currentPosition > 2 ? 5 : 95)]);
      continue;

    }
    return commands;
  }
github metafetish / syncydink / src / utils / HapticsToButtplug.ts View on Github external
}
      }
      currentSpeed = Math.floor(currentSpeed);
      if (currentSpeed < 20) {
        currentSpeed = 20;
      }

      lastTime = aCommand.Time;
      lastPosition = aCommand.Position;
      lastSpeed = currentSpeed;

      if (timeDelta <= 150) {
        if (limitedSpeed === 0) {
          limitedSpeed = currentSpeed;
        }
        commands.set(currentTime, [new FleshlightLaunchFW12Cmd(limitedSpeed, currentPosition > 2 ? 5 : 95)]);
        continue;
      }
      limitedSpeed = 0;
      commands.set(currentTime, [new FleshlightLaunchFW12Cmd(currentSpeed, currentPosition > 2 ? 5 : 95)]);
      continue;

    }
    return commands;
  }