Stabilize emit speed vs tempo interaction
This commit is contained in:
@@ -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 R132";
|
window.CHGRID_WEB_VERSION = "2026.02.22 R133";
|
||||||
// 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";
|
||||||
|
|||||||
@@ -49,9 +49,17 @@ 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 playbackRate = Math.max(0.25, Math.min(4, speed * tempo));
|
const speedOffset = Math.abs(speed - 1);
|
||||||
const preservePitch = Math.abs(speed - 1) < 0.001;
|
if (speedOffset > 0.001) {
|
||||||
return { playbackRate, preservePitch };
|
return {
|
||||||
|
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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user