Merge branch 'pkgver' of https://gitee.com/EillesWan/Musicreater into pkgver

This commit is contained in:
Eilles 2022-09-09 22:58:59 +08:00
commit 662c6506d8
5 changed files with 25 additions and 28 deletions

View File

@ -26,7 +26,6 @@ Musicreater Package Version : Demo for Midi Conversion
limitations under the License.
"""
from msctPkgver.main import *
import os
@ -80,10 +79,9 @@ while True:
if isAutoReset != '':
isAutoReset = bool(int(isAutoReset))
break
except:
except BaseException:
print('输入错误,请重新输入')
if os.path.isdir(midipath):
for i in os.listdir(midipath):
if i.endswith('.mid'):

View File

@ -45,10 +45,9 @@ while True:
heightmax = int(heightmax)
break
except:
except BaseException:
print('输入错误,请重新输入')
if os.path.isdir(midipath):
for i in os.listdir(midipath):
if i.endswith('.mid'):

View File

@ -31,8 +31,10 @@ Note! Except for this source file, all the files in this repository and this pro
def _toCmdList_m1(
self, scoreboardname: str = "mscplay", volume: float = 1.0, speed: float = 1.0
) -> list:
self,
scoreboardname: str = "mscplay",
volume: float = 1.0,
speed: float = 1.0) -> list:
"""
使用Dislink Sforza的转换思路将midi转换为我的世界命令列表
:param scoreboardname: 我的世界的计分板名称
@ -73,16 +75,14 @@ def _toCmdList_m1(
maxscore = max(maxscore, nowscore)
soundID, _X = self.__Inst2soundIDwithX(instrumentID)
singleTrack.append(
"execute @a[scores={"
+ str(scoreboardname)
+ "="
+ str(nowscore)
+ "}"
+ f"] ~ ~ ~ playsound {soundID} @s ~ ~{1 / volume - 1} ~ {msg.velocity * (0.7 if msg.channel == 0 else 0.9)} {2 ** ((msg.note - 60 - _X) / 12)}"
)
"execute @a[scores={" +
str(scoreboardname) +
"=" +
str(nowscore) +
"}" +
f"] ~ ~ ~ playsound {soundID} @s ~ ~{1 / volume - 1} ~ {msg.velocity * (0.7 if msg.channel == 0 else 0.9)} {2 ** ((msg.note - 60 - _X) / 12)}")
commands += 1
if len(singleTrack) != 0:
tracks.append(singleTrack)
return tracks, commands, maxscore
return [tracks, commands, maxscore]

View File

@ -90,7 +90,7 @@ class midiConvert:
钟琴bell管钟chime木琴xylophone的时候为4
而存在一些打击乐器basedrumhatsnare没有音域则没有X那么我们返回7即可
:param instrumentID: midi的乐器ID
:param default: 如果instrumentID不在范围内返回的默认我的世界乐器名称
default: 如果instrumentID不在范围内返回的默认我的世界乐器名称
:return: (str我的世界乐器名, int转换算法中的X)"""
try:
a = {
@ -385,7 +385,7 @@ class midiConvert:
执行延时
:param customName: `str`
悬浮字
:param lastOutput: `str`
lastOutput: `str`
上次输出字符串注意此处需要留空
:param executeOnFirstTick: `bool`
执行第一个已选项(循环指令方块是否激活后立即执行若为False则从激活时起延迟后第一次执行)
@ -712,7 +712,7 @@ class midiConvert:
scoreboardname: str = "mscplay",
volume: float = 1.0,
speed: float = 1.0,
) -> bool:
) -> bool or tuple:
"""
使用method指定的转换算法将midi转换为我的世界mcpack格式的包
:param method: 转换算法