mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-02 17:32:50 +08:00
Push-to-talk with custom key/mouse button, Hotkeys options, standalone store
- Push-to-talk: configurable key or middle/side mouse button (tab must be focused), hold button in the toolbar, settings under Capture and the new Options -> Hotkeys page, which also lists the fixed shortcuts. - Design Store rejects uploads whose CSS is already in the store. - gateway/src/store-server.ts runs the store as its own process from the same image, so store deploys don't drop voice connections. 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
803cefd653
commit
603cedd907
11 files changed
+368
-18
No files matched your search
+7
-2
@@ -54,7 +54,8 @@ export interface MicCaptureOptions {
|
||||
*
|
||||
* Uses voice activation (like TeamSpeak's own "Sprachaktivierung"): frames are
|
||||
* only sent while the input level is above `threshold`, plus a short hangover
|
||||
* so the tail of a word isn't cut off. `onActivity` reports transitions so the
|
||||
* so the tail of a word isn't cut off. With `pushToTalk` set, only while
|
||||
* `pttPressed` is. `onActivity` reports transitions so the
|
||||
* UI can show a local "currently transmitting" indicator.
|
||||
*/
|
||||
export class MicCapture {
|
||||
@@ -83,6 +84,9 @@ export class MicCapture {
|
||||
private context: AudioContext;
|
||||
threshold: number;
|
||||
hangoverSeconds: number;
|
||||
/** Push-to-talk: send while `pttPressed` instead of voice activation. */
|
||||
pushToTalk = false;
|
||||
pttPressed = false;
|
||||
|
||||
constructor(context: AudioContext, options: MicCaptureOptions) {
|
||||
this.context = context;
|
||||
@@ -148,8 +152,9 @@ export class MicCapture {
|
||||
|
||||
const now = this.context.currentTime;
|
||||
if (rms >= this.threshold) this.activeUntil = now + this.hangoverSeconds;
|
||||
const talking = this.pushToTalk ? this.pttPressed : now < this.activeUntil;
|
||||
// Shared audio (music, a video) has its own pauses; keep sending throughout.
|
||||
const shouldBeActive = this.extra !== null || now < this.activeUntil;
|
||||
const shouldBeActive = this.extra !== null || talking;
|
||||
if (shouldBeActive !== this.active) {
|
||||
this.active = shouldBeActive;
|
||||
this.onActivity?.(this.active);
|
||||
|
||||
Reference in new issue
Block a user