瀏覽代碼

只能播放一个音

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();