removed unused processesseessess

This commit is contained in:
33333-33333 2026-06-29 16:21:58 +09:00
commit 4fdc567e08
158 changed files with 1317 additions and 3351 deletions

View file

@ -10,12 +10,8 @@ const audio = {
sampleLast: {},
activeVoices: 0,
maxConcurrent: 96,
failedSamples: {},
lastPlayedId: "",
lastPlayedAt: 0,
soundPackVersion: "inline",
masterGainNode: null,
compressorNode: null,
_synthIdGain: 1,
idGain: {},
idMinGap: {},
@ -26,7 +22,6 @@ const audio = {
soundMap: {},
applySoundPack(pack = window.TARINAI_SOUND_PACK) {
if (!pack || typeof pack !== "object") return false;
this.soundPackVersion = String(pack.version || "custom");
if (pack.categoryGain && typeof pack.categoryGain === "object") this.categoryGain = { ...this.categoryGain, ...pack.categoryGain };
if (pack.idGain && typeof pack.idGain === "object") this.idGain = { ...this.idGain, ...pack.idGain };
if (pack.idMinGap && typeof pack.idMinGap === "object") this.idMinGap = { ...this.idMinGap, ...pack.idMinGap };
@ -46,13 +41,13 @@ const audio = {
this.masterGainNode = ctx.createGain();
this.masterGainNode.gain.setValueAtTime(1.85, ctx.currentTime);
if (typeof ctx.createDynamicsCompressor === "function") {
this.compressorNode = ctx.createDynamicsCompressor();
this.compressorNode.threshold.value = -18;
this.compressorNode.knee.value = 24;
this.compressorNode.ratio.value = 8;
this.compressorNode.attack.value = 0.002;
this.compressorNode.release.value = 0.18;
this.masterGainNode.connect(this.compressorNode).connect(ctx.destination);
const compressor = ctx.createDynamicsCompressor();
compressor.threshold.value = -18;
compressor.knee.value = 24;
compressor.ratio.value = 8;
compressor.attack.value = 0.002;
compressor.release.value = 0.18;
this.masterGainNode.connect(compressor).connect(ctx.destination);
} else {
this.masterGainNode.connect(ctx.destination);
}
@ -95,8 +90,7 @@ const audio = {
a.preload = "auto";
a.volume = this.sampleVolumeFor(key);
a.addEventListener("error", () => {
this.failedSamples[key] = path;
window.TarinaiEvents?.emit("audio:sample-error", { id: key, path });
window.TarinaiEvents.emit("audio:sample-error", { id: key, path });
}, { once: true });
this.samples[key] = a;
}
@ -147,8 +141,7 @@ const audio = {
const cat = category || this.categoryFor(key, key.startsWith("voice") ? "voice" : "ops");
if (!this.canPlay(key, cat, minGap)) return false;
this.lastPlayedId = key;
this.lastPlayedAt = performance.now() / 1000;
window.TarinaiEvents?.emit("audio:play", { id: key, category: cat, synthetic: false });
window.TarinaiEvents.emit("audio:play", { id: key, category: cat, synthetic: false });
this.ensure();
const node = base.cloneNode(true);
node.volume = Math.min(1, base.volume * (this.categoryGain?.[cat] ?? 1) * (this.idGain?.[key] ?? 1));
@ -203,8 +196,7 @@ const audio = {
const minGap = opts.minGap ?? 0.10;
if (!this.canPlay(id, category, minGap)) return false;
this.lastPlayedId = id;
this.lastPlayedAt = performance.now() / 1000;
window.TarinaiEvents?.emit("audio:play", { id, category, synthetic: !this.samples[id] });
window.TarinaiEvents.emit("audio:play", { id, category, synthetic: !this.samples[id] });
if (this.samples[id]) {
const base = this.samples[id];
this.ensure();
@ -227,7 +219,7 @@ const audio = {
}, ms);
try {
switch (id) {
case "sfx_notify": case "sfx_log_push":
case "sfx_notify":
this.tone(880, 0.055, "sine", 0.022, 80, category); t(62, () => this.tone(1180, 0.075, "triangle", 0.020, -40, category)); break;
case "sfx_ui_click": this.tone(520, 0.035, "square", 0.010, 80, category); break;
case "sfx_ui_fold": this.tone(420, 0.045, "triangle", 0.012, -130, category); break;
@ -237,7 +229,6 @@ const audio = {
case "sfx_grab": this.tone(300, 0.050, "triangle", 0.018, 90, category); break;
case "sfx_drop": this.tone(220, 0.060, "triangle", 0.018, -80, category); break;
case "sfx_water_hose": this.noise(0.13, 0.018, category, 2400); break;
case "sfx_water_clean": this.noise(0.08, 0.014, category, 3200); this.tone(1120, 0.040, "sine", 0.009, 180, category); break;
case "sfx_drink": this.tone(720, 0.045, "sine", 0.012, -120, category); t(42, () => this.tone(620, 0.040, "sine", 0.010, -80, category)); break;
case "sfx_ball_hit": this.tone(260, 0.065, "triangle", 0.020, 120, category); break;
case "sfx_stone_impact": this.tone(110, 0.080, "sawtooth", 0.032, -50, category); this.noise(0.05, 0.018, category, 600); break;
@ -319,5 +310,4 @@ const audio = {
audio.applySoundPack?.(window.TARINAI_SOUND_PACK);
audio.loadSettings();
window.TarinaiEvents?.on?.("audio:test", ev => audio.play(ev.detail?.id || "sfx_notify", ev.detail || {}));
window.TarinaiAudio = audio;