Restore ability to play sound with custom volume

This was missing from the revert in 8b0f5054dd.
This commit is contained in:
Robin
2026-06-18 11:35:46 +02:00
parent 05797097c6
commit 3a598ffe43
2 changed files with 4 additions and 4 deletions

View File

@@ -114,7 +114,7 @@ interface Props<S extends string> {
}
interface UseAudioContext<S extends string> {
playSound(soundName: S): Promise<void>;
playSound(soundName: S, volumeOverwrite?: number): Promise<void>;
playSoundLooping(soundName: S, delayS?: number): () => Promise<void>;
/**
* Map of sound name to duration in seconds.
@@ -195,7 +195,7 @@ export function useAudioContext<S extends string>(
}
return {
playSound: async (name): Promise<void> => {
playSound: async (name, volumeOverwrite?: number): Promise<void> => {
if (!audioBuffers[name]) {
logger.debug(`Tried to play a sound that wasn't buffered (${name})`);
return;
@@ -203,7 +203,7 @@ export function useAudioContext<S extends string>(
return playSound(
audioContext,
audioBuffers[name],
soundEffectVolume * earpieceVolume,
volumeOverwrite ?? soundEffectVolume * earpieceVolume,
earpiecePan,
);
},