diff --git a/overlays/misc/wine-lowlatency.patch b/overlays/misc/wine-lowlatency.patch new file mode 100644 index 0000000..dfe464f --- /dev/null +++ b/overlays/misc/wine-lowlatency.patch @@ -0,0 +1,46 @@ +diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c +index 55579ecda80..6f7ff732135 100644 +--- a/dlls/winepulse.drv/pulse.c ++++ b/dlls/winepulse.drv/pulse.c +@@ -93,9 +93,6 @@ static REFERENCE_TIME pulse_min_period[2], pulse_def_period[2]; + + static UINT g_phys_speakers_mask = 0; + +-static const REFERENCE_TIME MinimumPeriod = 30000; +-static const REFERENCE_TIME DefaultPeriod = 100000; +- + static pthread_mutex_t pulse_mutex; + static pthread_cond_t pulse_cond = PTHREAD_COND_INITIALIZER; + +@@ -481,11 +478,12 @@ static void pulse_probe_settings(int render, WAVEFORMATEXTENSIBLE *fmt) { + if (length) + pulse_def_period[!render] = pulse_min_period[!render] = pa_bytes_to_usec(10 * length, &ss); + +- if (pulse_min_period[!render] < MinimumPeriod) +- pulse_min_period[!render] = MinimumPeriod; +- +- if (pulse_def_period[!render] < DefaultPeriod) +- pulse_def_period[!render] = DefaultPeriod; ++ const char* penv = getenv("STAGING_AUDIO_PERIOD"); ++ if (penv) { ++ int val = atoi(penv); ++ pulse_def_period[!render] = pulse_min_period[!render] = val; ++ printf("Staging audio period set to %d.\n", val); ++ } + + wfx->wFormatTag = WAVE_FORMAT_EXTENSIBLE; + wfx->cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); +@@ -836,6 +834,13 @@ static NTSTATUS pulse_create_stream(void *args) + if (duration < 3 * period) + duration = 3 * period; + ++ const char* denv = getenv("STAGING_AUDIO_DURATION"); ++ if (denv) { ++ int val = atoi(denv); ++ duration = val; ++ printf("Staging audio duration set to %d.\n", val); ++ } ++ + stream->period_bytes = pa_frame_size(&stream->ss) * muldiv(period, stream->ss.rate, 10000000); + + stream->bufsize_frames = ceil((duration / 10000000.) * params->fmt->nSamplesPerSec); diff --git a/overlays/wine-osu.nix b/overlays/wine-osu.nix index 5b4fac5..ce0f2fb 100644 --- a/overlays/wine-osu.nix +++ b/overlays/wine-osu.nix @@ -1,15 +1,6 @@ self: super: { wine-osu = (super.wineStaging.overrideDerivation(o: { - patches = (o.patches or []) ++ [ - #(builtins.fetchurl { - # url = "https://gist.githubusercontent.com/LavaDesu/01c0f3144526da6aed4b2deb1d10cc99/raw/304d2def1b37f1319e27428f049f22c74eea882b/winepulse-v6.5-revert-wasapifriendy.patch"; - # sha256 = "1wjjwf1jfwafk1kdq0iw0r3hvi1h0i7ni276pv263rkkv418i8bq"; - #}) - (builtins.fetchurl { - url = "https://gist.githubusercontent.com/LavaDesu/01c0f3144526da6aed4b2deb1d10cc99/raw/304d2def1b37f1319e27428f049f22c74eea882b/winepulse-v6.5-wasapifriendy.patch"; - sha256 = "12fhnbyl6kw284z3d6685xhcx21jmwhvibphx669qqbxj9bfk4hi"; - }) - ]; + patches = (o.patches or []) ++ [ ./misc/wine-lowlatency.patch ]; })).override { wineRelease = "staging"; wineBuild = "wineWow";