|
@@ -48,6 +48,10 @@ export const headTopData = reactive({
|
|
|
showBack: true,
|
|
|
/** 设置弹窗 */
|
|
|
settingMode: false,
|
|
|
+ /* 节奏律动 */
|
|
|
+ rhythmMode: false,
|
|
|
+ // 节奏律动方向
|
|
|
+ rhythmModeDirection: computed(()=> state.fingeringInfo.direction === "transverse" ? "vertical" : "transverse"),
|
|
|
/** 切换模式 */
|
|
|
handleChangeModeType(value: "practise" | "follow" | "evaluating") {
|
|
|
// 后台设置为不能评测
|
|
@@ -59,6 +63,15 @@ export const headTopData = reactive({
|
|
|
metronomeData.cursorMode = 1;
|
|
|
}
|
|
|
if (value === "practise") {
|
|
|
+ // 切回当前的时值
|
|
|
+ const isModeChange = modeChangeHandleTimes("play", "music")
|
|
|
+ // 没有切换的时候 不处理下面的
|
|
|
+ if (isModeChange) {
|
|
|
+ try {
|
|
|
+ metronomeData.metro.calculation(state.times);
|
|
|
+ } catch (error) {}
|
|
|
+ console.log("重新之后的times", state.times, state.fixtime);
|
|
|
+ }
|
|
|
// state.playIngSpeed = state.speed
|
|
|
}
|
|
|
if (value === "evaluating") {
|
|
@@ -83,6 +96,19 @@ export const headTopData = reactive({
|
|
|
// state.isSingleLine = true;
|
|
|
// refreshMusicSvg();
|
|
|
// }
|
|
|
+ /* 当前是唱名的模式 */
|
|
|
+ if(state.playSource === "mingSong") {
|
|
|
+ const isModeChange = modeChangeHandleTimes("play","mingSong","play","music")
|
|
|
+ // 没有切换的时候 不处理下面的
|
|
|
+ if (isModeChange) {
|
|
|
+ try {
|
|
|
+ metronomeData.metro.calculation(state.times);
|
|
|
+ } catch (error) {}
|
|
|
+ console.log("重新之后的times", state.times, state.fixtime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 关闭节奏律动
|
|
|
+ headTopData.rhythmMode = false
|
|
|
smoothAnimationState.isShow.value = false; // 隐藏旋律线
|
|
|
state.playIngSpeed = state.originSpeed;
|
|
|
handleStartEvaluat();
|
|
@@ -91,6 +117,8 @@ export const headTopData = reactive({
|
|
|
// evaluatingData.rendered = true;
|
|
|
// evaluatingData.soundEffectMode = true;
|
|
|
} else if (value === "follow") {
|
|
|
+ // 关闭节奏律动
|
|
|
+ headTopData.rhythmMode = false
|
|
|
// 跟练模式,只有一行谱模式
|
|
|
if (!state.isSingleLine) {
|
|
|
state.isSingleLine = true;
|
|
@@ -154,45 +182,34 @@ export async function handlerModeChange(oldPlayType: "play" | "sing", oldPlaySou
|
|
|
}
|
|
|
}
|
|
|
// 模式切换之后重新给times赋值
|
|
|
-function modeChangeHandleTimes(oldPlayType: "play" | "sing", oldPlaySource: IPlayState) {
|
|
|
- const playType = state.playType;
|
|
|
- const playSource = state.playSource;
|
|
|
+function modeChangeHandleTimes(oldPlayType: "play" | "sing", oldPlaySource: IPlayState, nowPlayType?:"play" | "sing", nowPlaySource?: IPlayState) {
|
|
|
+ const playType = nowPlayType || state.playType;
|
|
|
+ const playSource = nowPlaySource || state.playSource;
|
|
|
const { notBeatFixtime, xmlMp3BeatFixTime, difftime } = state.times[0];
|
|
|
const { isOpenMetronome, isSingOpenMetronome } = state;
|
|
|
- // 演奏向演唱切
|
|
|
- if (oldPlayType === "play" && playType === "sing") {
|
|
|
- if (playSource === "mingSong") {
|
|
|
- // 唱名文件也要加上弱起时间 他们制作曲子加了弱起时间 注意这修改了之后给总控平台的时值也需要改
|
|
|
- state.fixtime = difftime;
|
|
|
- state.times.map((item) => {
|
|
|
- item.time = item.xmlNoteTime + difftime;
|
|
|
- item.endtime = item.xmlNoteEndTime + difftime;
|
|
|
- item.fixtime = difftime;
|
|
|
- });
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- //演奏开了节拍器,演唱没开节拍器
|
|
|
- if (isOpenMetronome && !isSingOpenMetronome) {
|
|
|
- state.fixtime = notBeatFixtime;
|
|
|
- state.times.map((item) => {
|
|
|
- item.time = item.notBeatTime;
|
|
|
- item.endtime = item.notBeatEndTime;
|
|
|
- item.fixtime = notBeatFixtime;
|
|
|
- });
|
|
|
- return true;
|
|
|
- } else if (!isOpenMetronome && isSingOpenMetronome) {
|
|
|
- state.fixtime = notBeatFixtime + xmlMp3BeatFixTime;
|
|
|
- state.times.map((item) => {
|
|
|
- item.time = item.notBeatTime + xmlMp3BeatFixTime;
|
|
|
- item.endtime = item.notBeatEndTime + xmlMp3BeatFixTime;
|
|
|
- item.fixtime = notBeatFixtime + xmlMp3BeatFixTime;
|
|
|
- });
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (oldPlayType === "sing" && playType === "play") {
|
|
|
- // 演唱向演奏切
|
|
|
- if (oldPlaySource === "mingSong") {
|
|
|
+ // 跟练模式不切换时值 因为演奏加了唱名,所以往跟练模式切换的时候,刷新谱面的时候需要更新时值,这时候调用handleRessetState 会回到练习模式
|
|
|
+ if(state.modeType === "follow") {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ // 当相同时候也不处理
|
|
|
+ if(oldPlayType === playType && oldPlaySource === playSource) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ // 原声向伴奏和伴奏向原声不处理 范唱向伴唱和伴唱向范唱切不处理
|
|
|
+ if((oldPlaySource==="music"&&playSource==="background")||(oldPlaySource==="background"&&playSource==="music")){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ // 唱名到唱名时候不处理
|
|
|
+ if(oldPlaySource === "mingSong" && playSource === "mingSong"){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ // 原生伴奏向范唱伴唱,范唱伴唱向原生伴奏时候,isSingOpenMetronome和isOpenMetronome相等时候不处理
|
|
|
+ if(["music","background"].includes(oldPlaySource)&&["music","background"].includes(playSource)&&isOpenMetronome===isSingOpenMetronome){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ // 当切为 原生伴奏,或者范唱伴唱 时候
|
|
|
+ if(playSource==="music" || playSource ==="background"){
|
|
|
+ if(playType === "play"){
|
|
|
// 有节拍器
|
|
|
if (isOpenMetronome) {
|
|
|
state.fixtime = notBeatFixtime + xmlMp3BeatFixTime;
|
|
@@ -212,37 +229,7 @@ function modeChangeHandleTimes(oldPlayType: "play" | "sing", oldPlaySource: IPla
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
- // 演奏开了节拍器,演唱没开节拍器
|
|
|
- if (isOpenMetronome && !isSingOpenMetronome) {
|
|
|
- state.fixtime = notBeatFixtime + xmlMp3BeatFixTime;
|
|
|
- state.times.map((item) => {
|
|
|
- item.time = item.notBeatTime + xmlMp3BeatFixTime;
|
|
|
- item.endtime = item.notBeatEndTime + xmlMp3BeatFixTime;
|
|
|
- item.fixtime = notBeatFixtime + xmlMp3BeatFixTime;
|
|
|
- });
|
|
|
- return true;
|
|
|
- } else if (!isOpenMetronome && isSingOpenMetronome) {
|
|
|
- state.fixtime = notBeatFixtime;
|
|
|
- state.times.map((item) => {
|
|
|
- item.time = item.notBeatTime;
|
|
|
- item.endtime = item.notBeatEndTime;
|
|
|
- item.fixtime = notBeatFixtime;
|
|
|
- });
|
|
|
- return true;
|
|
|
- }
|
|
|
- } else if (oldPlayType === "sing" && playType === "sing") {
|
|
|
- // 演唱之间切换
|
|
|
- // 切到唱名时候
|
|
|
- if (playSource === "mingSong") {
|
|
|
- // 唱名文件也要加上弱起时间 他们制作曲子加了弱起时间 注意这修改了之后给总控平台的时值也需要改
|
|
|
- state.fixtime = difftime;
|
|
|
- state.times.map((item) => {
|
|
|
- item.time = item.xmlNoteTime + difftime;
|
|
|
- item.endtime = item.xmlNoteEndTime + difftime;
|
|
|
- item.fixtime = difftime;
|
|
|
- });
|
|
|
- return true;
|
|
|
- } else if (oldPlaySource === "mingSong") {
|
|
|
+ if(playType==="sing"){
|
|
|
// 有节拍器
|
|
|
if (isSingOpenMetronome) {
|
|
|
state.fixtime = notBeatFixtime + xmlMp3BeatFixTime;
|
|
@@ -263,6 +250,17 @@ function modeChangeHandleTimes(oldPlayType: "play" | "sing", oldPlaySource: IPla
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // 当切为唱名时候
|
|
|
+ if(playSource==="mingSong"){
|
|
|
+ // 唱名文件也要加上弱起时间 他们制作曲子加了弱起时间 注意这修改了之后给总控平台的时值也需要改
|
|
|
+ state.fixtime = difftime;
|
|
|
+ state.times.map((item) => {
|
|
|
+ item.time = item.xmlNoteTime + difftime;
|
|
|
+ item.endtime = item.xmlNoteEndTime + difftime;
|
|
|
+ item.fixtime = difftime;
|
|
|
+ });
|
|
|
+ return true;
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -385,8 +383,13 @@ export default defineComponent({
|
|
|
return { display: true, disabled: true };
|
|
|
}
|
|
|
if (state.playType === "play") {
|
|
|
- // 原声, 伴奏 少一个,就不能切换
|
|
|
- if (state.music && state.accompany) return { display: true, disabled: false };
|
|
|
+ let index = 0;
|
|
|
+ state.music && index++;
|
|
|
+ state.accompany && index++;
|
|
|
+ state.mingSong && index++;
|
|
|
+ if (index > 1) {
|
|
|
+ return { display: true, disabled: false };
|
|
|
+ }
|
|
|
} else {
|
|
|
// 范唱
|
|
|
let index = 0;
|
|
@@ -468,6 +471,33 @@ export default defineComponent({
|
|
|
};
|
|
|
});
|
|
|
|
|
|
+ /** 节奏律动 */
|
|
|
+ const rhythmBtn = computed(() => {
|
|
|
+ // 跟练和评测显示
|
|
|
+ if (["evaluating", "follow"].includes(state.modeType)) return { display: false, disabled: false, playIng: false };
|
|
|
+ // 播放过程中不让切换
|
|
|
+ if (state.playState == "play") {
|
|
|
+ if(headTopData.rhythmMode) {
|
|
|
+ return {
|
|
|
+ display: true,
|
|
|
+ disabled: true,
|
|
|
+ playIng: true
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return {
|
|
|
+ display: true,
|
|
|
+ disabled: true,
|
|
|
+ playIng: false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return {
|
|
|
+ display: true,
|
|
|
+ disabled: false,
|
|
|
+ playIng: false
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
/** 重播按钮 */
|
|
|
resetBtn = computed(() => {
|
|
|
// 没有音源不显示
|
|
@@ -709,7 +739,7 @@ export default defineComponent({
|
|
|
return () => (
|
|
|
<>
|
|
|
<div
|
|
|
- class={[styles.headerTop, state.platform === IPlatform.PC && state.musicScoreBtnDirection === "left" ? styles.headerTopRight : ""]}
|
|
|
+ class={[styles.headerTop, styles[state.modeType] ,state.platform === IPlatform.PC && state.musicScoreBtnDirection === "left" ? styles.headerTopRight : ""]}
|
|
|
onClick={(e: Event) => {
|
|
|
e.stopPropagation();
|
|
|
if (state.platform === IPlatform.PC) {
|
|
@@ -778,7 +808,7 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
{/* 模式提醒 */}
|
|
|
- {state.modeType === "practise" && (
|
|
|
+ {state.modeType === "practise" && !rhythmBtn.value.playIng && (
|
|
|
<div class={[styles.modeWarn, "practiseModeWarn", state.platform === IPlatform.PC && state.musicScoreBtnDirection === "left" ? styles.modeWarnRight : ""]}>
|
|
|
<img src={state.playType === "play" ? headImg("perform1.png") : headImg("sing1.png")} />
|
|
|
<div>{state.playType === "play" ? "演奏场景" : "演唱场景"}</div>
|
|
@@ -830,7 +860,7 @@ export default defineComponent({
|
|
|
state.playSource = state.fanSong ? "music" : state.banSong ? "background" : "mingSong";
|
|
|
} else {
|
|
|
state.playType = "play";
|
|
|
- state.playSource = state.music ? "music" : "background";
|
|
|
+ state.playSource = state.music ? "music" : state.accompany ? "background" : "mingSong";
|
|
|
}
|
|
|
isClickMode = true;
|
|
|
// 有指法并且显示指法的时候 切换到演唱模式 需要影藏指法
|
|
@@ -868,7 +898,13 @@ export default defineComponent({
|
|
|
const oldPlayType = state.playType;
|
|
|
const oldPlaySource = state.playSource;
|
|
|
if (state.playType === "play") {
|
|
|
- state.playSource = state.playSource === "music" ? "background" : "music";
|
|
|
+ if (state.playSource === "music") {
|
|
|
+ state.playSource = state.accompany ? "background" : "mingSong";
|
|
|
+ } else if (state.playSource === "background") {
|
|
|
+ state.playSource = state.mingSong ? "mingSong" : "music";
|
|
|
+ } else {
|
|
|
+ state.playSource = state.music ? "music" : "background";
|
|
|
+ }
|
|
|
} else {
|
|
|
if (state.playSource === "music") {
|
|
|
state.playSource = state.banSong ? "background" : "mingSong";
|
|
@@ -880,7 +916,7 @@ export default defineComponent({
|
|
|
}
|
|
|
await handlerModeChange(oldPlayType, oldPlaySource);
|
|
|
showToast({
|
|
|
- message: state.playType === "play" ? (state.playSource === "music" ? "已切换为原声" : "已切换为伴奏") : state.playSource === "music" ? "已切换为范唱" : state.playSource === "background" ? "已切换为伴唱" : "已切换为唱名",
|
|
|
+ message: state.playType === "play" ? (state.playSource === "music" ? "已切换为原声" : state.playSource === "background" ? "已切换为伴奏" : "已切换为唱名") : state.playSource === "music" ? "已切换为范唱" : state.playSource === "background" ? "已切换为伴唱" : "已切换为唱名",
|
|
|
position: "top",
|
|
|
className: "selectionToast",
|
|
|
});
|
|
@@ -892,6 +928,16 @@ export default defineComponent({
|
|
|
<span>{state.playSource === "music" ? (state.playType === "play" ? "原声" : "范唱") : state.playSource === "background" ? (state.playType === "play" ? "伴奏" : "伴唱") : "唱名"}</span>
|
|
|
</div>
|
|
|
<div
|
|
|
+ style={{ display: rhythmBtn.value.display ? "" : "none" }}
|
|
|
+ class={["driver-777", styles.btn, styles.rhythmMode, headTopData.rhythmMode && styles.isrhythmMode, rhythmBtn.value.disabled && styles.disabled]}
|
|
|
+ onClick={() => {
|
|
|
+ headTopData.rhythmMode = !headTopData.rhythmMode
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <img class={styles.iconBtn} src={headImg(`rhythm.png`)} />
|
|
|
+ <span>律动</span>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
id={state.platform === IPlatform.PC ? "teacherTop-2" : "studnetT-2"}
|
|
|
style={{ display: selectBtn.value.display ? "" : "none" }}
|
|
|
class={["driver-4", styles.btn, selectBtn.value.disabled && styles.disabled, styles.section, state.sectionStatus && styles.isSection]}
|
|
@@ -982,7 +1028,10 @@ export default defineComponent({
|
|
|
{/* 播放按钮 */}
|
|
|
<div
|
|
|
id="studnetT-7"
|
|
|
- style={{ display: playBtn.value.display ? "" : "none" }}
|
|
|
+ style={{
|
|
|
+ display: playBtn.value.display ? "" : "none" ,
|
|
|
+ opacity: rhythmBtn.value.playIng? "0.4" : "1"
|
|
|
+ }}
|
|
|
class={[
|
|
|
// 引导使用的类
|
|
|
"driver-1",
|
|
@@ -1009,7 +1058,7 @@ export default defineComponent({
|
|
|
<div class={styles.btnWrap}>
|
|
|
<img style={{ display: state.playState === "play" ? "none" : "" }} class={styles.iconBtn} src={headImg("icon_play.png")} />
|
|
|
<img style={{ display: state.playState === "play" ? "" : "none" }} class={styles.iconBtn} src={headImg("icon_pause.png")} />
|
|
|
- <Circle style={{ opacity: state.playState === "play" ? 1 : 0 }} class={styles.progress} stroke-width={60} stroke-linecap={"square"} currentRate={state.playProgress} rate={100} color="#FFED78" layer-color="rgba(0,0,0,0)" />
|
|
|
+ <Circle style={{ opacity: state.playState === "play" ? 1 : 0 }} class={styles.progress} stroke-width={60} stroke-linecap={"square"} currentRate={state.playProgress} rate={100} color="#FFE36A" layer-color="rgba(255,255,255,0.5)" />
|
|
|
</div>
|
|
|
</div>
|
|
|
|