@vnejs/bridge.plugins.text.plugins.audio.voice 0.0.0-stage → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/modules/bridge_plugin_text_plugin_voice.d.ts +23 -0
- package/dist/modules/bridge_plugin_text_plugin_voice.js +58 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.js +1 -0
- package/dist/utils/voice.d.ts +1 -0
- package/dist/utils/voice.js +1 -0
- package/package.json +45 -4
- package/src/index.ts +10 -0
- package/src/modules/bridge_plugin_text_plugin_voice.ts +86 -0
- package/src/tests/audio.voice.test.ts +36 -0
- package/src/tests/setup.ts +35 -0
- package/src/types.ts +15 -0
- package/src/utils/voice.ts +1 -0
- package/tsconfig.json +9 -0
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "@vnejs/contracts.audio";
|
|
2
|
+
import "@vnejs/contracts.audio.voice";
|
|
3
|
+
import "@vnejs/contracts.text";
|
|
4
|
+
import { PLUGIN_NAME } from "@vnejs/contracts.bridge.plugins.text.plugins.audio.voice";
|
|
5
|
+
import { regPlugin } from "@vnejs/registry";
|
|
6
|
+
import { BridgePluginTextPluginVoice } from "./modules/bridge_plugin_text_plugin_voice.js";
|
|
7
|
+
regPlugin(PLUGIN_NAME, {}, [BridgePluginTextPluginVoice]);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ModuleCore, type LineLoadHandlerArg, type SettingsChangedResult } from "@vnejs/module.core";
|
|
2
|
+
import type { TextEmitPayload } from "@vnejs/contracts.text";
|
|
3
|
+
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
|
|
4
|
+
type CompatState = {
|
|
5
|
+
currentName: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class BridgePluginTextPluginVoice extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams, CompatState> {
|
|
8
|
+
name: string;
|
|
9
|
+
subscribe: () => void;
|
|
10
|
+
init: () => Promise<import("@vnejs/registry").EmitResults<"vne:scenario:line_load_reg">> | undefined;
|
|
11
|
+
onLineLoad: ({ args, priority }?: LineLoadHandlerArg) => Promise<import("@vnejs/registry").EmitResults<"vne:audio:media_load">> | undefined;
|
|
12
|
+
onTextEmit: (payload?: TextEmitPayload) => Promise<void>;
|
|
13
|
+
onInteractStarted: () => Promise<void>;
|
|
14
|
+
onSettingsChanged: ({ name }: SettingsChangedResult) => false | Promise<void>;
|
|
15
|
+
onStateClear: () => Promise<void>;
|
|
16
|
+
onTextEmitBefore: () => Promise<void>;
|
|
17
|
+
getDefaultState: () => CompatState;
|
|
18
|
+
stopVoice: () => Promise<void>;
|
|
19
|
+
getVoiceFromPayload: ({ args, isExtend, texts }?: TextEmitPayload) => string | undefined;
|
|
20
|
+
getVoiceArg: (args?: Record<string, unknown>) => string | undefined;
|
|
21
|
+
getVoiceVolume: () => number;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
2
|
+
import { SETTINGS_KEYS as VOICE_SETTINGS_KEYS } from "@vnejs/contracts.audio.voice";
|
|
3
|
+
import { resolveVoicePath } from "../utils/voice.js";
|
|
4
|
+
export class BridgePluginTextPluginVoice extends ModuleCore {
|
|
5
|
+
name = "bridge_plugin_text_plugin_voice";
|
|
6
|
+
subscribe = () => {
|
|
7
|
+
this.on(this.EVENTS.TEXT.EMIT, this.onTextEmit);
|
|
8
|
+
this.on(this.EVENTS.INTERACT.STARTED, this.onInteractStarted);
|
|
9
|
+
this.on(this.EVENTS.SETTINGS.CHANGED, this.onSettingsChanged);
|
|
10
|
+
this.on(this.EVENTS.STATE.CLEAR, this.onStateClear);
|
|
11
|
+
this.on(this.EVENTS.TEXT.EMIT, this.onTextEmitBefore, { priority: this.CONST.TEXT.EMIT_PRIORITY.BEFORE });
|
|
12
|
+
};
|
|
13
|
+
init = () => this.emit(this.EVENTS.SCENARIO.LINE_LOAD_REG, { module: this.CONST.SCENARIO.OTHER_MODULE, handler: this.onLineLoad });
|
|
14
|
+
onLineLoad = ({ args = {}, priority = this.CONST.MEDIA.PRIORITIES.BACKGROUND } = {}) => {
|
|
15
|
+
const voice = this.getVoiceArg(args);
|
|
16
|
+
if (!voice || this.shared.voiceDisableSources.isNotEmpty())
|
|
17
|
+
return;
|
|
18
|
+
const name = resolveVoicePath(voice, this.shared.voiceLang);
|
|
19
|
+
return this.emit(this.EVENTS.AUDIO.MEDIA_LOAD, { layer: this.CONST.VOICE.LAYER, name, priority });
|
|
20
|
+
};
|
|
21
|
+
onTextEmit = async (payload = {}) => {
|
|
22
|
+
await this.stopVoice();
|
|
23
|
+
const voice = this.getVoiceFromPayload(payload);
|
|
24
|
+
if (!voice || this.shared.voiceDisableSources.isNotEmpty())
|
|
25
|
+
return;
|
|
26
|
+
const name = resolveVoicePath(voice, this.shared.voiceLang);
|
|
27
|
+
this.state.currentName = name;
|
|
28
|
+
await this.emit(this.EVENTS.AUDIO.PLAY, {
|
|
29
|
+
layer: this.CONST.VOICE.LAYER,
|
|
30
|
+
name,
|
|
31
|
+
volume: this.getVoiceVolume(),
|
|
32
|
+
isLoop: false,
|
|
33
|
+
startDuration: 0,
|
|
34
|
+
finishDuration: 0,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
onInteractStarted = () => this.stopVoice();
|
|
38
|
+
onSettingsChanged = ({ name }) => name === VOICE_SETTINGS_KEYS.LANG && this.stopVoice();
|
|
39
|
+
onStateClear = () => this.stopVoice();
|
|
40
|
+
onTextEmitBefore = () => this.stopVoice();
|
|
41
|
+
getDefaultState = () => ({ currentName: "" });
|
|
42
|
+
stopVoice = async () => {
|
|
43
|
+
const { currentName } = this.state;
|
|
44
|
+
if (!currentName)
|
|
45
|
+
return;
|
|
46
|
+
await this.emit(this.EVENTS.AUDIO.STOP, { layer: this.CONST.VOICE.LAYER, name: currentName, duration: 0 });
|
|
47
|
+
this.state.currentName = "";
|
|
48
|
+
};
|
|
49
|
+
getVoiceFromPayload = ({ args = {}, isExtend = false, texts = [] } = {}) => {
|
|
50
|
+
const lineArgs = isExtend && texts.length ? (texts[texts.length - 1]?.args ?? {}) : args;
|
|
51
|
+
return this.getVoiceArg(lineArgs);
|
|
52
|
+
};
|
|
53
|
+
getVoiceArg = (args = {}) => {
|
|
54
|
+
const voice = args.voice;
|
|
55
|
+
return typeof voice === "string" && voice ? voice : undefined;
|
|
56
|
+
};
|
|
57
|
+
getVoiceVolume = () => this.shared.settings[VOICE_SETTINGS_KEYS.VOLUME] ?? 100;
|
|
58
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
|
|
2
|
+
import type { Constants as AudioConstants, PluginName as AudioPluginName, SubscribeEvents as AudioSubscribeEvents } from "@vnejs/contracts.audio";
|
|
3
|
+
import type { Constants as VoiceConstants, PluginName as VoicePluginName } from "@vnejs/contracts.audio.voice";
|
|
4
|
+
import type { Constants as TextConstants, PluginName as TextPluginName, SubscribeEvents as TextSubscribeEvents } from "@vnejs/contracts.text";
|
|
5
|
+
export type PluginEvents = ModuleCoreEvents & Record<TextPluginName, TextSubscribeEvents> & Record<AudioPluginName, AudioSubscribeEvents>;
|
|
6
|
+
export type PluginConstants = ModuleCoreConstants & Record<TextPluginName, TextConstants> & Record<AudioPluginName, AudioConstants> & Record<VoicePluginName, VoiceConstants>;
|
|
7
|
+
export type PluginSettings = ModuleCoreSettings;
|
|
8
|
+
export type PluginParams = ModuleCoreParams;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resolveVoicePath: (voice: string, voiceLang: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const resolveVoicePath = (voice, voiceLang) => `${voiceLang}/${voice}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/bridge.plugins.text.plugins.audio.voice",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.8",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src",
|
|
18
|
+
"tsconfig.json"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "npx @vnejs/monorepo test",
|
|
22
|
+
"build": "npx @vnejs/monorepo package",
|
|
23
|
+
"publish:major:plugin": "npm run publish:major",
|
|
24
|
+
"publish:minor:plugin": "npm run publish:minor",
|
|
25
|
+
"publish:patch:plugin": "npm run publish:patch",
|
|
26
|
+
"publish:major": "npx @vnejs/monorepo publish major --access public",
|
|
27
|
+
"publish:minor": "npx @vnejs/monorepo publish minor --access public",
|
|
28
|
+
"publish:patch": "npx @vnejs/monorepo publish patch --access public"
|
|
29
|
+
},
|
|
30
|
+
"author": "",
|
|
31
|
+
"license": "ISC",
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@vnejs/contracts.audio": "~0.2.0",
|
|
34
|
+
"@vnejs/contracts.audio.voice": "~0.2.0",
|
|
35
|
+
"@vnejs/contracts.text": "~0.2.0",
|
|
36
|
+
"@vnejs/module.core": "~0.2.0",
|
|
37
|
+
"@vnejs/registry": "~0.2.0",
|
|
38
|
+
"@vnejs/contracts.bridge.plugins.text.plugins.audio.voice": "~0.2.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@vnejs/configs.ts-common": "~0.2.0",
|
|
42
|
+
"@vnejs/configs.vitest": "~0.2.0",
|
|
43
|
+
"@vnejs/test-utils": "~0.2.0",
|
|
44
|
+
"@vnejs/sources-set": "~0.2.0",
|
|
45
|
+
"@vnejs/contracts.bridge.plugins.text.plugins.audio.voice": "~0.2.0"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "@vnejs/contracts.audio";
|
|
2
|
+
import "@vnejs/contracts.audio.voice";
|
|
3
|
+
import "@vnejs/contracts.text";
|
|
4
|
+
|
|
5
|
+
import { PLUGIN_NAME } from "@vnejs/contracts.bridge.plugins.text.plugins.audio.voice";
|
|
6
|
+
import { regPlugin } from "@vnejs/registry";
|
|
7
|
+
|
|
8
|
+
import { BridgePluginTextPluginVoice } from "./modules/bridge_plugin_text_plugin_voice.js";
|
|
9
|
+
|
|
10
|
+
regPlugin(PLUGIN_NAME, {}, [BridgePluginTextPluginVoice]);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ModuleCore, type LineLoadHandlerArg, type SettingsChangedResult } from "@vnejs/module.core";
|
|
2
|
+
import type { TextEmitPayload } from "@vnejs/contracts.text";
|
|
3
|
+
import { SETTINGS_KEYS as VOICE_SETTINGS_KEYS } from "@vnejs/contracts.audio.voice";
|
|
4
|
+
|
|
5
|
+
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
|
|
6
|
+
import { resolveVoicePath } from "../utils/voice.js";
|
|
7
|
+
|
|
8
|
+
type CompatState = {
|
|
9
|
+
currentName: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export class BridgePluginTextPluginVoice extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams, CompatState> {
|
|
13
|
+
name = "bridge_plugin_text_plugin_voice";
|
|
14
|
+
|
|
15
|
+
subscribe = () => {
|
|
16
|
+
this.on(this.EVENTS.TEXT.EMIT, this.onTextEmit);
|
|
17
|
+
this.on(this.EVENTS.INTERACT.STARTED, this.onInteractStarted);
|
|
18
|
+
this.on(this.EVENTS.SETTINGS.CHANGED, this.onSettingsChanged);
|
|
19
|
+
this.on(this.EVENTS.STATE.CLEAR, this.onStateClear);
|
|
20
|
+
this.on(this.EVENTS.TEXT.EMIT, this.onTextEmitBefore, { priority: this.CONST.TEXT.EMIT_PRIORITY.BEFORE });
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
init = () => this.emit(this.EVENTS.SCENARIO.LINE_LOAD_REG, { module: this.CONST.SCENARIO.OTHER_MODULE, handler: this.onLineLoad });
|
|
24
|
+
|
|
25
|
+
onLineLoad = ({ args = {}, priority = this.CONST.MEDIA.PRIORITIES.BACKGROUND }: LineLoadHandlerArg = {}) => {
|
|
26
|
+
const voice = this.getVoiceArg(args);
|
|
27
|
+
|
|
28
|
+
if (!voice || this.shared.voiceDisableSources.isNotEmpty()) return;
|
|
29
|
+
|
|
30
|
+
const name = resolveVoicePath(voice, this.shared.voiceLang);
|
|
31
|
+
|
|
32
|
+
return this.emit(this.EVENTS.AUDIO.MEDIA_LOAD, { layer: this.CONST.VOICE.LAYER, name, priority });
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
onTextEmit = async (payload: TextEmitPayload = {}) => {
|
|
36
|
+
await this.stopVoice();
|
|
37
|
+
|
|
38
|
+
const voice = this.getVoiceFromPayload(payload);
|
|
39
|
+
|
|
40
|
+
if (!voice || this.shared.voiceDisableSources.isNotEmpty()) return;
|
|
41
|
+
|
|
42
|
+
const name = resolveVoicePath(voice, this.shared.voiceLang);
|
|
43
|
+
|
|
44
|
+
this.state.currentName = name;
|
|
45
|
+
|
|
46
|
+
await this.emit(this.EVENTS.AUDIO.PLAY, {
|
|
47
|
+
layer: this.CONST.VOICE.LAYER,
|
|
48
|
+
name,
|
|
49
|
+
volume: this.getVoiceVolume(),
|
|
50
|
+
isLoop: false,
|
|
51
|
+
startDuration: 0,
|
|
52
|
+
finishDuration: 0,
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
onInteractStarted = () => this.stopVoice();
|
|
57
|
+
|
|
58
|
+
onSettingsChanged = ({ name }: SettingsChangedResult) => name === VOICE_SETTINGS_KEYS.LANG && this.stopVoice();
|
|
59
|
+
|
|
60
|
+
onStateClear = () => this.stopVoice();
|
|
61
|
+
|
|
62
|
+
onTextEmitBefore = () => this.stopVoice();
|
|
63
|
+
|
|
64
|
+
getDefaultState = (): CompatState => ({ currentName: "" });
|
|
65
|
+
|
|
66
|
+
stopVoice = async () => {
|
|
67
|
+
const { currentName } = this.state;
|
|
68
|
+
|
|
69
|
+
if (!currentName) return;
|
|
70
|
+
|
|
71
|
+
await this.emit(this.EVENTS.AUDIO.STOP, { layer: this.CONST.VOICE.LAYER, name: currentName, duration: 0 });
|
|
72
|
+
|
|
73
|
+
this.state.currentName = "";
|
|
74
|
+
};
|
|
75
|
+
getVoiceFromPayload = ({ args = {}, isExtend = false, texts = [] }: TextEmitPayload = {}) => {
|
|
76
|
+
const lineArgs = isExtend && texts.length ? (texts[texts.length - 1]?.args ?? {}) : args;
|
|
77
|
+
|
|
78
|
+
return this.getVoiceArg(lineArgs);
|
|
79
|
+
};
|
|
80
|
+
getVoiceArg = (args: Record<string, unknown> = {}) => {
|
|
81
|
+
const voice = args.voice;
|
|
82
|
+
|
|
83
|
+
return typeof voice === "string" && voice ? voice : undefined;
|
|
84
|
+
};
|
|
85
|
+
getVoiceVolume = () => (this.shared.settings[VOICE_SETTINGS_KEYS.VOLUME] as number | undefined) ?? 100;
|
|
86
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { spyEvent } from "@vnejs/test-utils";
|
|
4
|
+
|
|
5
|
+
import { SourcesSet } from "@vnejs/sources-set";
|
|
6
|
+
|
|
7
|
+
import { BridgePluginTextPluginVoice } from "../modules/bridge_plugin_text_plugin_voice.js";
|
|
8
|
+
import { AUDIO_EVENTS, createCompatibilityTestModule, registerCompatibilityVne, TEXT_EVENTS, VOICE_CONST } from "./setup.js";
|
|
9
|
+
|
|
10
|
+
describe("BridgePluginTextPluginVoice", () => {
|
|
11
|
+
beforeEach(() => registerCompatibilityVne());
|
|
12
|
+
|
|
13
|
+
it("TEXT.EMIT with voice plays on voice layer", async () => {
|
|
14
|
+
const { observer } = createCompatibilityTestModule(BridgePluginTextPluginVoice);
|
|
15
|
+
const play = spyEvent(observer, AUDIO_EVENTS.PLAY);
|
|
16
|
+
|
|
17
|
+
await observer.emit(TEXT_EVENTS.EMIT, { args: { voice: "line1" } });
|
|
18
|
+
|
|
19
|
+
expect(play).toHaveBeenCalledOnce();
|
|
20
|
+
expect(play.mock.calls[0]?.[0]).toMatchObject({ layer: VOICE_CONST.LAYER, name: "en/line1" });
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("TEXT.EMIT skips play when voice disable sources are active", async () => {
|
|
24
|
+
const disableSources = new SourcesSet();
|
|
25
|
+
disableSources.set("blocker", true);
|
|
26
|
+
|
|
27
|
+
const { observer } = createCompatibilityTestModule(BridgePluginTextPluginVoice, {
|
|
28
|
+
shared: { voiceDisableSources: disableSources },
|
|
29
|
+
});
|
|
30
|
+
const play = spyEvent(observer, AUDIO_EVENTS.PLAY);
|
|
31
|
+
|
|
32
|
+
await observer.emit(TEXT_EVENTS.EMIT, { args: { voice: "line1" } });
|
|
33
|
+
|
|
34
|
+
expect(play).not.toHaveBeenCalled();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SUBSCRIBE_EVENTS as AUDIO_EVENTS, PLUGIN_NAME as AUDIO } from "@vnejs/contracts.audio";
|
|
2
|
+
import { CONSTANTS as VOICE_CONST, PARAMS as VOICE_PARAMS, PLUGIN_NAME as VOICE, SETTINGS_KEYS as VOICE_SETTINGS } from "@vnejs/contracts.audio.voice";
|
|
3
|
+
import {
|
|
4
|
+
CONSTANTS as TEXT_CONST,
|
|
5
|
+
PARAMS as TEXT_PARAMS,
|
|
6
|
+
PLUGIN_NAME as TEXT,
|
|
7
|
+
SETTINGS_KEYS as TEXT_SETTINGS,
|
|
8
|
+
SUBSCRIBE_EVENTS as TEXT_EVENTS,
|
|
9
|
+
} from "@vnejs/contracts.text";
|
|
10
|
+
import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin } from "@vnejs/test-utils";
|
|
11
|
+
import { SourcesSet } from "@vnejs/sources-set";
|
|
12
|
+
|
|
13
|
+
export const registerCompatibilityVne = () => {
|
|
14
|
+
registerCoreVne();
|
|
15
|
+
registerVnePlugin(TEXT, { constants: TEXT_CONST, events: TEXT_EVENTS, params: TEXT_PARAMS, settings: TEXT_SETTINGS });
|
|
16
|
+
registerVnePlugin(AUDIO, { events: AUDIO_EVENTS });
|
|
17
|
+
registerVnePlugin(VOICE, { constants: VOICE_CONST, params: VOICE_PARAMS, settings: VOICE_SETTINGS });
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const createCompatibilityTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
|
|
21
|
+
ModuleClass: T,
|
|
22
|
+
options: Parameters<typeof baseCreateTestModule>[1] = {},
|
|
23
|
+
) =>
|
|
24
|
+
baseCreateTestModule(ModuleClass, {
|
|
25
|
+
state: { currentName: "" },
|
|
26
|
+
shared: {
|
|
27
|
+
settings: { [VOICE_SETTINGS.VOLUME]: 100, [VOICE_SETTINGS.LANG]: "en" },
|
|
28
|
+
voiceLang: "en",
|
|
29
|
+
voiceDisableSources: new SourcesSet(),
|
|
30
|
+
...(options.shared ?? {}),
|
|
31
|
+
},
|
|
32
|
+
...options,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export { AUDIO_EVENTS, TEXT_EVENTS, VOICE_CONST };
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
|
|
2
|
+
import type { Constants as AudioConstants, PluginName as AudioPluginName, SubscribeEvents as AudioSubscribeEvents } from "@vnejs/contracts.audio";
|
|
3
|
+
import type { Constants as VoiceConstants, PluginName as VoicePluginName } from "@vnejs/contracts.audio.voice";
|
|
4
|
+
import type { Constants as TextConstants, PluginName as TextPluginName, SubscribeEvents as TextSubscribeEvents } from "@vnejs/contracts.text";
|
|
5
|
+
|
|
6
|
+
export type PluginEvents = ModuleCoreEvents & Record<TextPluginName, TextSubscribeEvents> & Record<AudioPluginName, AudioSubscribeEvents>;
|
|
7
|
+
|
|
8
|
+
export type PluginConstants = ModuleCoreConstants &
|
|
9
|
+
Record<TextPluginName, TextConstants> &
|
|
10
|
+
Record<AudioPluginName, AudioConstants> &
|
|
11
|
+
Record<VoicePluginName, VoiceConstants>;
|
|
12
|
+
|
|
13
|
+
export type PluginSettings = ModuleCoreSettings;
|
|
14
|
+
|
|
15
|
+
export type PluginParams = ModuleCoreParams;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const resolveVoicePath = (voice: string, voiceLang: string) => `${voiceLang}/${voice}`;
|
package/tsconfig.json
ADDED
package/README.md
DELETED