mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-10 15:13:02 -04:00
This Is Actually Stupid But Works
This commit is contained in:
parent
89ba89b65f
commit
e58149d55e
1 changed files with 27 additions and 15 deletions
|
@ -39,25 +39,36 @@ interface VoiceState {
|
||||||
|
|
||||||
const VoiceStateStore = findByPropsLazy("getVoiceStatesForChannel", "getCurrentClientVoiceChannelId");
|
const VoiceStateStore = findByPropsLazy("getVoiceStatesForChannel", "getCurrentClientVoiceChannelId");
|
||||||
|
|
||||||
|
function getVoices(): Promise<SpeechSynthesisVoice[]> {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
let voices: SpeechSynthesisVoice[] = window.speechSynthesis.getVoices();
|
||||||
|
if (voices.length) {
|
||||||
|
resolve(voices);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.speechSynthesis.onvoiceschanged = () => {
|
||||||
|
voices = window.speechSynthesis.getVoices();
|
||||||
|
resolve(voices);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getVoices().then(resolvedVoices => {
|
||||||
|
const voiceList = resolvedVoices.map(v => ({
|
||||||
|
label: v.name,
|
||||||
|
value: v.voiceURI,
|
||||||
|
default: v.default
|
||||||
|
}));
|
||||||
|
// @ts-ignore
|
||||||
|
settings.def.voice.options.push(...voiceList);
|
||||||
|
console.log(voiceList);
|
||||||
|
});
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
voice: {
|
voice: {
|
||||||
type: OptionType.SELECT,
|
type: OptionType.SELECT,
|
||||||
description: "Narrator Voice",
|
description: "Narrator Voice",
|
||||||
options: [
|
options: [],
|
||||||
{
|
|
||||||
label: "Microsoft David - English (United States)",
|
|
||||||
value: "Microsoft David - English (United States)",
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Microsoft Mark - English (United States)",
|
|
||||||
value: "Microsoft Mark - English (United States)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Microsoft Zira - English (United States)",
|
|
||||||
value: "Microsoft Zira - English (United States)"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
volume: {
|
volume: {
|
||||||
type: OptionType.SLIDER,
|
type: OptionType.SLIDER,
|
||||||
|
@ -245,6 +256,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
console.log(settings.store.voice);
|
||||||
if (typeof speechSynthesis === "undefined" || speechSynthesis.getVoices().length === 0) {
|
if (typeof speechSynthesis === "undefined" || speechSynthesis.getVoices().length === 0) {
|
||||||
new Logger("VcNarrator").warn(
|
new Logger("VcNarrator").warn(
|
||||||
"SpeechSynthesis not supported or no Narrator voices found. Thus, this plugin will not work. Check my Settings for more info"
|
"SpeechSynthesis not supported or no Narrator voices found. Thus, this plugin will not work. Check my Settings for more info"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue