优化生成结构

This commit is contained in:
EillesWan 2023-09-24 12:44:00 +08:00
parent 76eff25a1d
commit 29380d4151
6 changed files with 50 additions and 26 deletions

View File

@ -203,7 +203,7 @@
END OF TERMS AND CONDITIONS
Copyright 2022 TriM-Organization 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & all the developers of Musicreater
Copyright 2023 TriM-Organization 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & all the developers of Musicreater
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -17,8 +17,8 @@ Terms & Conditions: License.md in the root directory
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
__version__ = "1.5.0"
__vername__ = "修改附加包插件的调用方式,新增播放终止函数,文档内容增强"
__version__ = "1.5.1"
__vername__ = "优化生成结构,提高生成效率,完善版权说明"
__author__ = (
("金羿", "Eilles Wan"),
("诸葛亮与八卦阵", "bgArray"),

View File

@ -603,7 +603,7 @@ class MidiConvert:
speed: float = 1.0,
) -> Tuple[List[List[SingleCommand]], int, int]:
"""
使用金羿的转换思路将midi转换为我的世界命令列表
将midi转换为我的世界命令列表
Parameters
----------
@ -655,6 +655,9 @@ class MidiConvert:
score_now = round(msg[-1] / float(speed) / 50)
maxScore = max(maxScore, score_now)
mc_pitch = "" if SpecialBits else 2 ** ((msg[1] - 60 - _X) / 12)
mc_distance_volume = 128 / max_volume / msg[2] + (
1 if SpecialBits else -1
)
nowTrack.append(
SingleCommand(
@ -666,7 +669,10 @@ class MidiConvert:
.replace(")", r"}")
)
+ "playsound {} @s ^ ^ ^{} {} {}".format(
soundID, 1 / max_volume - 1, msg[2] / 128, mc_pitch
soundID,
mc_distance_volume,
msg[2] / 128,
mc_pitch,
),
annotation="{}播放{}%{}".format(
mctick2timestr(score_now),
@ -694,7 +700,7 @@ class MidiConvert:
player_selector: str = "@a",
) -> Tuple[List[SingleCommand], int, int]:
"""
使用金羿的转换思路将midi转换为我的世界命令列表并输出每个音符之后的延迟
将midi转换为我的世界命令列表并输出每个音符之后的延迟
Parameters
----------
@ -744,25 +750,29 @@ class MidiConvert:
)
delaytime_now = round(msg[-1] / float(speed) / 50)
mc_pitch = "" if SpecialBits else 2 ** ((msg[1] - 60 - _X) / 12)
mc_distance_volume = 128 / max_volume / msg[2] + (
1 if SpecialBits else -1
)
try:
tracks[delaytime_now].append(
self.execute_cmd_head.format(player_selector)
+ f"playsound {soundID} @s ^ ^ ^{128 / max_volume / msg[2] - 1} {msg[2] / 128} "
+ (
""
if SpecialBits
else f"{2 ** ((msg[1] - 60 - _X) / 12)}"
+ "playsound {} @s ^ ^ ^{} {} {}".format(
soundID,
mc_distance_volume,
msg[2] / 128,
mc_pitch,
)
)
except KeyError:
tracks[delaytime_now] = [
self.execute_cmd_head.format(player_selector)
+ f"playsound {soundID} @s ^ ^ ^{128 / max_volume / msg[2] - 1} {msg[2] / 128} "
+ (
""
if SpecialBits
else f"{2 ** ((msg[1] - 60 - _X) / 12)}"
+ "playsound {} @s ^ ^ ^{} {} {}".format(
soundID,
mc_distance_volume,
msg[2] / 128,
mc_pitch,
)
]

View File

@ -351,23 +351,23 @@ def commands_to_redstone_delay_structure(
command_actually_length = sum([int(bool(cmd.delay)) for cmd in commands])
a = 1
for cmd in commands:
# print("\r 正在进行处理:",end="")
if cmd.delay > 2:
a = 1
else:
a += 1
# a = 1
# for cmd in commands:
# # print("\r 正在进行处理:",end="")
# if cmd.delay > 2:
# a = 1
# else:
# a += 1
struct = Structure(
size=(
round(delay_length / 2 + command_actually_length)
if extensioon_direction == x
else a,
else max_multicmd_length,
3,
round(delay_length / 2 + command_actually_length)
if extensioon_direction == z
else a,
else max_multicmd_length,
),
fill=Block("minecraft", "air", compability_version=compability_version_),
compability_version=compability_version_,

View File

@ -106,7 +106,7 @@ else:
print(f"正在处理 {midi_path} ")
cvt_mid = Musicreater.MidiConvert.from_midi_file(midi_path, old_exe_format=True)
cvt_mid = Musicreater.MidiConvert.from_midi_file(midi_path, old_exe_format=False)
cvt_cfg = ConvertConfig(out_path, *prompts[:3])
if playerFormat == 1:

View File

@ -0,0 +1,14 @@
音乐谱面文件
测试片段.mid、测试片段.mscz
皆系 音·创 库所用之连带软件
禁止在 音·创 库以外传播
不允许独立发行、独立副本
不允许未经允许的二次创作
不允许脱离于 音·创 独立存在
不得随任何其他非 音·创 软件连带发布
不得用于商业用途
若 音·创 库被用于商业用途,应当将其剔除
版权所有 © 2023 诸葛亮与八卦阵