| 615 | } |
| 616 | |
| 617 | void FeedbackXBOBT::SetForce(LONG LeftLevel, LONG RightLevel, LONG ltLevel, LONG rtLevel) |
| 618 | { |
| 619 | //fprintf(stderr, "LS: %d; RS: %d\n", (unsigned char)MIN( 255, LeftLevel * Gain / 10000 ), (unsigned char)MIN( 255, RightLevel * Gain / 10000 )); |
| 620 | XboxOneBluetoothReport_t report = {0}; |
| 621 | report.reportID = 0x03; |
| 622 | report.activationMask = 0x0f; |
| 623 | report.ltMagnitude = (unsigned char)min(SCALE_MAX, ltLevel * (LONG)Gain / 10000 ); |
| 624 | report.rtMagnitude = (unsigned char)min(SCALE_MAX, rtLevel * (LONG)Gain / 10000 ); |
| 625 | report.leftMagnitude = (unsigned char)min(SCALE_MAX, LeftLevel * (LONG)Gain / 10000 ); |
| 626 | report.rightMagnitude = (unsigned char)min(SCALE_MAX, RightLevel * (LONG)Gain / 10000 ); |
| 627 | report.duration = 0x7f; |
| 628 | report.loopCount = 10; |
| 629 | |
| 630 | if (!Manual) { |
| 631 | IOReturn retVal = IOHIDDeviceSetReport(device, kIOHIDReportTypeOutput, report.reportID, (const uint8_t*)&report, sizeof(XboxOneBluetoothReport_t)); |
| 632 | if (retVal != 0) { |
| 633 | printf("IOHIDDeviceSetReport returned %d (system %d, subsystem %d, code %d)\n", retVal, err_get_system(retVal), err_get_sub(retVal), err_get_code(retVal)); |
| 634 | } |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | void FeedbackXBOBT::EffectProc( void *params ) |
| 639 | { |