@mingxy/ocosay 1.1.6 → 1.1.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/core/backends/index.js +1 -1
- package/dist/core/backends/naudiodon-backend.js +8 -0
- package/dist/package.json +2 -2
- package/dist/plugin.js +6330 -6323
- package/package.json +2 -2
|
@@ -79,7 +79,7 @@ export function createBackend(type = BackendType.AUTO, options = {}) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
catch (err) {
|
|
82
|
-
logger.
|
|
82
|
+
logger.error({ err }, 'failed to initialize naudiodon backend');
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
switch (platform) {
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* - v1: new naudiodon({sampleRate, channels, bitDepth})
|
|
7
7
|
* - v2: AudioIO({outOptions: {sampleRate, channelCount, sampleFormat}})
|
|
8
8
|
*/
|
|
9
|
+
import { createModuleLogger } from '../../utils/logger';
|
|
10
|
+
const logger = createModuleLogger('NaudiodonBackend');
|
|
9
11
|
class UnsupportedError extends Error {
|
|
10
12
|
constructor(message) {
|
|
11
13
|
super(message);
|
|
@@ -35,6 +37,7 @@ export class NaudiodonBackend {
|
|
|
35
37
|
return;
|
|
36
38
|
try {
|
|
37
39
|
const naudiodon = require('naudiodon');
|
|
40
|
+
logger.debug('naudiodon loaded, creating AudioIO stream');
|
|
38
41
|
this.audioStream = naudiodon.AudioIO({
|
|
39
42
|
outOptions: {
|
|
40
43
|
sampleRate: this.sampleRate,
|
|
@@ -42,15 +45,20 @@ export class NaudiodonBackend {
|
|
|
42
45
|
sampleFormat: 16
|
|
43
46
|
}
|
|
44
47
|
});
|
|
48
|
+
logger.debug('AudioIO stream created');
|
|
45
49
|
this.audioStream.on('error', (error) => {
|
|
50
|
+
logger.error({ error }, 'AudioIO stream error');
|
|
46
51
|
this.handleError(error);
|
|
47
52
|
});
|
|
53
|
+
logger.debug('calling audioStream.start()');
|
|
48
54
|
this.audioStream.start();
|
|
55
|
+
logger.info('naudiodon backend started successfully');
|
|
49
56
|
this._started = true;
|
|
50
57
|
this._stopped = false;
|
|
51
58
|
this.events?.onStart?.();
|
|
52
59
|
}
|
|
53
60
|
catch (error) {
|
|
61
|
+
logger.error({ error }, 'naudiodon start failed');
|
|
54
62
|
if (error.code === 'MODULE_NOT_FOUND') {
|
|
55
63
|
throw new Error('naudiodon is not installed. Run: npm install naudiodon');
|
|
56
64
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mingxy/ocosay",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "OpenCode TTS 播放插件 - 支持豆包模式边接收边朗读",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/plugin.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"zod": "^4.3.6"
|
|
49
49
|
},
|
|
50
50
|
"optionalDependencies": {
|
|
51
|
-
"naudiodon": "^2.
|
|
51
|
+
"naudiodon": "^2.3.6"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/howler": "^2.2.12",
|