Skip to content

Commit 31394dd

Browse files
committed
adjustable sample rate and synth mode
1 parent 632f2fd commit 31394dd

File tree

16 files changed

+268
-99
lines changed

16 files changed

+268
-99
lines changed

package-lock.json

Lines changed: 110 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "SpessaSynth",
3-
"version": "4.0.26",
3+
"version": "4.0.27",
44
"type": "module",
55
"private": true,
66
"scripts": {

src/website/CHANGELOG.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
* Note to self: make sure to update this
33
*/
44
export const WHATS_NEW: string[] = [
5-
`Support for node.js below v20 in Local Edition`
5+
`Adjustable sample rate!`,
6+
`Switching between Chrome and Worklet mode!`
67
] as const;

src/website/css/notification/toggles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
justify-content: space-between;
44
align-items: center;
55
margin: 0.5rem;
6+
gap: 0.5rem;
67
}
78

89
.notification_switch input {
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
export const interfaceSettings = {
22
title: "Interface settings",
3-
3+
44
toggleTheme: {
55
title: "Use dark theme",
66
description: "Enable the dark theme for the interface"
77
},
8-
8+
99
selectLanguage: {
1010
title: "Language",
1111
description: "Change the program language",
1212
helpTranslate: "Translate SpessaSynth"
1313
},
14-
14+
1515
layoutDirection: {
1616
title: "Layout direction",
1717
description: "The layout direction of the renderer and keyboard",
@@ -22,19 +22,24 @@ export const interfaceSettings = {
2222
rightToLeft: "Right to left"
2323
}
2424
},
25-
25+
26+
synthReload: {
27+
chromium: "Reload in Chrome mode",
28+
worklet: "Reload in Worklet mode"
29+
},
30+
2631
reminder: {
2732
title: "Did you know that you can hover over the settings to get more information?",
2833
description: "Like this one!"
2934
},
30-
35+
3136
useFirefox: {
3237
firefox: "Firefox Web Browser",
3338
recommended: "is highly recommended for the best performance."
3439
},
35-
40+
3641
showControls: {
3742
title: "Show controls",
3843
description: "Show the transport control buttons"
3944
}
40-
};
45+
};

src/website/js/locale/locale_files/locale_en/synthesizer_controller/synthesizer_controller.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ export const synthesizerControllerLocale = {
8383
description: "Configure the advanced settings for the synthesizer"
8484
},
8585

86+
sampleRate: {
87+
title: "Sample rate",
88+
description: "Change the sample rate of the synthesizer",
89+
warning:
90+
"Changing the sample rate requires a reload of the page. Are you sure you want to continue?"
91+
},
92+
8693
voiceCap: {
8794
title: "Voice cap",
8895
description: "The maximum amount of voices allowed to play at once"
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
export const interfaceSettings = {
22
title: "Ustawienia interfejsu",
3-
3+
44
toggleTheme: {
55
title: "Włącz ciemny motyw",
66
description: "Włącz ciemny motyw programu"
77
},
8-
8+
99
selectLanguage: {
1010
title: "Język",
1111
description: "Zmień język programu",
1212
helpTranslate: "Przetłumacz SpessaSynth"
1313
},
14-
14+
1515
layoutDirection: {
1616
title: "Układ",
1717
description: "Kierunek układu wizualizacji i pianina",
@@ -22,19 +22,24 @@ export const interfaceSettings = {
2222
rightToLeft: "Od prawej do lewej"
2323
}
2424
},
25-
25+
26+
synthReload: {
27+
chromium: "Przeładuj w trybie Chrome",
28+
worklet: "Przeładuj w trybie Worklet"
29+
},
30+
2631
reminder: {
2732
title: "Czy wiedziałeś, że możesz najechać na ustawienia, aby uzyskać więcej informacji?",
2833
description: "Tak jak ta!"
2934
},
30-
35+
3136
useFirefox: {
3237
firefox: "Przeglądarka firefox",
3338
recommended: "jest mocno zalecana dla najlepszej wydajności."
3439
},
35-
40+
3641
showControls: {
3742
title: "Pokaż kontrolki",
3843
description: "Pokaż kontrolki do przewijania czasu"
3944
}
40-
};
45+
};

src/website/js/locale/locale_files/locale_pl/synthesizer_controller/synthesizer_controller.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ export const synthesizerControllerLocale = {
8080
description: "Skonfiguruj zaawansowane ustawienia syntezatora"
8181
},
8282

83+
sampleRate: {
84+
title: "Częstotliwość próbkowania",
85+
description: "Zmień częstotliwość próbkowania syntezatora",
86+
warning:
87+
"Zmiana częstotliwości próbkowania wymaga przeładowania strony. Czy na pewno chcesz kontynuować?"
88+
},
89+
8390
voiceCap: {
8491
title: "Limit głosów",
8592
description: "Maksymalna ilość głosów mogąca grać jednocześnie"

src/website/js/main/demo_main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import { WHATS_NEW } from "../../CHANGELOG.js";
1111
import type { LocaleCode } from "../locale/locale_files/locale_list.ts";
1212
import type { MIDIFile } from "../utils/drop_file_handler.ts";
1313
import { DEFAULT_SAVED_SETTINGS, type SavedSettings } from "../../server/saved_settings.ts";
14+
import { readSampleRateParam } from "../utils/sample_rate_param.ts";
1415

1516
/**
1617
* Demo_main.js
1718
* purpose: main script for the demo, loads the soundfont and passes it to the manager.js
1819
*/
19-
const SAMPLE_RATE = 44100;
2020
const SF_NAME = "GeneralUserGS.sf3";
2121

2222
const titleMessage = document.getElementById("title")!;
@@ -152,7 +152,7 @@ async function demoInit(initLocale: LocaleCode) {
152152
const localeManager = new LocaleManager(initLocale);
153153
try {
154154
context = new AudioContext({
155-
sampleRate: SAMPLE_RATE
155+
sampleRate: readSampleRateParam()
156156
});
157157
} catch (e) {
158158
changeIcon(getExclamationSvg(256));

src/website/js/main/local_main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { LocaleManager } from "../locale/locale_manager.js";
77
import { SpessaSynthLogging } from "spessasynth_core";
88
import type { LocaleCode } from "../locale/locale_files/locale_list.ts";
99
import type { SavedSettings } from "../../server/saved_settings.ts";
10+
import { readSampleRateParam } from "../utils/sample_rate_param.ts";
1011

1112
declare global {
1213
interface Window {
@@ -23,7 +24,6 @@ declare global {
2324
* Local_main.js
2425
* purpose: main script for the local edition, loads the soundfont and passes it to the manager.js, reloads soundfonts when needed and saves the settings
2526
*/
26-
const SAMPLE_RATE = 44100;
2727

2828
SpessaSynthLogging(true, true, true);
2929
const titleMessage = document.getElementById("title")!;
@@ -45,7 +45,7 @@ const r = await (await fetch("/getversion")).text();
4545
window.SPESSASYNTH_VERSION = r;
4646

4747
let soundBankBufferCurrent: ArrayBuffer | undefined = undefined;
48-
const context = new AudioContext({ sampleRate: SAMPLE_RATE });
48+
const context = new AudioContext({ sampleRate: readSampleRateParam() });
4949

5050
let titleString = "TITLE STRING";
5151

0 commit comments

Comments
 (0)