|
@@ -194,7 +194,7 @@ export const getAllNodes = (osmd: any) => {
|
|
|
if (osmd?.cursor) {
|
|
|
try {
|
|
|
osmd.cursor.reset()
|
|
|
- } catch (error) {}
|
|
|
+ } catch (error) { }
|
|
|
const iterator = osmd.cursor.iterator
|
|
|
let i = 0
|
|
|
let si = 0
|
|
@@ -236,7 +236,7 @@ export const getAllNodes = (osmd: any) => {
|
|
|
if (state.isCombineRender) {
|
|
|
for (let index = 0; index < iterator.currentVoiceEntries.length; index++) {
|
|
|
const element = iterator.currentVoiceEntries[index];
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 曲谱:合奏2-14,1752154261147389954,跳过倚音
|
|
|
*/
|
|
|
if (element.isGrace) {
|
|
@@ -251,7 +251,7 @@ export const getAllNodes = (osmd: any) => {
|
|
|
elRealValue = element.notes[0].length.realValue
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
let voiceEntries = iterator.currentVoiceEntries?.[0] ? [iterator.currentVoiceEntries?.[0]] : []
|
|
|
const voiceEntries2 = iterator.currentVoiceEntries?.[1]
|
|
|
if (state.isCombineRender) {
|
|
@@ -270,7 +270,7 @@ export const getAllNodes = (osmd: any) => {
|
|
|
.flat()
|
|
|
.sort((a: any, b: any) => a.Length.realValue - b.Length.realValue)
|
|
|
note = _notes[0]
|
|
|
- } catch (error) {}
|
|
|
+ } catch (error) { }
|
|
|
}
|
|
|
if (note) {
|
|
|
if (si === 0) {
|
|
@@ -401,10 +401,10 @@ export const getAllNodes = (osmd: any) => {
|
|
|
speed = allNotes[i - 1]?.speed
|
|
|
}
|
|
|
beatSpeed =
|
|
|
- (state.isSpecialBookCategory
|
|
|
- ? getTimeByBeatUnit(beatUnit, speed, iterator.currentMeasure.activeTimeSignature.Denominator)
|
|
|
- : baseSpeed) || 1
|
|
|
- const isEnd = !(gradualChangeIndex < noteDiff) && !(resetXmlNoteIndex > gradualChangeIndex)
|
|
|
+ (state.isSpecialBookCategory
|
|
|
+ ? getTimeByBeatUnit(beatUnit, speed, iterator.currentMeasure.activeTimeSignature.Denominator)
|
|
|
+ : baseSpeed) || 1
|
|
|
+ const isEnd = !(gradualChangeIndex < noteDiff) && !(resetXmlNoteIndex > gradualChangeIndex)
|
|
|
gradualChangeIndex++
|
|
|
// console.log(gradualChangeIndex)
|
|
|
if (isEnd) {
|
|
@@ -438,13 +438,13 @@ export const getAllNodes = (osmd: any) => {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
+ *
|
|
|
* bug修复说明
|
|
|
* 曲目:'我和我的祖国’,
|
|
|
* 从第32节点后播放异常,进和管乐迷endtime值对比,发现是noteLength计算不一致导致
|
|
|
* 不一致的原因是:noteLength值计算,多了下面这段逻辑,故先注释掉
|
|
|
* 20.23.10.13
|
|
|
- *
|
|
|
+ *
|
|
|
*/
|
|
|
|
|
|
// 如果是休止符并且整个小节休止,休止符的时值小于小节时值,取小节的时值
|
|
@@ -510,7 +510,7 @@ export const getAllNodes = (osmd: any) => {
|
|
|
const staffEntries = note.sourceMeasure.verticalMeasureList?.[0]?.staffEntries || []
|
|
|
//计算第一个小节里面的音符时值是否等于整个小节的时值
|
|
|
staffEntries.forEach((_a: any) => {
|
|
|
- if(_a?.sourceStaffEntry?.voiceEntries?.[0]?.notes?.[0]?.length?.realValue){
|
|
|
+ if (_a?.sourceStaffEntry?.voiceEntries?.[0]?.notes?.[0]?.length?.realValue) {
|
|
|
_firstMeasureRealValue += _a.sourceStaffEntry.voiceEntries[0].notes[0].length.realValue
|
|
|
}
|
|
|
})
|
|
@@ -572,19 +572,19 @@ export const getAllNodes = (osmd: any) => {
|
|
|
ornamentContainer: note.voiceEntry.ornamentContainer ? { ...note.voiceEntry.ornamentContainer } : '',
|
|
|
},
|
|
|
noteElement: {
|
|
|
- ...note.SourceMeasure,
|
|
|
+ ...note.SourceMeasure,
|
|
|
NoteToGraphicalNoteObjectId: note.NoteToGraphicalNoteObjectId,
|
|
|
notehead: note.notehead
|
|
|
? {
|
|
|
- filled: note.notehead.filled,
|
|
|
- shape: note.notehead.shape,
|
|
|
- sourceNote: note.notehead.sourceNote?.NoteToGraphicalNoteObjectId,
|
|
|
- }
|
|
|
+ filled: note.notehead.filled,
|
|
|
+ shape: note.notehead.shape,
|
|
|
+ sourceNote: note.notehead.sourceNote?.NoteToGraphicalNoteObjectId,
|
|
|
+ }
|
|
|
: '',
|
|
|
noteheadColor: note.noteheadColor,
|
|
|
isRestFlag: note.isRestFlag,
|
|
|
sourceMeasure: {
|
|
|
- ...note.SourceMeasure,
|
|
|
+ ...note.SourceMeasure,
|
|
|
measureListIndex: note?.SourceMeasure?.measureListIndex,
|
|
|
MeasureNumberXML: note?.SourceMeasure?.MeasureNumberXML,
|
|
|
allRests: note?.SourceMeasure?.allRests,
|
|
@@ -592,57 +592,57 @@ export const getAllNodes = (osmd: any) => {
|
|
|
multipleRestMeasures: note?.SourceMeasure?.multipleRestMeasures,
|
|
|
verticalMeasureList: Array.isArray(note?.SourceMeasure?.verticalMeasureList)
|
|
|
? note.SourceMeasure.verticalMeasureList.map((v: any) => {
|
|
|
- const { x, y, width, height, start_x, end_x } = v?.stave || {}
|
|
|
- return v
|
|
|
- ? {
|
|
|
- stave: {
|
|
|
- x,
|
|
|
- y,
|
|
|
- width,
|
|
|
- height,
|
|
|
- start_x,
|
|
|
- end_x,
|
|
|
- },
|
|
|
- boundingBox:
|
|
|
- v && v.boundingBox
|
|
|
- ? {
|
|
|
- absolutePosition: { ...v.boundingBox.absolutePosition },
|
|
|
- size: { ...v.boundingBox.size },
|
|
|
- }
|
|
|
- : '',
|
|
|
- }
|
|
|
- : undefined
|
|
|
- })
|
|
|
+ const { x, y, width, height, start_x, end_x } = v?.stave || {}
|
|
|
+ return v
|
|
|
+ ? {
|
|
|
+ stave: {
|
|
|
+ x,
|
|
|
+ y,
|
|
|
+ width,
|
|
|
+ height,
|
|
|
+ start_x,
|
|
|
+ end_x,
|
|
|
+ },
|
|
|
+ boundingBox:
|
|
|
+ v && v.boundingBox
|
|
|
+ ? {
|
|
|
+ absolutePosition: { ...v.boundingBox.absolutePosition },
|
|
|
+ size: { ...v.boundingBox.size },
|
|
|
+ }
|
|
|
+ : '',
|
|
|
+ }
|
|
|
+ : undefined
|
|
|
+ })
|
|
|
: [],
|
|
|
activeTimeSignature: note.sourceMeasure?.activeTimeSignature,
|
|
|
- ActiveTimeSignature: note.sourceMeasure?.activeTimeSignature
|
|
|
+ ActiveTimeSignature: note.sourceMeasure?.activeTimeSignature
|
|
|
},
|
|
|
tie: note.tie
|
|
|
? {
|
|
|
- StartNote: {
|
|
|
- NoteToGraphicalNoteObjectId: note.tie.StartNote.NoteToGraphicalNoteObjectId,
|
|
|
- },
|
|
|
- notes:
|
|
|
- (Array.isArray(note.tie.notes) &&
|
|
|
- note.tie.notes?.map((_tie: any) => {
|
|
|
- return {
|
|
|
- NoteToGraphicalNoteObjectId: _tie.NoteToGraphicalNoteObjectId,
|
|
|
- }
|
|
|
- })) ||
|
|
|
- [],
|
|
|
- }
|
|
|
+ StartNote: {
|
|
|
+ NoteToGraphicalNoteObjectId: note.tie.StartNote.NoteToGraphicalNoteObjectId,
|
|
|
+ },
|
|
|
+ notes:
|
|
|
+ (Array.isArray(note.tie.notes) &&
|
|
|
+ note.tie.notes?.map((_tie: any) => {
|
|
|
+ return {
|
|
|
+ NoteToGraphicalNoteObjectId: _tie.NoteToGraphicalNoteObjectId,
|
|
|
+ }
|
|
|
+ })) ||
|
|
|
+ [],
|
|
|
+ }
|
|
|
: '',
|
|
|
slurs: Array.isArray(note.slurs)
|
|
|
? note.slurs.map((slur: any) => {
|
|
|
- return {
|
|
|
- startNote: {
|
|
|
- NoteToGraphicalNoteObjectId: slur.startNote.NoteToGraphicalNoteObjectId,
|
|
|
- },
|
|
|
- endNote: {
|
|
|
- NoteToGraphicalNoteObjectId: slur.endNote.NoteToGraphicalNoteObjectId,
|
|
|
- },
|
|
|
- }
|
|
|
- })
|
|
|
+ return {
|
|
|
+ startNote: {
|
|
|
+ NoteToGraphicalNoteObjectId: slur.startNote.NoteToGraphicalNoteObjectId,
|
|
|
+ },
|
|
|
+ endNote: {
|
|
|
+ NoteToGraphicalNoteObjectId: slur.endNote.NoteToGraphicalNoteObjectId,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ })
|
|
|
: [],
|
|
|
pitch: {
|
|
|
prevFrequency: note.pitch?.prevFrequency,
|
|
@@ -662,8 +662,8 @@ export const getAllNodes = (osmd: any) => {
|
|
|
stave:
|
|
|
activeVerticalMeasureList[0] && activeVerticalMeasureList[0].stave
|
|
|
? {
|
|
|
- attrs: activeVerticalMeasureList[0].stave ? { ...activeVerticalMeasureList[0].stave.attrs } : {},
|
|
|
- }
|
|
|
+ attrs: activeVerticalMeasureList[0].stave ? { ...activeVerticalMeasureList[0].stave.attrs } : {},
|
|
|
+ }
|
|
|
: '',
|
|
|
firstVerticalMeasure: { measureNumber: activeVerticalMeasureList?.[0]?.measureNumber },
|
|
|
noteLength: 1,
|
|
@@ -697,7 +697,7 @@ export const getAllNodes = (osmd: any) => {
|
|
|
}
|
|
|
try {
|
|
|
osmd.cursor.reset()
|
|
|
- } catch (error) {}
|
|
|
+ } catch (error) { }
|
|
|
}
|
|
|
// 按照时间轴排序
|
|
|
// console.log('看看👀', allNotes)
|
|
@@ -798,32 +798,32 @@ export const setStepIndex = (osmd: any, num: number, prev?: number) => {
|
|
|
}
|
|
|
|
|
|
export const getIndex = (times: any[], currentTime: Number) => {
|
|
|
- // console.log(currentTime)
|
|
|
- if (currentTime > state.times[state.times.length - 1].endtime) {
|
|
|
- return state.times.length - 1;
|
|
|
- }
|
|
|
- let index = 0;
|
|
|
+ // console.log(currentTime)
|
|
|
+ if (currentTime > state.times[state.times.length - 1].endtime) {
|
|
|
+ return state.times.length - 1;
|
|
|
+ }
|
|
|
+ let index = 0;
|
|
|
// js计算有精度问题,增加0.2毫秒误差范围
|
|
|
currentTime = Number(currentTime) + 0.0002;
|
|
|
// console.log('时间',currentTime)
|
|
|
- for (let i = 0; i < times.length; i++) {
|
|
|
- const item = times[i];
|
|
|
- const prevItem = times[i - 1];
|
|
|
- if (currentTime >= item.time) {
|
|
|
- if (!prevItem || item.time != prevItem.time) {
|
|
|
- index = item.i;
|
|
|
- }
|
|
|
- } else {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (state.sectionStatus && state.section.length === 2) {
|
|
|
- // 限制不超过此范围
|
|
|
- const startSection = state.befireSection || state.section[0];
|
|
|
- index = Math.min(Math.max(index, startSection.i), state.section[1].i);
|
|
|
- // console.log('endIndex', index)
|
|
|
- }
|
|
|
- return index;
|
|
|
+ for (let i = 0; i < times.length; i++) {
|
|
|
+ const item = times[i];
|
|
|
+ const prevItem = times[i - 1];
|
|
|
+ if (currentTime >= item.time) {
|
|
|
+ if (!prevItem || item.time != prevItem.time) {
|
|
|
+ index = item.i;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (state.sectionStatus && state.section.length === 2) {
|
|
|
+ // 限制不超过此范围
|
|
|
+ const startSection = state.befireSection || state.section[0];
|
|
|
+ index = Math.min(Math.max(index, startSection.i), state.section[1].i);
|
|
|
+ // console.log('endIndex', index)
|
|
|
+ }
|
|
|
+ return index;
|
|
|
};
|
|
|
|
|
|
export const getSlursNote = (_note: any, pos?: 'start' | 'end') => {
|
|
@@ -895,18 +895,18 @@ export const getNoteByMeasuresSlursStart = (note: any) => {
|
|
|
}
|
|
|
|
|
|
export const getActtiveNoteByTimes = (evt: MouseEvent) => {
|
|
|
- const el = (evt.target as HTMLDivElement)?.dataset;
|
|
|
- // console.log(state)
|
|
|
+ const el = (evt.target as HTMLDivElement)?.dataset;
|
|
|
+ // console.log(state)
|
|
|
|
|
|
- const data: any = {};
|
|
|
- for (const time of state.times) {
|
|
|
- if (time.id && !data[time.id]) {
|
|
|
- data[time.id] = time;
|
|
|
- }
|
|
|
- }
|
|
|
- const activeNote = data[el.id || ""];
|
|
|
- // state.timesById = data
|
|
|
- return activeNote;
|
|
|
+ const data: any = {};
|
|
|
+ for (const time of state.times) {
|
|
|
+ if (time.id && !data[time.id]) {
|
|
|
+ data[time.id] = time;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const activeNote = data[el.id || ""];
|
|
|
+ // state.timesById = data
|
|
|
+ return activeNote;
|
|
|
};
|
|
|
|
|
|
const getPrevHasSourceNote = (note: any) => {
|
|
@@ -1094,21 +1094,35 @@ export const getMeasureRealBpm = (measure: SourceMeasure) => {
|
|
|
}
|
|
|
|
|
|
export const getEnvHostname = () => {
|
|
|
- if (location.origin.indexOf('online') > -1) {
|
|
|
- return 'https://mstuonline.dayaedu.com'
|
|
|
- } else if (location.origin.indexOf('dev') > -1) {
|
|
|
- return 'http://mstudev.dayaedu.com'
|
|
|
+ // if (location.origin.indexOf('online') > -1) {
|
|
|
+ // return 'https://mstuonline.dayaedu.com'
|
|
|
+ // } else if (location.origin.indexOf('dev') > -1) {
|
|
|
+ // return 'http://mstudev.dayaedu.com'
|
|
|
+ // }
|
|
|
+ // return 'https://mstutest.dayaedu.com'
|
|
|
+
|
|
|
+ if (location.hostname === 'gym.lexiaoya.cn') {
|
|
|
+ return 'https://gym.lexiaoya.cn/mdaya'
|
|
|
+ } else if (location.hostname === 'dev.gym.lexiaoya.cn') {
|
|
|
+ return 'http://dev.gym.lexiaoya.cn/mdaya'
|
|
|
}
|
|
|
- return 'https://mstutest.dayaedu.com'
|
|
|
+ return 'https://test.gym.lexiaoya.cn/mdaya'
|
|
|
}
|
|
|
|
|
|
export const getTvIconUrl = () => {
|
|
|
- if (location.origin.indexOf('online') > -1) {
|
|
|
- return 'https://mteaonline.dayaedu.com/#/guide'
|
|
|
- } else if (location.origin.indexOf('dev') > -1) {
|
|
|
- return 'http://mteadev.dayaedu.com/#/guide'
|
|
|
+ // if (location.origin.indexOf('online') > -1) {
|
|
|
+ // return 'https://mteaonline.dayaedu.com/#/guide'
|
|
|
+ // } else if (location.origin.indexOf('dev') > -1) {
|
|
|
+ // return 'http://mteadev.dayaedu.com/#/guide'
|
|
|
+ // }
|
|
|
+ // return 'https://mteatest.dayaedu.com/#/guide'
|
|
|
+
|
|
|
+ if (location.hostname === 'gym.lexiaoya.cn') {
|
|
|
+ return 'https://gym.lexiaoya.cn/mteacher/#/guide'
|
|
|
+ } else if (location.hostname === 'dev.gym.lexiaoya.cn') {
|
|
|
+ return 'http://dev.gym.lexiaoya.cn/mteacher/#/guide'
|
|
|
}
|
|
|
- return 'https://mteatest.dayaedu.com/#/guide'
|
|
|
+ return 'https://test.gym.lexiaoya.cn/mteacher/#/guide'
|
|
|
}
|
|
|
|
|
|
export const setPrefix = (url: string): string => {
|
|
@@ -1338,10 +1352,10 @@ export const onlyVisible = (xml: string, partIndex: number): string => {
|
|
|
const rehearsals = [...parts[0]?.getElementsByTagName('rehearsal')]
|
|
|
|
|
|
/** 第一分谱如果是约定的配置分谱则跳过 */
|
|
|
- if (partListNames[0]?.toLocaleUpperCase?.() === "COMMON") {
|
|
|
- partIndex++;
|
|
|
- partListNames.shift();
|
|
|
- }
|
|
|
+ if (partListNames[0]?.toLocaleUpperCase?.() === "COMMON") {
|
|
|
+ partIndex++;
|
|
|
+ partListNames.shift();
|
|
|
+ }
|
|
|
const visiblePartInfo = partList[partIndex]
|
|
|
state.partListNames = partListNames
|
|
|
if (visiblePartInfo) {
|
|
@@ -1655,4 +1669,4 @@ export const setSettionBackground = () => {
|
|
|
item.height = Math.max(...heights)
|
|
|
return item
|
|
|
})
|
|
|
-}
|
|
|
+}
|