Skip to content

Commit

Permalink
Merge pull request #116 from frondeus/115-same-sound-plays-when-playe…
Browse files Browse the repository at this point in the history
…r-moves-from-one-ambient-sound-area-to-another-even-though-different-soundset-mood-is-configured

Migrate ambient sounds
  • Loading branch information
frondeus authored Jan 21, 2024
2 parents d783a20 + 05ee1ac commit 53bb67f
Show file tree
Hide file tree
Showing 18 changed files with 5,793 additions and 5,381 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ cypress.env.json
cypress/screenshots
cypress/videos
coverage
/.direnv
/.envrc
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch localhost",
"type": "firefox",
"request": "launch",
"reAttach": true,
"url": "https://localhost:9443/join",
"webRoot": "${workspaceFolder}"
}
]
}
12 changes: 12 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "dev",
"problemMatcher": ["$tsc"],
"label": "npm: dev",
"detail": "npx vite serve --https"
}
]
}
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
description = "GM Notes";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [];
pkgs = import nixpkgs {
inherit system overlays;
};
# During build time
nativeBuildInputs = with pkgs; [
];
# During runtime
buildInputs = with pkgs; [
nodejs
];
in
with pkgs;
{
devShells.default = mkShell {
inherit buildInputs nativeBuildInputs;
};
}
);
}
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const config: Config = {
statements: 75
}
},
moduleFileExtensions: ['js', 'ts', 'svelte'],
moduleFileExtensions: ['js', 'ts', 'svelte', 'node'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
testEnvironment: 'jsdom',
transform: {
Expand Down
4 changes: 4 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Object.defineProperty(global, 'foundry', {
}
});

import { TextEncoder, TextDecoder } from 'util';

Object.assign(global, { TextDecoder, TextEncoder });

function flattenObject(ob: any, _d: number = 0) {
var toReturn: any = {};
if (_d > 100) {
Expand Down
42 changes: 42 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"vite-tsconfig-paths": "^4.0.5"
},
"dependencies": {
"blakejs": "^1.2.1",
"lodash": "^4.17.21",
"papaparse": "^5.3.2",
"reflect-metadata": "^0.1.13",
Expand Down
8 changes: 6 additions & 2 deletions src/components/config/ambient-sound/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ describe('Ambient Sound Config', () => {
expect(darknessMax).toBeVisible();

const path = screen.queryByTestId('syrin-path');
expect(path).toHaveValue('syrinscape.wav');
expect(path).toHaveValue(
'syrinscape:e7a81fff2ffebce8f7ac69b842609f3fb92719ba15d7b1a63d6e5f69d26b3379f5a85b5e6221c1ab8ada2ad68fb9d037c2df44acae59cd2baec4c5f8cb4c2eb6.wav'
);
expect(path).not.toBeVisible();

const flagsType = screen.queryByTestId('syrin-flags-type');
Expand Down Expand Up @@ -169,7 +171,9 @@ describe('Ambient Sound Config', () => {
expect(darknessMax).toBeVisible();

const path = screen.queryByTestId('syrin-path');
expect(path).toHaveValue('syrinscape.wav');
expect(path).toHaveValue(
'syrinscape:f554770b5a49ed068cf0f9790ce33ae43909cb5dd04616ab49b3f500258f828a0700afc2b67e4d2c3daf42f93cabf936d50113e7e2a68a91e4c62eb6654f47c8.wav'
);
expect(path).not.toBeVisible();

const flagsType = screen.queryByTestId('syrin-flags-type');
Expand Down
6 changes: 5 additions & 1 deletion src/components/config/ambient-sound/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import Context from '@/services/context';
import type { SyrinAmbientSoundFlags } from '@/sounds/ambient-sound';
import type { Soundsets } from '@/models/store';
import { hashPath } from '@/utils';
// Context
const ctx = Context();
Expand All @@ -20,6 +21,9 @@
export let flags: SyrinAmbientSoundFlags;
export let create: boolean;
$: hashedPath = hashPath(flags.type, (flags as any)[flags.type]);
let soundsets = ctx.stores.soundsets;
let soundsetName: string = '...';
let ambientName: string = '...';
Expand Down Expand Up @@ -148,7 +152,7 @@
</p>
</div>
</div>
<input type="hidden" data-test="syrin-path" name="path" value="syrinscape.wav" />
<input type="hidden" data-test="syrin-path" name="path" value={hashedPath} />
<input
type="hidden"
data-test="syrin-flags-type"
Expand Down
8 changes: 6 additions & 2 deletions src/components/config/playlist-sound/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ describe('Playlist Sound Config', () => {
expect(name).toBeVisible();

const path = screen.queryByTestId('syrin-path');
expect(path).toHaveValue('syrinscape.wav');
expect(path).toHaveValue(
'syrinscape:e7a81fff2ffebce8f7ac69b842609f3fb92719ba15d7b1a63d6e5f69d26b3379f5a85b5e6221c1ab8ada2ad68fb9d037c2df44acae59cd2baec4c5f8cb4c2eb6.wav'
);
expect(path).not.toBeVisible();

const controlled = screen.queryByTestId('syrin-controlled');
Expand Down Expand Up @@ -93,7 +95,9 @@ describe('Playlist Sound Config', () => {
expect(name).toBeVisible();

const path = screen.queryByTestId('syrin-path');
expect(path).toHaveValue('syrinscape.wav');
expect(path).toHaveValue(
'syrinscape:f554770b5a49ed068cf0f9790ce33ae43909cb5dd04616ab49b3f500258f828a0700afc2b67e4d2c3daf42f93cabf936d50113e7e2a68a91e4c62eb6654f47c8.wav'
);
expect(path).not.toBeVisible();

const controlled = screen.queryByTestId('syrin-controlled');
Expand Down
4 changes: 3 additions & 1 deletion src/components/config/playlist-sound/index.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import Context from '@/services/context';
import type { Soundsets } from '@/models/store';
import { hashPath } from '@/utils';
// Context
const ctx = Context();
Expand All @@ -13,6 +14,7 @@
let moodName: string = '...';
let style = '';
let class_ = 'inner';
$: hashedPath = hashPath('mood', moodId);
const reactiveSoundsetName = async (moodId: number, soundsets: Soundsets) => {
const soundset = await ctx.stores.hydrateSoundsetInner(
Expand Down Expand Up @@ -65,7 +67,7 @@
</div>
</div>

<input type="hidden" data-test="syrin-path" name="path" value="syrinscape.wav" />
<input type="hidden" data-test="syrin-path" name="path" value={hashedPath} />

<div>
<div data-test="syrin-controlled">
Expand Down
Loading

0 comments on commit 53bb67f

Please sign in to comment.