Skip to content

Commit 42fb034

Browse files
committed
feat: add a mechanical sound theme
1 parent e4f8db8 commit 42fb034

12 files changed

+32
-1
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/keybr-textinput-sounds/lib/player.ts

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useMemo } from "react";
44
import { PlaySounds, soundProps, SoundTheme } from "./settings.ts";
55
import { Theme } from "./sound.ts";
66
import { defaultTheme } from "./themes/default.ts";
7+
import { mechanical1 } from "./themes/mechanical1.ts";
78
import { mechanical2 } from "./themes/mechanical2.ts";
89
import { typewriter1 } from "./themes/typewriter1.ts";
910
import { typewriter2 } from "./themes/typewriter2.ts";
@@ -52,6 +53,8 @@ function loadTheme(id: SoundTheme) {
5253

5354
function loadTheme0(id: SoundTheme) {
5455
switch (id) {
56+
case SoundTheme.MECHANICAL1:
57+
return new Theme(mechanical1);
5558
case SoundTheme.MECHANICAL2:
5659
return new Theme(mechanical2);
5760
case SoundTheme.TYPEWRITER1:

packages/keybr-textinput-sounds/lib/settings.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ export enum PlaySounds {
99

1010
export class SoundTheme implements EnumItem {
1111
static readonly DEFAULT = new SoundTheme("default", "Default");
12-
static readonly MECHANICAL2 = new SoundTheme("mechanical2", "Mechanical");
12+
static readonly MECHANICAL1 = new SoundTheme("mechanical1", "Mechanical 1");
13+
static readonly MECHANICAL2 = new SoundTheme("mechanical2", "Mechanical 2");
1314
static readonly TYPEWRITER1 = new SoundTheme("typewriter1", "Typewriter 1");
1415
static readonly TYPEWRITER2 = new SoundTheme("typewriter2", "Typewriter 2");
1516

1617
static readonly ALL = new Enum<SoundTheme>(
1718
SoundTheme.DEFAULT,
19+
SoundTheme.MECHANICAL1,
1820
SoundTheme.MECHANICAL2,
1921
SoundTheme.TYPEWRITER1,
2022
SoundTheme.TYPEWRITER2,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import click1 from "../../assets/mechanical1-click1.mp3";
2+
import click2 from "../../assets/mechanical1-click2.mp3";
3+
import click3 from "../../assets/mechanical1-click3.mp3";
4+
import click4 from "../../assets/mechanical1-click4.mp3";
5+
import click5 from "../../assets/mechanical1-click5.mp3";
6+
import click6 from "../../assets/mechanical1-click6.mp3";
7+
import click7 from "../../assets/mechanical1-click7.mp3";
8+
import click8 from "../../assets/mechanical1-click8.mp3";
9+
import click9 from "../../assets/mechanical1-click9.mp3";
10+
import { type ThemeConfig } from "../sound.ts";
11+
import { common } from "./common.ts";
12+
13+
export const mechanical1 = {
14+
...common,
15+
click: [
16+
click1,
17+
click2,
18+
click3,
19+
click4,
20+
click5,
21+
click6,
22+
click7,
23+
click8,
24+
click9,
25+
],
26+
} as const satisfies ThemeConfig;

0 commit comments

Comments
 (0)