mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 09:52:50 +08:00
Whisper settings: incoming whisper rights, sound, history auto-open/cleanup
Options -> Whispern like TS3: allow/block by default with per-contact overrides (new Whisper field in contacts) or block all. The connector drops blocked whispers before decoding (whisperpolicy stdin command) and reports accepted ones as whisperReceived, which logs them in the whisper history, plays the new whisper sound and can open the history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
2e6b295185
commit
7b98cb2d7c
11 files changed
+295
-6
No files matched your search
+25
-4
@@ -301,6 +301,12 @@ enum Event {
|
|||||||
/// Ids of clients currently detected as talking.
|
/// Ids of clients currently detected as talking.
|
||||||
#[serde(rename = "talkers")]
|
#[serde(rename = "talkers")]
|
||||||
Talkers { clients: Vec<u16> },
|
Talkers { clients: Vec<u16> },
|
||||||
|
/// Someone started whispering to us and the whisper settings let it through.
|
||||||
|
#[serde(rename = "whisperReceived")]
|
||||||
|
WhisperReceived {
|
||||||
|
#[serde(rename = "clientId")]
|
||||||
|
client_id: u16,
|
||||||
|
},
|
||||||
#[serde(rename = "disconnected")]
|
#[serde(rename = "disconnected")]
|
||||||
Disconnected { reason: String },
|
Disconnected { reason: String },
|
||||||
/// Lost the server (timeout, server restart); tsclientlib is reconnecting
|
/// Lost the server (timeout, server restart); tsclientlib is reconnecting
|
||||||
@@ -1069,6 +1075,10 @@ async fn run(args: Args) -> Result<()> {
|
|||||||
// stdin command, cleared via "unwhisper".
|
// stdin command, cleared via "unwhisper".
|
||||||
let mut whisper_channels: Vec<u64> = Vec::new();
|
let mut whisper_channels: Vec<u64> = Vec::new();
|
||||||
let mut whisper_clients: Vec<u16> = Vec::new();
|
let mut whisper_clients: Vec<u16> = Vec::new();
|
||||||
|
// Incoming whispers, set via "whisperpolicy allow|block;<client ids>": the
|
||||||
|
// ids are exceptions to the mode. Blocked whispers are dropped undecoded.
|
||||||
|
let mut whisper_block_default = false;
|
||||||
|
let mut whisper_exceptions: HashSet<u16> = HashSet::new();
|
||||||
// Set by "clientconninfo"/"serverconninfo" while waiting for the server's
|
// Set by "clientconninfo"/"serverconninfo" while waiting for the server's
|
||||||
// reply to land in book state (it arrives async as a later BookEvents
|
// reply to land in book state (it arrives async as a later BookEvents
|
||||||
// batch, not as a direct command result) - checked and emitted below.
|
// batch, not as a direct command result) - checked and emitted below.
|
||||||
@@ -1431,6 +1441,10 @@ async fn run(args: Args) -> Result<()> {
|
|||||||
let clients_part = parts.next().unwrap_or("");
|
let clients_part = parts.next().unwrap_or("");
|
||||||
whisper_channels = channels_part.split(',').filter_map(|s| s.trim().parse().ok()).collect();
|
whisper_channels = channels_part.split(',').filter_map(|s| s.trim().parse().ok()).collect();
|
||||||
whisper_clients = clients_part.split(',').filter_map(|s| s.trim().parse().ok()).collect();
|
whisper_clients = clients_part.split(',').filter_map(|s| s.trim().parse().ok()).collect();
|
||||||
|
} else if let Some(rest) = l.strip_prefix("whisperpolicy ") {
|
||||||
|
let (mode, ids) = rest.split_once(';').unwrap_or((rest, ""));
|
||||||
|
whisper_block_default = mode.trim() == "block";
|
||||||
|
whisper_exceptions = ids.split(',').filter_map(|s| s.trim().parse().ok()).collect();
|
||||||
} else if l == "unwhisper" {
|
} else if l == "unwhisper" {
|
||||||
whisper_channels.clear();
|
whisper_channels.clear();
|
||||||
whisper_clients.clear();
|
whisper_clients.clear();
|
||||||
@@ -2656,11 +2670,15 @@ async fn run(args: Args) -> Result<()> {
|
|||||||
emit(&snapshot(con.get_state()?));
|
emit(&snapshot(con.get_state()?));
|
||||||
}
|
}
|
||||||
Some(Ok(StreamItem::Audio(packet))) => {
|
Some(Ok(StreamItem::Audio(packet))) => {
|
||||||
let from = match packet.data().data() {
|
let (from, whisper) = match packet.data().data() {
|
||||||
AudioData::S2C { from, .. } => Some(ClientId(*from)),
|
AudioData::S2C { from, .. } => (Some(ClientId(*from)), false),
|
||||||
AudioData::S2CWhisper { from, .. } => Some(ClientId(*from)),
|
AudioData::S2CWhisper { from, .. } => (Some(ClientId(*from)), true),
|
||||||
_ => None,
|
_ => (None, false),
|
||||||
};
|
};
|
||||||
|
// A whisper gets through when its sender isn't an exception to a
|
||||||
|
// blocking mode, or is one to an allowing mode.
|
||||||
|
let from =
|
||||||
|
from.filter(|f| !whisper || whisper_block_default == whisper_exceptions.contains(&f.0));
|
||||||
if let Some(from) = from {
|
if let Some(from) = from {
|
||||||
if let Ok(Some(new_talker)) = audio_handler.handle_packet(from, packet) {
|
if let Ok(Some(new_talker)) = audio_handler.handle_packet(from, packet) {
|
||||||
if let (Some(&volume), Some(queue)) = (
|
if let (Some(&volume), Some(queue)) = (
|
||||||
@@ -2671,6 +2689,9 @@ async fn run(args: Args) -> Result<()> {
|
|||||||
}
|
}
|
||||||
if talking.insert(new_talker.0) {
|
if talking.insert(new_talker.0) {
|
||||||
emit(&Event::Talkers { clients: talking.iter().copied().collect() });
|
emit(&Event::Talkers { clients: talking.iter().copied().collect() });
|
||||||
|
if whisper {
|
||||||
|
emit(&Event::WhisperReceived { client_id: new_talker.0 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -882,6 +882,10 @@ wss.on("connection", (socket: WebSocket, req: IncomingMessage) => {
|
|||||||
await connection?.setNickname(msg.nickname);
|
await connection?.setNickname(msg.nickname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "setWhisperPolicy": {
|
||||||
|
connection?.setWhisperPolicy(msg.block === true, Array.isArray(msg.exceptions) ? msg.exceptions : []);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "setWhisperTargets": {
|
case "setWhisperTargets": {
|
||||||
await connection?.setWhisperTargets(msg.channelIds ?? [], msg.clientIds ?? []);
|
await connection?.setWhisperTargets(msg.channelIds ?? [], msg.clientIds ?? []);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ export type Ts3ConnectionEvent =
|
|||||||
| { type: "poke"; from: string; message: string }
|
| { type: "poke"; from: string; message: string }
|
||||||
| { type: "audioOut"; pcm: string }
|
| { type: "audioOut"; pcm: string }
|
||||||
| { type: "talkers"; clients: number[] }
|
| { type: "talkers"; clients: number[] }
|
||||||
|
| { type: "whisperReceived"; clientId: number }
|
||||||
| { type: "disconnected"; reason: string }
|
| { type: "disconnected"; reason: string }
|
||||||
| { type: "reconnecting"; reason: string }
|
| { type: "reconnecting"; reason: string }
|
||||||
| { type: "reconnected" }
|
| { type: "reconnected" }
|
||||||
@@ -363,6 +364,7 @@ export class Ts3Connection {
|
|||||||
| { type: "poke"; from: string; message: string }
|
| { type: "poke"; from: string; message: string }
|
||||||
| { type: "audioOut"; pcm: string }
|
| { type: "audioOut"; pcm: string }
|
||||||
| { type: "talkers"; clients: number[] }
|
| { type: "talkers"; clients: number[] }
|
||||||
|
| { type: "whisperReceived"; clientId: number }
|
||||||
| { type: "disconnected"; reason: string }
|
| { type: "disconnected"; reason: string }
|
||||||
| { type: "reconnecting"; reason: string }
|
| { type: "reconnecting"; reason: string }
|
||||||
| { type: "reconnected" }
|
| { type: "reconnected" }
|
||||||
@@ -959,6 +961,12 @@ export class Ts3Connection {
|
|||||||
if (sanitized) this.writeLine(`nickname ${sanitized}`);
|
if (sanitized) this.writeLine(`nickname ${sanitized}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Incoming whispers: allowed or blocked by default; `exceptions` (client ids) get the opposite. */
|
||||||
|
setWhisperPolicy(block: boolean, exceptions: unknown[]): void {
|
||||||
|
const ids = exceptions.map(Number).filter(Number.isInteger);
|
||||||
|
this.writeLine(`whisperpolicy ${block ? "block" : "allow"};${ids.join(",")}`);
|
||||||
|
}
|
||||||
|
|
||||||
/** Empty channelIds/clientIds clears whisper mode, returning outgoing
|
/** Empty channelIds/clientIds clears whisper mode, returning outgoing
|
||||||
* voice to the normal current-channel broadcast. */
|
* voice to the normal current-channel broadcast. */
|
||||||
async setWhisperTargets(channelIds: number[], clientIds: number[]): Promise<void> {
|
async setWhisperTargets(channelIds: number[], clientIds: number[]): Promise<void> {
|
||||||
|
|||||||
+162
-1
@@ -618,6 +618,28 @@ const SERVER_BANNER_KEY = "webspeak3:server-banner";
|
|||||||
const IDE_PIXEL_FONT_KEY = "webspeak3:ide-pixel-font";
|
const IDE_PIXEL_FONT_KEY = "webspeak3:ide-pixel-font";
|
||||||
// Off by default: an inline chat image loads from whatever host the sender picked.
|
// Off by default: an inline chat image loads from whatever host the sender picked.
|
||||||
const CHAT_IMAGES_KEY = "webspeak3:chat-images";
|
const CHAT_IMAGES_KEY = "webspeak3:chat-images";
|
||||||
|
const WHISPER_SETTINGS_KEY = "webspeak3:whisper-settings";
|
||||||
|
|
||||||
|
/** Options -> Whispern (TS3's "Whispereinstellungen"). */
|
||||||
|
interface WhisperSettings {
|
||||||
|
/** allow/block: what applies to contacts without their own whisper setting. */
|
||||||
|
mode: "allow" | "block" | "blockAll";
|
||||||
|
sound: boolean;
|
||||||
|
openHistory: boolean;
|
||||||
|
/** Incoming entries leave the whisper history after this many minutes; 0 = never. */
|
||||||
|
clearAfterMin: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DEFAULT_WHISPER_SETTINGS: WhisperSettings = { mode: "allow", sound: true, openHistory: true, clearAfterMin: 5 };
|
||||||
|
|
||||||
|
function loadWhisperSettings(): WhisperSettings {
|
||||||
|
try {
|
||||||
|
return { ...DEFAULT_WHISPER_SETTINGS, ...JSON.parse(localStorage.getItem(WHISPER_SETTINGS_KEY) ?? "{}") };
|
||||||
|
} catch {
|
||||||
|
return DEFAULT_WHISPER_SETTINGS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const TREE_OPTIONS_KEY = "webspeak3:tree-options";
|
const TREE_OPTIONS_KEY = "webspeak3:tree-options";
|
||||||
|
|
||||||
/** Design tab -> "Channel Baum" and "GIF Animation" (TS3's options). */
|
/** Design tab -> "Channel Baum" and "GIF Animation" (TS3's options). */
|
||||||
@@ -664,6 +686,8 @@ const DisplayPrefsContext = createContext<{
|
|||||||
iconPackId: string;
|
iconPackId: string;
|
||||||
setIconPackId: (id: string) => void;
|
setIconPackId: (id: string) => void;
|
||||||
saveIconPacks: (packs: IconPack[]) => void;
|
saveIconPacks: (packs: IconPack[]) => void;
|
||||||
|
whisper: WhisperSettings;
|
||||||
|
setWhisper: (next: WhisperSettings) => void;
|
||||||
}>({
|
}>({
|
||||||
tree: DEFAULT_TREE_OPTIONS,
|
tree: DEFAULT_TREE_OPTIONS,
|
||||||
setTree: () => {},
|
setTree: () => {},
|
||||||
@@ -671,6 +695,8 @@ const DisplayPrefsContext = createContext<{
|
|||||||
iconPackId: "",
|
iconPackId: "",
|
||||||
setIconPackId: () => {},
|
setIconPackId: () => {},
|
||||||
saveIconPacks: () => {},
|
saveIconPacks: () => {},
|
||||||
|
whisper: DEFAULT_WHISPER_SETTINGS,
|
||||||
|
setWhisper: () => {},
|
||||||
});
|
});
|
||||||
const DISCONNECT_MESSAGE_KEY = "webspeak3:disconnect-message";
|
const DISCONNECT_MESSAGE_KEY = "webspeak3:disconnect-message";
|
||||||
const COLLECTED_URLS_KEY = "webspeak3:collected-urls";
|
const COLLECTED_URLS_KEY = "webspeak3:collected-urls";
|
||||||
@@ -708,6 +734,8 @@ interface WhisperLogEntry {
|
|||||||
id: number;
|
id: number;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
description: string;
|
description: string;
|
||||||
|
/** Someone whispered to us (as opposed to our own whisper target changes). */
|
||||||
|
incoming?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BanListEntry {
|
interface BanListEntry {
|
||||||
@@ -748,6 +776,8 @@ interface Contact {
|
|||||||
category: ContactCategory;
|
category: ContactCategory;
|
||||||
phoneticName: string;
|
phoneticName: string;
|
||||||
ignored: boolean;
|
ignored: boolean;
|
||||||
|
/** Incoming whispers from this contact; unset follows Options -> Whispern. */
|
||||||
|
whisper?: "allow" | "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
const CONTACTS_KEY = "webspeak3:contacts";
|
const CONTACTS_KEY = "webspeak3:contacts";
|
||||||
@@ -5507,6 +5537,18 @@ function ContactsDialog({
|
|||||||
onChange={(e) => updateSelected({ phoneticName: e.target.value })}
|
onChange={(e) => updateSelected({ phoneticName: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
<label className="ts-dialog-field">
|
||||||
|
{t("contacts.whisperSetting")}
|
||||||
|
<select
|
||||||
|
disabled={!selected}
|
||||||
|
value={selected?.whisper ?? ""}
|
||||||
|
onChange={(e) => updateSelected({ whisper: (e.target.value || undefined) as Contact["whisper"] })}
|
||||||
|
>
|
||||||
|
<option value="">{t("contacts.whisperSetting.default")}</option>
|
||||||
|
<option value="allow">{t("contacts.whisperSetting.allow")}</option>
|
||||||
|
<option value="block">{t("contacts.whisperSetting.block")}</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
<div className="ts-contacts-actions">
|
<div className="ts-contacts-actions">
|
||||||
<button
|
<button
|
||||||
disabled={!selectedOnlineClient}
|
disabled={!selectedOnlineClient}
|
||||||
@@ -6079,6 +6121,59 @@ function ActionIcon({ children }: { children: ReactNode }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const WHISPER_CLEAR_OPTIONS = [1, 5, 10, 30, 60, 0];
|
||||||
|
|
||||||
|
function WhisperPanel({ onOpenWhisperLists }: { onOpenWhisperLists: () => void }) {
|
||||||
|
const t = useT();
|
||||||
|
const { whisper, setWhisper } = useContext(DisplayPrefsContext);
|
||||||
|
const set = (patch: Partial<WhisperSettings>) => setWhisper({ ...whisper, ...patch });
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h3>{t("options.section.whispern")}</h3>
|
||||||
|
<p className="ts-options-subtitle">{t("whisperSettings.subtitle")}</p>
|
||||||
|
<div className="ts-options-fields">
|
||||||
|
<fieldset className="ts-options-fieldset">
|
||||||
|
<legend>{t("whisperSettings.rights")}</legend>
|
||||||
|
{(["allow", "block", "blockAll"] as const).map((mode) => (
|
||||||
|
<label key={mode} className="ts-options-radio">
|
||||||
|
<input type="radio" name="ts-whisper-mode" checked={whisper.mode === mode} onChange={() => set({ mode })} />
|
||||||
|
{t(`whisperSettings.mode.${mode}`)}
|
||||||
|
</label>
|
||||||
|
))}
|
||||||
|
</fieldset>
|
||||||
|
<fieldset className="ts-options-fieldset">
|
||||||
|
<legend>{t("whisperSettings.incoming")}</legend>
|
||||||
|
<label className="ts-options-checkbox">
|
||||||
|
<input type="checkbox" checked={whisper.sound} onChange={(e) => set({ sound: e.target.checked })} />
|
||||||
|
{t("whisperSettings.sound")}
|
||||||
|
</label>
|
||||||
|
<label className="ts-options-checkbox">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={whisper.openHistory}
|
||||||
|
onChange={(e) => set({ openHistory: e.target.checked })}
|
||||||
|
/>
|
||||||
|
{t("whisperSettings.openHistory")}
|
||||||
|
</label>
|
||||||
|
<label className="ts-options-field">
|
||||||
|
{t("whisperSettings.clearAfter")}
|
||||||
|
<select value={whisper.clearAfterMin} onChange={(e) => set({ clearAfterMin: Number(e.target.value) })}>
|
||||||
|
{WHISPER_CLEAR_OPTIONS.map((min) => (
|
||||||
|
<option key={min} value={min}>
|
||||||
|
{min === 0 ? t("whisperSettings.never") : t("whisperSettings.minutes", { count: String(min) })}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
<div>
|
||||||
|
<button onClick={onOpenWhisperLists}>{t("menu.extras.whisperLists")}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function DesignPanel({
|
function DesignPanel({
|
||||||
designSelection,
|
designSelection,
|
||||||
onSelectionChange,
|
onSelectionChange,
|
||||||
@@ -7034,6 +7129,7 @@ function OptionsDialog({
|
|||||||
onShowServerBannerChange,
|
onShowServerBannerChange,
|
||||||
chatImages,
|
chatImages,
|
||||||
onChatImagesChange,
|
onChatImagesChange,
|
||||||
|
onOpenWhisperLists,
|
||||||
}: {
|
}: {
|
||||||
section: string;
|
section: string;
|
||||||
onSectionChange: (id: string) => void;
|
onSectionChange: (id: string) => void;
|
||||||
@@ -7050,6 +7146,7 @@ function OptionsDialog({
|
|||||||
onShowServerBannerChange: (on: boolean) => void;
|
onShowServerBannerChange: (on: boolean) => void;
|
||||||
chatImages: boolean;
|
chatImages: boolean;
|
||||||
onChatImagesChange: (on: boolean) => void;
|
onChatImagesChange: (on: boolean) => void;
|
||||||
|
onOpenWhisperLists: () => void;
|
||||||
}) {
|
}) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const active = OPTIONS_SECTIONS.find((s) => s.id === section) ?? OPTIONS_SECTIONS[0];
|
const active = OPTIONS_SECTIONS.find((s) => s.id === section) ?? OPTIONS_SECTIONS[0];
|
||||||
@@ -7104,6 +7201,8 @@ function OptionsDialog({
|
|||||||
/>
|
/>
|
||||||
) : active.id === "nachrichten" ? (
|
) : active.id === "nachrichten" ? (
|
||||||
<NachrichtenPanel />
|
<NachrichtenPanel />
|
||||||
|
) : active.id === "whispern" ? (
|
||||||
|
<WhisperPanel onOpenWhisperLists={onOpenWhisperLists} />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<h3>{t(`options.section.${active.id}`)}</h3>
|
<h3>{t(`options.section.${active.id}`)}</h3>
|
||||||
@@ -7584,6 +7683,9 @@ function AppInner() {
|
|||||||
const [treeOptions, setTreeOptions] = useState(loadTreeOptions);
|
const [treeOptions, setTreeOptions] = useState(loadTreeOptions);
|
||||||
const [iconPacks, setIconPacks] = useState(loadIconPacks);
|
const [iconPacks, setIconPacks] = useState(loadIconPacks);
|
||||||
const [iconPackId, setIconPackId] = useState(loadSelectedIconPack);
|
const [iconPackId, setIconPackId] = useState(loadSelectedIconPack);
|
||||||
|
const [whisperSettings, setWhisperSettings] = useState(loadWhisperSettings);
|
||||||
|
const whisperSettingsRef = useRef(whisperSettings);
|
||||||
|
whisperSettingsRef.current = whisperSettings;
|
||||||
const displayPrefs = useMemo(
|
const displayPrefs = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
tree: treeOptions,
|
tree: treeOptions,
|
||||||
@@ -7601,8 +7703,13 @@ function AppInner() {
|
|||||||
saveIconPacks(packs); // throws when storage is full - before the state changes
|
saveIconPacks(packs); // throws when storage is full - before the state changes
|
||||||
setIconPacks(packs);
|
setIconPacks(packs);
|
||||||
},
|
},
|
||||||
|
whisper: whisperSettings,
|
||||||
|
setWhisper: (next: WhisperSettings) => {
|
||||||
|
setWhisperSettings(next);
|
||||||
|
localStorage.setItem(WHISPER_SETTINGS_KEY, JSON.stringify(next));
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
[treeOptions, iconPacks, iconPackId]
|
[treeOptions, iconPacks, iconPackId, whisperSettings]
|
||||||
);
|
);
|
||||||
const iconPackStyle = iconPackCss(iconPacks.find((p) => p.id === iconPackId));
|
const iconPackStyle = iconPackCss(iconPacks.find((p) => p.id === iconPackId));
|
||||||
const [micOn, setMicOn] = useState(false);
|
const [micOn, setMicOn] = useState(false);
|
||||||
@@ -8589,6 +8696,21 @@ function AppInner() {
|
|||||||
setTalkers(next);
|
setTalkers(next);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "whisperReceived": {
|
||||||
|
const name = previousClientsRef.current?.find((c) => c.id === data.clientId)?.name ?? `#${data.clientId}`;
|
||||||
|
setWhisperLog((prevLog) => [
|
||||||
|
...prevLog,
|
||||||
|
{
|
||||||
|
id: ++whisperLogIdRef.current,
|
||||||
|
timestamp: Date.now(),
|
||||||
|
description: t("whisperHistory.received", { name }),
|
||||||
|
incoming: true,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
if (whisperSettingsRef.current.sound && !outputMutedRef.current) void playSound("whisper");
|
||||||
|
if (whisperSettingsRef.current.openHistory) setWhisperHistoryOpen(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "reconnecting":
|
case "reconnecting":
|
||||||
// The gateway lost the TS server and is reconnecting by itself.
|
// The gateway lost the TS server and is reconnecting by itself.
|
||||||
appendLog({ text: t("log.serverReconnecting"), kind: "error" });
|
appendLog({ text: t("log.serverReconnecting"), kind: "error" });
|
||||||
@@ -9520,6 +9642,44 @@ function AppInner() {
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [whisperChannelIds, whisperClientIds, connected]);
|
}, [whisperChannelIds, whisperClientIds, connected]);
|
||||||
|
|
||||||
|
// Tell the connector whose whispers to let through: the mode's default plus
|
||||||
|
// the online clients whose contact entry says otherwise. Resent whenever
|
||||||
|
// that changes or the socket is new (the connector forgets it on reconnect).
|
||||||
|
const sentWhisperPolicyRef = useRef<{ socket: WebSocket | DemoSocket | null; payload: string }>({ socket: null, payload: "" });
|
||||||
|
useEffect(() => {
|
||||||
|
const socket = socketRef.current;
|
||||||
|
if (!connected || !socket) return;
|
||||||
|
const block = whisperSettings.mode !== "allow";
|
||||||
|
const exceptionMode = block ? "allow" : "block";
|
||||||
|
const exceptions =
|
||||||
|
whisperSettings.mode === "blockAll"
|
||||||
|
? []
|
||||||
|
: clients
|
||||||
|
.filter((c) => contacts.find((k) => k.uid === c.uid)?.whisper === exceptionMode)
|
||||||
|
.map((c) => c.id)
|
||||||
|
.sort((a, b) => a - b);
|
||||||
|
const payload = JSON.stringify({ type: "setWhisperPolicy", block, exceptions });
|
||||||
|
const sent = sentWhisperPolicyRef.current;
|
||||||
|
if (sent.socket === socket && sent.payload === payload) return;
|
||||||
|
socket.send(payload);
|
||||||
|
sentWhisperPolicyRef.current = { socket, payload };
|
||||||
|
}, [connected, clients, contacts, whisperSettings.mode]);
|
||||||
|
|
||||||
|
// "Clients in Whisper Verlauf löschen nach": drop old incoming entries.
|
||||||
|
useEffect(() => {
|
||||||
|
const minutes = whisperSettings.clearAfterMin;
|
||||||
|
if (!minutes) return;
|
||||||
|
const prune = () =>
|
||||||
|
setWhisperLog((prev) => {
|
||||||
|
const cutoff = Date.now() - minutes * 60_000;
|
||||||
|
const next = prev.filter((e) => !e.incoming || e.timestamp >= cutoff);
|
||||||
|
return next.length === prev.length ? prev : next;
|
||||||
|
});
|
||||||
|
prune();
|
||||||
|
const timer = setInterval(prune, 15_000);
|
||||||
|
return () => clearInterval(timer);
|
||||||
|
}, [whisperSettings.clearAfterMin]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!whisperMenuOpen) return;
|
if (!whisperMenuOpen) return;
|
||||||
const onPointerDown = (e: MouseEvent) => {
|
const onPointerDown = (e: MouseEvent) => {
|
||||||
@@ -11973,6 +12133,7 @@ function AppInner() {
|
|||||||
|
|
||||||
{optionsDialogOpen && (
|
{optionsDialogOpen && (
|
||||||
<OptionsDialog
|
<OptionsDialog
|
||||||
|
onOpenWhisperLists={() => setWhisperListsOpen(true)}
|
||||||
section={optionsSection}
|
section={optionsSection}
|
||||||
onSectionChange={setOptionsSection}
|
onSectionChange={setOptionsSection}
|
||||||
onClose={() => setOptionsDialogOpen(false)}
|
onClose={() => setOptionsDialogOpen(false)}
|
||||||
|
|||||||
@@ -165,6 +165,18 @@
|
|||||||
"whisperHistory.title": "Historie šeptání – {server}",
|
"whisperHistory.title": "Historie šeptání – {server}",
|
||||||
"whisperHistory.empty": "Zatím žádná historie šeptání.",
|
"whisperHistory.empty": "Zatím žádná historie šeptání.",
|
||||||
"whisperHistory.started": "Šeptání pro: {targets}",
|
"whisperHistory.started": "Šeptání pro: {targets}",
|
||||||
|
"whisperSettings.subtitle": "Nastavení šeptání",
|
||||||
|
"whisperSettings.rights": "Oprávnění pro příchozí šeptání",
|
||||||
|
"whisperSettings.mode.allow": "Použít nastavení kontaktů, jinak povolit",
|
||||||
|
"whisperSettings.mode.block": "Použít nastavení kontaktů, jinak zakázat",
|
||||||
|
"whisperSettings.mode.blockAll": "Zakázat vše",
|
||||||
|
"whisperSettings.incoming": "Nastavení příchozího šeptání",
|
||||||
|
"whisperSettings.sound": "Přehrát zvuk, když vám někdo šeptá",
|
||||||
|
"whisperSettings.openHistory": "Vždy otevřít historii šeptání, když vám někdo šeptá",
|
||||||
|
"whisperSettings.clearAfter": "Odebrat klienty z historie šeptání po",
|
||||||
|
"whisperSettings.never": "Nikdy",
|
||||||
|
"whisperSettings.minutes": "{count} min",
|
||||||
|
"whisperHistory.received": "{name} vám šeptal(a)",
|
||||||
"whisperHistory.stopped": "Šeptání zastaveno",
|
"whisperHistory.stopped": "Šeptání zastaveno",
|
||||||
"whisperHistory.clear": "Vymazat",
|
"whisperHistory.clear": "Vymazat",
|
||||||
"whisperHistory.options": "Možnosti",
|
"whisperHistory.options": "Možnosti",
|
||||||
@@ -241,6 +253,10 @@
|
|||||||
"contacts.category.blocked": "Blokovaný",
|
"contacts.category.blocked": "Blokovaný",
|
||||||
"contacts.category.friend": "Přítel",
|
"contacts.category.friend": "Přítel",
|
||||||
"contacts.phoneticName": "Fonetické jméno:",
|
"contacts.phoneticName": "Fonetické jméno:",
|
||||||
|
"contacts.whisperSetting": "Šeptání:",
|
||||||
|
"contacts.whisperSetting.default": "Výchozí",
|
||||||
|
"contacts.whisperSetting.allow": "Povolit",
|
||||||
|
"contacts.whisperSetting.block": "Zakázat",
|
||||||
"contacts.show": "Zobrazit",
|
"contacts.show": "Zobrazit",
|
||||||
"contacts.ignore": "Ignorovat",
|
"contacts.ignore": "Ignorovat",
|
||||||
"contacts.unignore": "Přestat ignorovat",
|
"contacts.unignore": "Přestat ignorovat",
|
||||||
@@ -696,6 +712,7 @@
|
|||||||
"sounds.event.mute": "Přepnutí ztlumení",
|
"sounds.event.mute": "Přepnutí ztlumení",
|
||||||
"sounds.event.micClickOn": "Kliknutí mikrofonu zap.",
|
"sounds.event.micClickOn": "Kliknutí mikrofonu zap.",
|
||||||
"sounds.event.micClickOff": "Kliknutí mikrofonu vyp.",
|
"sounds.event.micClickOff": "Kliknutí mikrofonu vyp.",
|
||||||
|
"sounds.event.whisper": "Přijato šeptání",
|
||||||
"sounds.default": "Výchozí",
|
"sounds.default": "Výchozí",
|
||||||
"sounds.custom": "Vlastní soubor: {name}",
|
"sounds.custom": "Vlastní soubor: {name}",
|
||||||
"sounds.test": "▶ Test",
|
"sounds.test": "▶ Test",
|
||||||
|
|||||||
@@ -165,6 +165,18 @@
|
|||||||
"whisperHistory.title": "Whisper Verlauf - {server}",
|
"whisperHistory.title": "Whisper Verlauf - {server}",
|
||||||
"whisperHistory.empty": "Kein Whisper-Verlauf vorhanden.",
|
"whisperHistory.empty": "Kein Whisper-Verlauf vorhanden.",
|
||||||
"whisperHistory.started": "Whispern an: {targets}",
|
"whisperHistory.started": "Whispern an: {targets}",
|
||||||
|
"whisperSettings.subtitle": "Whispereinstellungen",
|
||||||
|
"whisperSettings.rights": "Rechte für eingehende Whisper",
|
||||||
|
"whisperSettings.mode.allow": "Individuelle Einstellungen in Kontakten benutzen, ansonsten erlauben",
|
||||||
|
"whisperSettings.mode.block": "Individuelle Einstellungen in Kontakten benutzen, ansonsten verbieten",
|
||||||
|
"whisperSettings.mode.blockAll": "Alle verbieten",
|
||||||
|
"whisperSettings.incoming": "Einstellungen für eingehende Whisper",
|
||||||
|
"whisperSettings.sound": "Sound abspielen, wenn Sie angewhispert werden",
|
||||||
|
"whisperSettings.openHistory": "Whisper Verlauf immer öffnen, wenn Sie angewhispert werden",
|
||||||
|
"whisperSettings.clearAfter": "Clients in Whisper Verlauf löschen nach",
|
||||||
|
"whisperSettings.never": "Nie",
|
||||||
|
"whisperSettings.minutes": "{count} Min.",
|
||||||
|
"whisperHistory.received": "{name} hat dir zugewhispert",
|
||||||
"whisperHistory.stopped": "Whispern beendet",
|
"whisperHistory.stopped": "Whispern beendet",
|
||||||
"whisperHistory.clear": "Löschen",
|
"whisperHistory.clear": "Löschen",
|
||||||
"whisperHistory.options": "Optionen",
|
"whisperHistory.options": "Optionen",
|
||||||
@@ -241,6 +253,10 @@
|
|||||||
"contacts.category.blocked": "Blockiert",
|
"contacts.category.blocked": "Blockiert",
|
||||||
"contacts.category.friend": "Freund",
|
"contacts.category.friend": "Freund",
|
||||||
"contacts.phoneticName": "Phonetischer Name:",
|
"contacts.phoneticName": "Phonetischer Name:",
|
||||||
|
"contacts.whisperSetting": "Whisper:",
|
||||||
|
"contacts.whisperSetting.default": "Standard",
|
||||||
|
"contacts.whisperSetting.allow": "Erlauben",
|
||||||
|
"contacts.whisperSetting.block": "Verbieten",
|
||||||
"contacts.show": "Anzeige",
|
"contacts.show": "Anzeige",
|
||||||
"contacts.ignore": "Ignorieren",
|
"contacts.ignore": "Ignorieren",
|
||||||
"contacts.unignore": "Nicht mehr ignorieren",
|
"contacts.unignore": "Nicht mehr ignorieren",
|
||||||
@@ -696,6 +712,7 @@
|
|||||||
"sounds.event.mute": "Stummschaltung umgeschaltet",
|
"sounds.event.mute": "Stummschaltung umgeschaltet",
|
||||||
"sounds.event.micClickOn": "Mikro Klick an",
|
"sounds.event.micClickOn": "Mikro Klick an",
|
||||||
"sounds.event.micClickOff": "Mikro Klick aus",
|
"sounds.event.micClickOff": "Mikro Klick aus",
|
||||||
|
"sounds.event.whisper": "Whisper empfangen",
|
||||||
"sounds.default": "Standard",
|
"sounds.default": "Standard",
|
||||||
"sounds.custom": "Eigene Datei: {name}",
|
"sounds.custom": "Eigene Datei: {name}",
|
||||||
"sounds.test": "▶ Testen",
|
"sounds.test": "▶ Testen",
|
||||||
|
|||||||
@@ -165,6 +165,18 @@
|
|||||||
"whisperHistory.title": "Whisper History - {server}",
|
"whisperHistory.title": "Whisper History - {server}",
|
||||||
"whisperHistory.empty": "No whisper history yet.",
|
"whisperHistory.empty": "No whisper history yet.",
|
||||||
"whisperHistory.started": "Whispering to: {targets}",
|
"whisperHistory.started": "Whispering to: {targets}",
|
||||||
|
"whisperSettings.subtitle": "Whisper settings",
|
||||||
|
"whisperSettings.rights": "Permissions for incoming whispers",
|
||||||
|
"whisperSettings.mode.allow": "Use individual contact settings, otherwise allow",
|
||||||
|
"whisperSettings.mode.block": "Use individual contact settings, otherwise block",
|
||||||
|
"whisperSettings.mode.blockAll": "Block all",
|
||||||
|
"whisperSettings.incoming": "Incoming whisper settings",
|
||||||
|
"whisperSettings.sound": "Play a sound when someone whispers to you",
|
||||||
|
"whisperSettings.openHistory": "Always open the whisper history when someone whispers to you",
|
||||||
|
"whisperSettings.clearAfter": "Remove clients from the whisper history after",
|
||||||
|
"whisperSettings.never": "Never",
|
||||||
|
"whisperSettings.minutes": "{count} min",
|
||||||
|
"whisperHistory.received": "{name} whispered to you",
|
||||||
"whisperHistory.stopped": "Stopped whispering",
|
"whisperHistory.stopped": "Stopped whispering",
|
||||||
"whisperHistory.clear": "Clear",
|
"whisperHistory.clear": "Clear",
|
||||||
"whisperHistory.options": "Options",
|
"whisperHistory.options": "Options",
|
||||||
@@ -241,6 +253,10 @@
|
|||||||
"contacts.category.blocked": "Blocked",
|
"contacts.category.blocked": "Blocked",
|
||||||
"contacts.category.friend": "Friend",
|
"contacts.category.friend": "Friend",
|
||||||
"contacts.phoneticName": "Phonetic Name:",
|
"contacts.phoneticName": "Phonetic Name:",
|
||||||
|
"contacts.whisperSetting": "Whisper:",
|
||||||
|
"contacts.whisperSetting.default": "Default",
|
||||||
|
"contacts.whisperSetting.allow": "Allow",
|
||||||
|
"contacts.whisperSetting.block": "Block",
|
||||||
"contacts.show": "Show",
|
"contacts.show": "Show",
|
||||||
"contacts.ignore": "Ignore",
|
"contacts.ignore": "Ignore",
|
||||||
"contacts.unignore": "Unignore",
|
"contacts.unignore": "Unignore",
|
||||||
@@ -696,6 +712,7 @@
|
|||||||
"sounds.event.mute": "Mute toggled",
|
"sounds.event.mute": "Mute toggled",
|
||||||
"sounds.event.micClickOn": "Mic click on",
|
"sounds.event.micClickOn": "Mic click on",
|
||||||
"sounds.event.micClickOff": "Mic click off",
|
"sounds.event.micClickOff": "Mic click off",
|
||||||
|
"sounds.event.whisper": "Whisper received",
|
||||||
"sounds.default": "Default",
|
"sounds.default": "Default",
|
||||||
"sounds.custom": "Custom file: {name}",
|
"sounds.custom": "Custom file: {name}",
|
||||||
"sounds.test": "▶ Test",
|
"sounds.test": "▶ Test",
|
||||||
|
|||||||
@@ -165,6 +165,18 @@
|
|||||||
"whisperHistory.title": "تاریخچه نجوا - {server}",
|
"whisperHistory.title": "تاریخچه نجوا - {server}",
|
||||||
"whisperHistory.empty": "هنوز تاریخچه نجوایی وجود ندارد.",
|
"whisperHistory.empty": "هنوز تاریخچه نجوایی وجود ندارد.",
|
||||||
"whisperHistory.started": "در حال نجوا با: {targets}",
|
"whisperHistory.started": "در حال نجوا با: {targets}",
|
||||||
|
"whisperSettings.subtitle": "تنظیمات نجوا",
|
||||||
|
"whisperSettings.rights": "مجوز نجواهای ورودی",
|
||||||
|
"whisperSettings.mode.allow": "استفاده از تنظیمات مخاطبین، در غیر این صورت اجازه",
|
||||||
|
"whisperSettings.mode.block": "استفاده از تنظیمات مخاطبین، در غیر این صورت مسدود",
|
||||||
|
"whisperSettings.mode.blockAll": "مسدود کردن همه",
|
||||||
|
"whisperSettings.incoming": "تنظیمات نجواهای ورودی",
|
||||||
|
"whisperSettings.sound": "پخش صدا هنگام دریافت نجوا",
|
||||||
|
"whisperSettings.openHistory": "باز کردن تاریخچهٔ نجوا هنگام دریافت نجوا",
|
||||||
|
"whisperSettings.clearAfter": "حذف کاربران از تاریخچهٔ نجوا پس از",
|
||||||
|
"whisperSettings.never": "هرگز",
|
||||||
|
"whisperSettings.minutes": "{count} دقیقه",
|
||||||
|
"whisperHistory.received": "{name} با شما نجوا کرد",
|
||||||
"whisperHistory.stopped": "نجوا متوقف شد",
|
"whisperHistory.stopped": "نجوا متوقف شد",
|
||||||
"whisperHistory.clear": "پاک کردن",
|
"whisperHistory.clear": "پاک کردن",
|
||||||
"whisperHistory.options": "گزینهها",
|
"whisperHistory.options": "گزینهها",
|
||||||
@@ -241,6 +253,10 @@
|
|||||||
"contacts.category.blocked": "مسدود",
|
"contacts.category.blocked": "مسدود",
|
||||||
"contacts.category.friend": "دوست",
|
"contacts.category.friend": "دوست",
|
||||||
"contacts.phoneticName": "تلفظ نام:",
|
"contacts.phoneticName": "تلفظ نام:",
|
||||||
|
"contacts.whisperSetting": "نجوا:",
|
||||||
|
"contacts.whisperSetting.default": "پیشفرض",
|
||||||
|
"contacts.whisperSetting.allow": "اجازه",
|
||||||
|
"contacts.whisperSetting.block": "مسدود",
|
||||||
"contacts.show": "نمایش",
|
"contacts.show": "نمایش",
|
||||||
"contacts.ignore": "نادیده گرفتن",
|
"contacts.ignore": "نادیده گرفتن",
|
||||||
"contacts.unignore": "لغو نادیده گرفتن",
|
"contacts.unignore": "لغو نادیده گرفتن",
|
||||||
@@ -695,6 +711,7 @@
|
|||||||
"sounds.event.mute": "تغییر حالت بیصدا",
|
"sounds.event.mute": "تغییر حالت بیصدا",
|
||||||
"sounds.event.micClickOn": "کلیک میکروفون روشن",
|
"sounds.event.micClickOn": "کلیک میکروفون روشن",
|
||||||
"sounds.event.micClickOff": "کلیک میکروفون خاموش",
|
"sounds.event.micClickOff": "کلیک میکروفون خاموش",
|
||||||
|
"sounds.event.whisper": "نجوا دریافت شد",
|
||||||
"sounds.default": "پیشفرض",
|
"sounds.default": "پیشفرض",
|
||||||
"sounds.custom": "فایل سفارشی: {name}",
|
"sounds.custom": "فایل سفارشی: {name}",
|
||||||
"sounds.test": "▶ آزمایش",
|
"sounds.test": "▶ آزمایش",
|
||||||
|
|||||||
@@ -104,6 +104,18 @@
|
|||||||
"whisperHistory.title": "悄悄话历史 - {server}",
|
"whisperHistory.title": "悄悄话历史 - {server}",
|
||||||
"whisperHistory.empty": "暂无悄悄话历史。",
|
"whisperHistory.empty": "暂无悄悄话历史。",
|
||||||
"whisperHistory.started": "正在向以下目标发送悄悄话:{targets}",
|
"whisperHistory.started": "正在向以下目标发送悄悄话:{targets}",
|
||||||
|
"whisperSettings.subtitle": "悄悄话设置",
|
||||||
|
"whisperSettings.rights": "传入悄悄话权限",
|
||||||
|
"whisperSettings.mode.allow": "使用联系人单独设置,否则允许",
|
||||||
|
"whisperSettings.mode.block": "使用联系人单独设置,否则禁止",
|
||||||
|
"whisperSettings.mode.blockAll": "全部禁止",
|
||||||
|
"whisperSettings.incoming": "传入悄悄话设置",
|
||||||
|
"whisperSettings.sound": "有人对你悄悄话时播放声音",
|
||||||
|
"whisperSettings.openHistory": "有人对你悄悄话时总是打开悄悄话记录",
|
||||||
|
"whisperSettings.clearAfter": "从悄悄话记录中移除客户端的时间",
|
||||||
|
"whisperSettings.never": "从不",
|
||||||
|
"whisperSettings.minutes": "{count} 分钟",
|
||||||
|
"whisperHistory.received": "{name} 对你说了悄悄话",
|
||||||
"whisperHistory.stopped": "已停止悄悄话",
|
"whisperHistory.stopped": "已停止悄悄话",
|
||||||
"whisperHistory.clear": "清除",
|
"whisperHistory.clear": "清除",
|
||||||
"whisperHistory.options": "选项",
|
"whisperHistory.options": "选项",
|
||||||
@@ -180,6 +192,10 @@
|
|||||||
"contacts.category.blocked": "已屏蔽",
|
"contacts.category.blocked": "已屏蔽",
|
||||||
"contacts.category.friend": "好友",
|
"contacts.category.friend": "好友",
|
||||||
"contacts.phoneticName": "名称读音:",
|
"contacts.phoneticName": "名称读音:",
|
||||||
|
"contacts.whisperSetting": "悄悄话:",
|
||||||
|
"contacts.whisperSetting.default": "默认",
|
||||||
|
"contacts.whisperSetting.allow": "允许",
|
||||||
|
"contacts.whisperSetting.block": "禁止",
|
||||||
"contacts.show": "显示",
|
"contacts.show": "显示",
|
||||||
"contacts.ignore": "忽略",
|
"contacts.ignore": "忽略",
|
||||||
"contacts.unignore": "取消忽略",
|
"contacts.unignore": "取消忽略",
|
||||||
@@ -541,6 +557,7 @@
|
|||||||
"sounds.event.mute": "切换静音",
|
"sounds.event.mute": "切换静音",
|
||||||
"sounds.event.micClickOn": "麦克风开启提示音",
|
"sounds.event.micClickOn": "麦克风开启提示音",
|
||||||
"sounds.event.micClickOff": "麦克风关闭提示音",
|
"sounds.event.micClickOff": "麦克风关闭提示音",
|
||||||
|
"sounds.event.whisper": "收到悄悄话",
|
||||||
"sounds.default": "默认",
|
"sounds.default": "默认",
|
||||||
"sounds.custom": "自定义文件:{name}",
|
"sounds.custom": "自定义文件:{name}",
|
||||||
"sounds.test": "▶ 测试",
|
"sounds.test": "▶ 测试",
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ const EVENT_KEYWORDS: Record<SoundEventId, string[]> = {
|
|||||||
mute: ["micmuted", "microphonemuted", "micactivated", "microphoneactivated"],
|
mute: ["micmuted", "microphonemuted", "micactivated", "microphoneactivated"],
|
||||||
micClickOn: ["micclickon"],
|
micClickOn: ["micclickon"],
|
||||||
micClickOff: ["micclickoff"],
|
micClickOff: ["micclickoff"],
|
||||||
|
whisper: ["whisperreceived", "whisper"],
|
||||||
};
|
};
|
||||||
|
|
||||||
function normalize(filename: string): string {
|
function normalize(filename: string): string {
|
||||||
|
|||||||
+10
-1
@@ -7,7 +7,8 @@ export type SoundEventId =
|
|||||||
| "poke"
|
| "poke"
|
||||||
| "mute"
|
| "mute"
|
||||||
| "micClickOn"
|
| "micClickOn"
|
||||||
| "micClickOff";
|
| "micClickOff"
|
||||||
|
| "whisper";
|
||||||
|
|
||||||
export const SOUND_EVENTS: SoundEventId[] = [
|
export const SOUND_EVENTS: SoundEventId[] = [
|
||||||
"connect",
|
"connect",
|
||||||
@@ -19,6 +20,7 @@ export const SOUND_EVENTS: SoundEventId[] = [
|
|||||||
"mute",
|
"mute",
|
||||||
"micClickOn",
|
"micClickOn",
|
||||||
"micClickOff",
|
"micClickOff",
|
||||||
|
"whisper",
|
||||||
];
|
];
|
||||||
|
|
||||||
/** "ide" swaps the default chimes for synthetic terminal blips (Command Center layout). */
|
/** "ide" swaps the default chimes for synthetic terminal blips (Command Center layout). */
|
||||||
@@ -238,6 +240,11 @@ function synthNotes(event: SoundEventId): SynthNote[] {
|
|||||||
return [{ delay: 0, freq: 1400, duration: 0.03, gain: 0.15 }];
|
return [{ delay: 0, freq: 1400, duration: 0.03, gain: 0.15 }];
|
||||||
case "micClickOff":
|
case "micClickOff":
|
||||||
return [{ delay: 0, freq: 900, duration: 0.03, gain: 0.15 }];
|
return [{ delay: 0, freq: 900, duration: 0.03, gain: 0.15 }];
|
||||||
|
case "whisper":
|
||||||
|
return [
|
||||||
|
{ delay: 0, freq: 783.99, duration: 0.12, gain: 0.2 },
|
||||||
|
{ delay: 0.1, freq: 659.25, duration: 0.16, gain: 0.18 },
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,6 +281,8 @@ function ideNotes(event: SoundEventId): SynthNote[] {
|
|||||||
return [{ delay: 0, freq: 1600, duration: 0.02, gain: 0.08, type: "square" }];
|
return [{ delay: 0, freq: 1600, duration: 0.02, gain: 0.08, type: "square" }];
|
||||||
case "micClickOff":
|
case "micClickOff":
|
||||||
return [{ delay: 0, freq: 1000, duration: 0.02, gain: 0.08, type: "square" }];
|
return [{ delay: 0, freq: 1000, duration: 0.02, gain: 0.08, type: "square" }];
|
||||||
|
case "whisper":
|
||||||
|
return [{ delay: 0, freq: 900, endFreq: 700, duration: 0.08, gain: 0.1, type: "triangle" }];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user