Commit 703c7560 authored by martin hou's avatar martin hou

fix: 调整实时消息指令,适配新固件

parent 068f3c3a
...@@ -307,7 +307,7 @@ declare class Jensen { ...@@ -307,7 +307,7 @@ declare class Jensen {
stopRealtime: (seconds?: number) => Promise<ReturnStruct['common']>; stopRealtime: (seconds?: number) => Promise<ReturnStruct['common']>;
// 获取实时音频流数据 // 获取实时音频流数据
getRealtime: (frames: number, seconds?: number) => Promise<{ data: Uint8Array | null; rest: number, muted: boolean }>; getRealtime: (seconds?: number) => Promise<{ data: Uint8Array | null; rest: number, muted: boolean }>;
// 录音文件随机读取,从指定位置起读取指定数量个字节 // 录音文件随机读取,从指定位置起读取指定数量个字节
readFile: (fname: string, offset: number, length: number) => Promise<Uint8Array>; readFile: (fname: string, offset: number, length: number) => Promise<Uint8Array>;
......
...@@ -538,7 +538,7 @@ export function Home() { ...@@ -538,7 +538,7 @@ export function Home() {
const scheduleLiveTick = async () => { const scheduleLiveTick = async () => {
let jensen = getJensen(); let jensen = getJensen();
if (jensen == null) return; if (jensen == null) return;
let live = await jensen.getRealtime(1, 1); let live = await jensen.getRealtime(1);
// 若无数据直接调度下一次 // 若无数据直接调度下一次
if (live?.data == null) return; if (live?.data == null) return;
setLiveStates('live: ' + live.data.length + ' rest: ' + live.rest + ' muted: ' + live.muted + ' == ' + muteRef.current); setLiveStates('live: ' + live.data.length + ' rest: ' + live.rest + ' muted: ' + live.muted + ' == ' + muteRef.current);
......
...@@ -1356,12 +1356,8 @@ Jensen.prototype.pauseRealtime = async function (seconds) { ...@@ -1356,12 +1356,8 @@ Jensen.prototype.pauseRealtime = async function (seconds) {
Jensen.prototype.stopRealtime = async function (seconds) { Jensen.prototype.stopRealtime = async function (seconds) {
return this.send(new Command(REALTIME_CONTROL).body([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), seconds); return this.send(new Command(REALTIME_CONTROL).body([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), seconds);
}; };
Jensen.prototype.getRealtime = async function (frames, seconds) { Jensen.prototype.getRealtime = async function (seconds) {
let a = (frames >> 24) & 0xff; return this.send(new Command(REALTIME_TRANSFER), seconds);
let b = (frames >> 16) & 0xff;
let c = (frames >> 8) & 0xff;
let d = (frames >> 0) & 0xff;
return this.send(new Command(REALTIME_TRANSFER).body([a, b, c, d]), seconds);
}; };
Jensen.prototype.requestToneUpdate = async function(signature, size, seconds) { Jensen.prototype.requestToneUpdate = async function(signature, size, seconds) {
let data = []; let data = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment