|
@@ -28,6 +28,7 @@ import {
|
|
|
addSocketStatus,
|
|
|
removeSocketStatus,
|
|
|
api_disconnectSocket,
|
|
|
+ api_midiMicDelay,
|
|
|
} from "/src/helpers/communication";
|
|
|
import state, {
|
|
|
IPlayState,
|
|
@@ -40,7 +41,7 @@ import state, {
|
|
|
import { IPostMessage } from "/src/utils/native-message";
|
|
|
import { usePageVisibility } from "@vant/use";
|
|
|
import { browser } from "/src/utils";
|
|
|
-import { getAudioCurrentTime, toggleMutePlayAudio } from "../audio-list";
|
|
|
+import { getAudioCurrentTime, toggleMutePlayAudio, audioListStart } from "../audio-list";
|
|
|
import { handleStartTick, tickData } from "../tick";
|
|
|
import AbnormalPop from "../abnormal-pop";
|
|
|
import { storeData } from "../../store";
|
|
@@ -102,6 +103,20 @@ export const evaluatingData = reactive({
|
|
|
isAudioPlayEnd: false,
|
|
|
});
|
|
|
|
|
|
+const sendOffsetTime = async (offsetTime: number) => {
|
|
|
+ const delayData = await api_getDeviceDelay();
|
|
|
+ api_midiMicDelay({
|
|
|
+ header: {
|
|
|
+ commond: 'audioPlayStart',
|
|
|
+ type: 'SOUND_COMPARE',
|
|
|
+ },
|
|
|
+ body: {
|
|
|
+ offsetTime,
|
|
|
+ micDelay: delayData?.content?.value
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
/** 点击开始评测按钮 */
|
|
|
export const handleStartEvaluat = async () => {
|
|
|
if (state.modeType === "evaluating") {
|
|
@@ -348,11 +363,17 @@ export const handleStartBegin = async (preTimes?: number) => {
|
|
|
accompanimentState: state.setting.enableAccompaniment ? 1 : 0,
|
|
|
firstNoteTime: preTimes || 0,
|
|
|
});
|
|
|
-
|
|
|
+ if (state.isAppPlay) {
|
|
|
+ sendOffsetTime(0)
|
|
|
+ }
|
|
|
// 如果开启了摄像头, 开启录制视频
|
|
|
if (state.setting.camera) {
|
|
|
console.log("开始录制视频");
|
|
|
- api_startCapture();
|
|
|
+ await api_startCapture();
|
|
|
+ }
|
|
|
+ // 如果是midi音频评测,需要调用cloudPlay
|
|
|
+ if (state.isAppPlay) {
|
|
|
+ audioListStart(state.playState);
|
|
|
}
|
|
|
};
|
|
|
|