mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
iidx: delay logic for iidx tt (#669)
## Link to GitHub Issue or related Pull Request, if one exists Re-implements fix for #181 as it was removed by #668 ## Description of change Add two options to add artificial delay to turntable input. These operate directly on the input logic (`get_tt`) which is called by I/O emulation code. Functionally, it's **identical** to the `Delay (experimental)` option we had in the analog tab, just moved to Options tab. ## Testing 64 bit tdj: ok 64 bit ldj bi2a: ok 32 bit ldj ezusb: ok Worth noting that TDJ bi2x_hook polls at 120Hz, bi2a at ~500Hz, and ezusb at ~170Hz
This commit is contained in:
@@ -67,6 +67,8 @@ namespace games::iidx {
|
||||
std::optional<std::string> SOUND_OUTPUT_DEVICE = std::nullopt;
|
||||
std::optional<std::string> SOUND_OUTPUT_DEVICE_IN_EFFECT = std::nullopt;
|
||||
std::optional<std::string> ASIO_DRIVER = std::nullopt;
|
||||
uint32_t TT_DELAY_P1 = 0;
|
||||
uint32_t TT_DELAY_P2 = 0;
|
||||
uint8_t DIGITAL_TT_SENS = 4;
|
||||
std::optional<std::string> SUBSCREEN_OVERLAY_SIZE = std::nullopt;
|
||||
std::optional<std::string> SCREEN_MODE = std::nullopt;
|
||||
@@ -781,7 +783,26 @@ namespace games::iidx {
|
||||
}
|
||||
|
||||
// return higher 8 bit
|
||||
return (uint8_t) (ret_value >> 2);
|
||||
uint8_t result = (uint8_t) (ret_value >> 2);
|
||||
|
||||
// delay
|
||||
if ((player == 0 && TT_DELAY_P1 > 0) ||
|
||||
(player == 1 && TT_DELAY_P2 > 0)) {
|
||||
|
||||
static std::queue<uint8_t> delay_queue[2];
|
||||
auto &queue = delay_queue[player];
|
||||
|
||||
const auto max_size =
|
||||
static_cast<size_t>((player == 0) ? TT_DELAY_P1 : TT_DELAY_P2) + 1;
|
||||
|
||||
queue.push(result);
|
||||
while (queue.size() > max_size) {
|
||||
queue.pop();
|
||||
}
|
||||
result = queue.front();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned char get_slider(uint8_t slider) {
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace games::iidx {
|
||||
extern bool NATIVE_TOUCH;
|
||||
extern std::optional<std::string> SOUND_OUTPUT_DEVICE;
|
||||
extern std::optional<std::string> ASIO_DRIVER;
|
||||
extern uint32_t TT_DELAY_P1;
|
||||
extern uint32_t TT_DELAY_P2;
|
||||
extern uint8_t DIGITAL_TT_SENS;
|
||||
extern std::optional<std::string> SUBSCREEN_OVERLAY_SIZE;
|
||||
extern std::optional<std::string> SCREEN_MODE;
|
||||
|
||||
Reference in New Issue
Block a user