mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-03-04 12:53:57 +08:00
bug不过年
This commit is contained in:
parent
3d66c06e6d
commit
4b9550db21
@ -7,7 +7,7 @@
|
||||
# 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md
|
||||
|
||||
|
||||
__version__ = '0.2.1.3'
|
||||
__version__ = '0.2.1.4'
|
||||
__all__ = []
|
||||
__author__ = (('金羿', 'Eilles Wan'), ('诸葛亮与八卦阵', 'bgArray'), ('鸣凤鸽子', 'MingFengPigeon'))
|
||||
|
||||
|
@ -124,7 +124,8 @@ class midiConvert:
|
||||
self._toCmdList_withDelay_m1,
|
||||
]
|
||||
if self.debugMode:
|
||||
from .magicBeing import prt,ipt
|
||||
from .magicBeing import prt, ipt
|
||||
|
||||
self.prt = prt
|
||||
self.ipt = ipt
|
||||
|
||||
@ -628,7 +629,25 @@ class midiConvert:
|
||||
MaxVolume = 1 if MaxVolume > 1 else (0.001 if MaxVolume <= 0 else MaxVolume)
|
||||
|
||||
# 一个midi中仅有16通道 我们通过通道来识别而不是音轨
|
||||
channels = {}
|
||||
channels = {
|
||||
0: [],
|
||||
1: [],
|
||||
2: [],
|
||||
3: [],
|
||||
4: [],
|
||||
5: [],
|
||||
6: [],
|
||||
7: [],
|
||||
8: [],
|
||||
9: [],
|
||||
10: [],
|
||||
11: [],
|
||||
12: [],
|
||||
13: [],
|
||||
14: [],
|
||||
15: [],
|
||||
16: [],
|
||||
}
|
||||
|
||||
microseconds = 0
|
||||
|
||||
@ -643,7 +662,11 @@ class midiConvert:
|
||||
if self.debugMode:
|
||||
raise NotDefineTempoError("计算当前分数时出错 未定义参量 Tempo")
|
||||
else:
|
||||
microseconds += msg.time * mido.midifiles.midifiles.DEFAULT_TEMPO / self.midi.ticks_per_beat
|
||||
microseconds += (
|
||||
msg.time
|
||||
* mido.midifiles.midifiles.DEFAULT_TEMPO
|
||||
/ self.midi.ticks_per_beat
|
||||
)
|
||||
|
||||
if msg.is_meta:
|
||||
if msg.type == "set_tempo":
|
||||
@ -671,7 +694,7 @@ class midiConvert:
|
||||
msg.type == "note_off"
|
||||
):
|
||||
channels[msg.channel].append(("NoteE", msg.note, microseconds))
|
||||
|
||||
|
||||
"""整合后的音乐通道格式
|
||||
每个通道包括若干消息元素其中逃不过这三种:
|
||||
|
||||
@ -711,12 +734,20 @@ class midiConvert:
|
||||
|
||||
elif msg[0] == "NoteS":
|
||||
try:
|
||||
soundID, _X = (self.__bitInst2IDwithX(InstID) if SpecialBits else self.__Inst2soundIDwithX(InstID))
|
||||
soundID, _X = (
|
||||
self.__bitInst2IDwithX(InstID)
|
||||
if SpecialBits
|
||||
else self.__Inst2soundIDwithX(InstID)
|
||||
)
|
||||
except UnboundLocalError as E:
|
||||
if self.debugMode:
|
||||
raise NotDefineProgramError(f"未定义乐器便提前演奏。\n{E}")
|
||||
else:
|
||||
soundID, _X = (self.__bitInst2IDwithX(-1) if SpecialBits else self.__Inst2soundIDwithX(-1))
|
||||
soundID, _X = (
|
||||
self.__bitInst2IDwithX(-1)
|
||||
if SpecialBits
|
||||
else self.__Inst2soundIDwithX(-1)
|
||||
)
|
||||
score_now = round(msg[-1] / float(speed) / 50)
|
||||
maxScore = max(maxScore, score_now)
|
||||
|
||||
@ -1197,7 +1228,7 @@ class midiConvert:
|
||||
+ scoreboardname,
|
||||
)
|
||||
|
||||
cmdBytes, size, finalPos = toBDXbytes([(i,0)for i in commands], maxheight - 1)
|
||||
cmdBytes, size, finalPos = toBDXbytes([(i, 0) for i in commands], maxheight - 1)
|
||||
# 此处是对于仅有 True 的参数和自定义参数的判断
|
||||
if progressbar:
|
||||
pgbBytes, pgbSize, pgbNowPos = toBDXbytes(
|
||||
@ -1334,7 +1365,6 @@ class midiConvert:
|
||||
|
||||
return (True, len(cmdlist), maxdelay, size, finalPos)
|
||||
|
||||
|
||||
def toDICT(
|
||||
self,
|
||||
) -> list:
|
||||
@ -1355,7 +1385,11 @@ class midiConvert:
|
||||
microseconds += msg.time * tempo / self.midi.ticks_per_beat
|
||||
# print(microseconds)
|
||||
except:
|
||||
microseconds += msg.time * mido.midifiles.midifiles.DEFAULT_TEMPO / self.midi.ticks_per_beat
|
||||
microseconds += (
|
||||
msg.time
|
||||
* mido.midifiles.midifiles.DEFAULT_TEMPO
|
||||
/ self.midi.ticks_per_beat
|
||||
)
|
||||
|
||||
if msg.is_meta:
|
||||
if msg.type == "set_tempo":
|
||||
@ -1374,7 +1408,7 @@ class midiConvert:
|
||||
msg.type == "note_off"
|
||||
):
|
||||
channels[msg.channel].append(("NoteE", msg.note, microseconds))
|
||||
|
||||
|
||||
"""整合后的音乐通道格式
|
||||
每个通道包括若干消息元素其中逃不过这三种:
|
||||
|
||||
@ -1387,4 +1421,4 @@ class midiConvert:
|
||||
3 音符结束消息
|
||||
("NoteS", 结束的音符ID, 距离演奏开始的毫秒)"""
|
||||
|
||||
return channels
|
||||
return channels
|
||||
|
Loading…
x
Reference in New Issue
Block a user