Kaynağa Gözat

fix: midi播放状态修改

TIANYONG 1 yıl önce
ebeveyn
işleme
dddca482bd
1 değiştirilmiş dosya ile 6 ekleme ve 6 silme
  1. 6 6
      src/view/audio-list/index.tsx

+ 6 - 6
src/view/audio-list/index.tsx

@@ -27,7 +27,7 @@ export const audioListStart = (type: "play" | "paused") => {
 	if (type === "play" && state.originSpeed !== 0) {
 		setAudioPlaybackRate(state.speed / state.originSpeed);
 	}
-	console.log('api','midi状态1',type,audioData.midiRender)
+	console.log('api','midi状态1',type,state.isAppPlay)
 	// 如果是midi播放
 	if (state.isAppPlay) {
 		// handleTogglePlayMidi(type);
@@ -45,7 +45,7 @@ export const audioListStart = (type: "play" | "paused") => {
 /** 设置倍数播放 */
 export const setAudioPlaybackRate = (rate: number) => {
 	// 如果是midi播放
-	if (audioData.midiRender) {
+	if (state.isAppPlay) {
 		hanldeSetMidiPlaybackRate(rate);
 		return;
 	}
@@ -56,7 +56,7 @@ export const setAudioPlaybackRate = (rate: number) => {
 /** 获取当前播放的时间 */
 export const getAudioCurrentTime = () => {
 	// 如果是midi播放
-	if (audioData.midiRender) {
+	if (state.isAppPlay) {
 		// const c = getMidiCurrentTime();
 		return audioData.progress;
 	}
@@ -69,7 +69,7 @@ export const getAudioCurrentTime = () => {
 /** 获取曲谱的总时间 */
 export const getAudioDuration = () => {
 	// 如果是midi播放
-	if (audioData.midiRender) {
+	if (state.isAppPlay) {
 		// const d = getMidiDuration();
 		const songEndTime = state.times[state.times.length - 1 || 0]?.endtime || 0
 		return audioData.duration || songEndTime;
@@ -81,7 +81,7 @@ export const getAudioDuration = () => {
 export const setAudioCurrentTime = (time: number, index = 0) => {
 	// console.log('开始时间12345',time)
 	// 如果是midi播放
-	if (audioData.midiRender) {
+	if (state.isAppPlay) {
 		setMidiCurrentTime(index);
 		return;
 	}
@@ -117,7 +117,7 @@ export default defineComponent({
 		/** iframe 加载完成后, 加载midiURL */
 		const handleLoad = () => {
 			midiRef.value.contentWindow.handleRendered = () => {
-				audioData.midiRender = true;
+				audioData.midiRender = true
 			};
 			hanldeInitMidiData(midiRef.value);
 		};