fix: bank indexing (+1), audio profile settings (sample rate + buffer size), preset names match tone3000
This commit is contained in:
+28
-2
@@ -10,6 +10,22 @@ const T = {
|
||||
const SETTINGS = {
|
||||
"Audio": [
|
||||
{ key: "master_volume", label: "Master Volume", type: "slider", min: 0, max: 100, def: 72, unit: "%", icon: "🔊" },
|
||||
{ key: "sample_rate", label: "Sample Rate", type: "select", def: "48000",
|
||||
options: [
|
||||
{ value: "22050", label: "22.05 kHz" },
|
||||
{ value: "44100", label: "44.1 kHz" },
|
||||
{ value: "48000", label: "48 kHz" },
|
||||
{ value: "88200", label: "88.2 kHz" },
|
||||
{ value: "96000", label: "96 kHz" },
|
||||
], icon: "📊" },
|
||||
{ key: "buffer_size", label: "Buffer Size", type: "select", def: "512",
|
||||
options: [
|
||||
{ value: "64", label: "64 (1.3ms)" },
|
||||
{ value: "128", label: "128 (2.7ms)" },
|
||||
{ value: "256", label: "256 (5.3ms)" },
|
||||
{ value: "512", label: "512 (10.6ms)" },
|
||||
{ value: "1024",label: "1024 (21.3ms)" },
|
||||
], icon: "📦" },
|
||||
{ key: "input_pad", label: "Input Pad", type: "select", def: "off",
|
||||
options: [
|
||||
{ value: "off", label: "Off (0 dB)" },
|
||||
@@ -275,7 +291,7 @@ function BpmWidget({ label, value, onChange }) {
|
||||
}
|
||||
|
||||
// ── Global Settings ──
|
||||
export default function GlobalSettings({ onClose, onMasterVolume }) {
|
||||
export default function GlobalSettings({ onClose, onMasterVolume, onAudioProfile }) {
|
||||
const [values, setValues] = useState(() => {
|
||||
const init = {};
|
||||
for (const group of Object.values(SETTINGS)) {
|
||||
@@ -294,7 +310,17 @@ export default function GlobalSettings({ onClose, onMasterVolume }) {
|
||||
if (key === "master_volume") {
|
||||
onMasterVolume?.(val);
|
||||
}
|
||||
}, [onMasterVolume]);
|
||||
// Fire external callback for audio profile changes
|
||||
if (key === "sample_rate" || key === "buffer_size") {
|
||||
// Get the latest values — use the new val for the changed key
|
||||
setValues(prev => {
|
||||
const rate = key === "sample_rate" ? val : (prev.sample_rate || "48000");
|
||||
const period = key === "buffer_size" ? val : (prev.buffer_size || "512");
|
||||
onAudioProfile?.(parseInt(rate), parseInt(period));
|
||||
return prev;
|
||||
});
|
||||
}
|
||||
}, [onMasterVolume, onAudioProfile]);
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
|
||||
Reference in New Issue
Block a user