소스 검색

只能播放一个音

liushengqiang 2 년 전
부모
커밋
d08b2dc284
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      src/page-instrument/view-figner/index.tsx

+ 3 - 0
src/page-instrument/view-figner/index.tsx

@@ -77,6 +77,9 @@ export default defineComponent({
 			// console.log("🚀 ~ item:", item);
 			const noteAudio = data.soundFonts[item.realKey];
 			if (type === "start") {
+				if (data.realKey) {
+					data.soundFonts[data.realKey].stop();
+				}
 				data.realKey = item.realKey;
 				if (noteAudio) {
 					noteAudio.play();