Restore combined emit speed and tempo behavior

This commit is contained in:
Jage9
2026-02-21 23:26:28 -05:00
parent b4f2be55d4
commit c162e6dc3c
2 changed files with 4 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
// Maintainer-controlled web client version. // Maintainer-controlled web client version.
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
window.CHGRID_WEB_VERSION = "2026.02.22 R134"; window.CHGRID_WEB_VERSION = "2026.02.22 R135";
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
window.CHGRID_TIME_ZONE = "America/Detroit"; window.CHGRID_TIME_ZONE = "America/Detroit";

View File

@@ -49,17 +49,9 @@ function resolveEmitRates(item: WorldItem): { playbackRate: number; preservePitc
const globals = getItemTypeGlobalProperties(item.type); const globals = getItemTypeGlobalProperties(item.type);
const speed = resolveEmitPlaybackRate(item.params.emitSoundSpeed ?? globals.emitSoundSpeed ?? 50); const speed = resolveEmitPlaybackRate(item.params.emitSoundSpeed ?? globals.emitSoundSpeed ?? 50);
const tempo = resolveEmitPlaybackRate(item.params.emitSoundTempo ?? globals.emitSoundTempo ?? 50); const tempo = resolveEmitPlaybackRate(item.params.emitSoundTempo ?? globals.emitSoundTempo ?? 50);
const speedOffset = Math.abs(speed - 1); const playbackRate = Math.max(0.25, Math.min(4, speed * tempo));
if (speedOffset > 0.001) { const preservePitch = Math.abs(speed - 1) < 0.001;
return { return { playbackRate, preservePitch };
playbackRate: Math.max(0.25, Math.min(4, speed)),
preservePitch: false,
};
}
return {
playbackRate: Math.max(0.25, Math.min(4, tempo)),
preservePitch: true,
};
} }
export class ItemEmitRuntime { export class ItemEmitRuntime {