|
@@ -36,27 +36,34 @@ export function closeTick(){
|
|
tickData.show = false
|
|
tickData.show = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+const tickPlayCb = (i: any, resolve: any, source: any) => {
|
|
|
|
+ if (tickData.tickEnd) {
|
|
|
|
+ resolve(i)
|
|
|
|
+ return
|
|
|
|
+ };
|
|
|
|
+ tickData.index++;
|
|
|
|
+ // 当系统节拍器才播放声音
|
|
|
|
+ if (source && isUseSystemBeat.value) {
|
|
|
|
+ const beatVolume = state.setting.beatVolume / 100
|
|
|
|
+ source.volume = beatVolume;
|
|
|
|
+ if (source.volume <= 0) {
|
|
|
|
+ source.muted = true
|
|
|
|
+ } else {
|
|
|
|
+ source.muted = false
|
|
|
|
+ }
|
|
|
|
+ source.play();
|
|
|
|
+ }
|
|
|
|
+ resolve(i);
|
|
|
|
+}
|
|
const handlePlay = (i: number, source: any | null) => {
|
|
const handlePlay = (i: number, source: any | null) => {
|
|
return new Promise((resolve) => {
|
|
return new Promise((resolve) => {
|
|
- _time=setTimeout(() => {
|
|
|
|
- if (tickData.tickEnd) {
|
|
|
|
- resolve(i)
|
|
|
|
- return
|
|
|
|
- };
|
|
|
|
- tickData.index++;
|
|
|
|
- // 当系统节拍器才播放声音
|
|
|
|
- if (source && isUseSystemBeat.value) {
|
|
|
|
- const beatVolume = state.setting.beatVolume / 100
|
|
|
|
- source.volume = beatVolume;
|
|
|
|
- if (source.volume <= 0) {
|
|
|
|
- source.muted = true
|
|
|
|
- } else {
|
|
|
|
- source.muted = false
|
|
|
|
- }
|
|
|
|
- source.play();
|
|
|
|
- }
|
|
|
|
- resolve(i);
|
|
|
|
- }, tickData.beatLengthInMilliseconds);
|
|
|
|
|
|
+ if (i === 0 ) {
|
|
|
|
+ tickPlayCb(i, resolve, source);
|
|
|
|
+ } else {
|
|
|
|
+ _time=setTimeout(() => {
|
|
|
|
+ tickPlayCb(i, resolve, source);
|
|
|
|
+ }, tickData.beatLengthInMilliseconds);
|
|
|
|
+ }
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|