Skip to content

Commit 108104f

Browse files
authored
Merge pull request #20 from mordachai/soundfx
new audio config and bug fixes
2 parents 554ee01 + d55252d commit 108104f

4 files changed

Lines changed: 30 additions & 16 deletions

File tree

module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "investigation-board",
33
"title": "Investigation Board",
44
"description": "<p>A Foundry VTT module that lets everyone create, edit, and move sticky and photo notes on the scene as collaborative investigation tools.</p>",
5-
"version": "4.1.1",
5+
"version": "4.2.0",
66
"socket": true,
77
"authors": [
88
{

scripts/canvas/connection-manager.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -628,27 +628,41 @@ export function onPinClick(event, drawing) {
628628
export function resetPinConnectionState() {
629629
pinConnectionFirstNote = null;
630630
if (pinConnectionHighlight) {
631-
canvas.controls.removeChild(pinConnectionHighlight);
632-
pinConnectionHighlight.destroy();
631+
try {
632+
if (!pinConnectionHighlight.destroyed) {
633+
if (pinConnectionHighlight.parent) pinConnectionHighlight.parent.removeChild(pinConnectionHighlight);
634+
pinConnectionHighlight.destroy();
635+
}
636+
} catch (err) {
637+
console.warn("Investigation Board: Error destroying pin highlight", err);
638+
}
633639
pinConnectionHighlight = null;
634640
}
635641
clearConnectionPreview();
636642
}
637643

638644
export function cleanupConnectionLines() {
639645
if (connectionLinesContainer) {
640-
if (connectionLinesContainer.parent) {
641-
connectionLinesContainer.parent.removeChild(connectionLinesContainer);
646+
try {
647+
if (!connectionLinesContainer.destroyed) {
648+
if (connectionLinesContainer.parent) connectionLinesContainer.parent.removeChild(connectionLinesContainer);
649+
connectionLinesContainer.destroy({children: true, texture: false, baseTexture: false});
650+
}
651+
} catch (err) {
652+
console.warn("Investigation Board: Error destroying lines container", err);
642653
}
643-
connectionLinesContainer.destroy();
644654
connectionLinesContainer = null;
645655
}
646656

647657
if (pinsContainer) {
648-
if (pinsContainer.parent) {
649-
pinsContainer.parent.removeChild(pinsContainer);
658+
try {
659+
if (!pinsContainer.destroyed) {
660+
if (pinsContainer.parent) pinsContainer.parent.removeChild(pinsContainer);
661+
pinsContainer.destroy({children: true});
662+
}
663+
} catch (err) {
664+
console.warn("Investigation Board: Error destroying pins container", err);
650665
}
651-
pinsContainer.destroy();
652666
pinsContainer = null;
653667
}
654668
}

scripts/utils/audio-utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export function applyTapeEffect(context, inputNode, outputNode) {
1414
// Create High-pass filter (removes bass/lows for that tinny sound)
1515
const hpFilter = context.createBiquadFilter();
1616
hpFilter.type = "highpass";
17-
hpFilter.frequency.value = 400; // Cut everything below 400Hz
17+
hpFilter.frequency.value = 600; // Cut everything below 500Hz
1818
hpFilter.Q.value = 1;
1919

2020
// Create Low-pass filter (removes very high frequencies to simulate tape degradation)
2121
const lpFilter = context.createBiquadFilter();
2222
lpFilter.type = "lowpass";
23-
lpFilter.frequency.value = 4000; // Cut everything above 4000Hz
23+
lpFilter.frequency.value = 2500; // Cut everything above 3000Hz
2424
lpFilter.Q.value = 1;
2525

2626
// Create a Gain node to boost the signal slightly if it feels too quiet after filtering

scripts/utils/creation-utils.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export async function createPhotoNoteFromActor(actor, isUnknown = false) {
161161
const height = Math.round(photoW / (225 / 290));
162162

163163
const viewCenter = canvas.stage.pivot;
164-
const x = viewCenter.x - width / 2;
164+
const x = viewCenter.x - photoW / 2;
165165
const y = viewCenter.y - height / 2;
166166

167167
const created = await collaborativeCreate({
@@ -214,7 +214,7 @@ export async function createPhotoNoteFromScene(targetScene) {
214214
const height = Math.round(photoW / (225 / 290));
215215

216216
const viewCenter = canvas.stage.pivot;
217-
const x = viewCenter.x - width / 2;
217+
const x = viewCenter.x - photoW / 2;
218218
const y = viewCenter.y - height / 2;
219219

220220
const displayName = targetScene.navName || targetScene.name || "Unknown Location";
@@ -276,8 +276,8 @@ export async function createHandoutNoteFromPage(page) {
276276
const handoutH = game.settings.get(MODULE_ID, "handoutNoteHeight") || 400;
277277

278278
const viewCenter = canvas.stage.pivot;
279-
const x = viewCenter.x - width / 2;
280-
const y = viewCenter.y - height / 2;
279+
const x = viewCenter.x - handoutW / 2;
280+
const y = viewCenter.y - handoutH / 2;
281281

282282
const imagePath = page.src || "modules/investigation-board/assets/newhandout.webp";
283283

@@ -355,7 +355,7 @@ export async function createMediaNoteFromSound(sound) {
355355
const height = Math.round(mediaW * 0.74);
356356

357357
const viewCenter = canvas.stage.pivot;
358-
const x = viewCenter.x - width / 2;
358+
const x = viewCenter.x - mediaW / 2;
359359
const y = viewCenter.y - height / 2;
360360

361361
const imagePath = await _getRandomCassetteImage();

0 commit comments

Comments
 (0)