Skip to content

Commit d486a32

Browse files
Increase headphone latency adjustment to 45ms
Updated the latency compensation for headphone detection from 32ms to 45ms in both ma_thing.cpp and ma_thing_hl.cpp to better reflect actual latency conditions.
1 parent 07d1f6b commit d486a32

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

hdlls/windows/ma_thing.hdll

0 Bytes
Binary file not shown.

src/miniaudio/ma_thing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ class AudioSystem {
554554
// Latency detection
555555
ma_uint64 detectedLatency = 0; // System-wide latency in frames (max across all decoders)
556556
bool latenciesDetected = false;
557-
static constexpr float SILENCE_THRESHOLD = 0.2f;
557+
static constexpr float SILENCE_THRESHOLD = 0.1f; // This was 20% but I realized it was too much and it would output more delay than expected so I'd say I leave it at 10%.
558558

559559
AudioSystem() = default;
560560

@@ -2012,7 +2012,7 @@ int detectLatency() {
20122012
#endif
20132013
if (g_audioSystem.exists) {
20142014
if(!wearingPlugNPlay()) osMs += 50;
2015-
if(wearingHeadphones()) osMs += 32;
2015+
if(wearingHeadphones()) osMs += 60;
20162016
osMs -= g_audioSystem.getLatencyMs();
20172017
}
20182018
return osMs;

src/miniaudio/ma_thing_hl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ class AudioSystem {
558558
// Latency detection
559559
ma_uint64 detectedLatency = 0; // System-wide latency in frames (max across all decoders)
560560
bool latenciesDetected = false;
561-
static constexpr float SILENCE_THRESHOLD = 0.2f;
561+
static constexpr float SILENCE_THRESHOLD = 0.1f;
562562

563563
AudioSystem() = default;
564564

@@ -2023,7 +2023,7 @@ HL_PRIM int HL_NAME(detectLatency)(_NO_ARG) {
20232023
#endif
20242024
if (g_audioSystem.exists) {
20252025
if(!HL_NAME(wearingPlugNPlay)()) osMs += 50;
2026-
if(HL_NAME(wearingHeadphones)()) osMs += 32;
2026+
if(HL_NAME(wearingHeadphones)()) osMs += 60;
20272027
osMs -= g_audioSystem.getLatencyMs();
20282028
}
20292029
return osMs;

src/structures/gameplay/Strumline.hx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ class Strumline {
166166
var timing = (_timing / parent._cachedHitbox) * 1.05;
167167
// this trace was there because I was constantly testing the new latency compensation system
168168
// specifically implemented inside the note system as I've had to even make an `onBeatHitUnoffsetted` event
169-
// just to
169+
// just to make it so that countdown doesn't get affected by the conductor offset in the first place
170+
// yk yk
170171
//Sys.println('${noteToHit.index},$_timing');
171172

172173
if (@:privateAccess pf.onNoteHit.__listeners.length != 0)

0 commit comments

Comments
 (0)