mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-02-07 19:36:46 +08:00
修复类型定义的重复问题
This commit is contained in:
parent
7b319268fe
commit
d7e3c62deb
@ -17,8 +17,8 @@ Terms & Conditions: License.md in the root directory
|
|||||||
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
||||||
|
|
||||||
|
|
||||||
__version__ = "1.7.0"
|
__version__ = "1.7.1"
|
||||||
__vername__ = "更高的自定义化程度"
|
__vername__ = "更高的自定义化程度—修复类型定义的重复问题"
|
||||||
__author__ = (
|
__author__ = (
|
||||||
("金羿", "Eilles Wan"),
|
("金羿", "Eilles Wan"),
|
||||||
("诸葛亮与八卦阵", "bgArray"),
|
("诸葛亮与八卦阵", "bgArray"),
|
||||||
|
@ -77,13 +77,13 @@ class MidiConvert:
|
|||||||
midi: VoidMido
|
midi: VoidMido
|
||||||
"""MidiFile对象"""
|
"""MidiFile对象"""
|
||||||
|
|
||||||
pitched_note_reference_table: Dict[int, Tuple[str, int]]
|
pitched_note_reference_table: MidiInstrumentTableType
|
||||||
"""乐音乐器Midi-MC对照表"""
|
"""乐音乐器Midi-MC对照表"""
|
||||||
|
|
||||||
percussion_note_referrence_table: Dict[int, Tuple[str, int]]
|
percussion_note_referrence_table: MidiInstrumentTableType
|
||||||
"""打击乐器Midi-MC对照表"""
|
"""打击乐器Midi-MC对照表"""
|
||||||
|
|
||||||
volume_processing_function: Callable[[float], float]
|
volume_processing_function: FittingFunctionType
|
||||||
"""音量处理函数"""
|
"""音量处理函数"""
|
||||||
|
|
||||||
midi_music_name: str
|
midi_music_name: str
|
||||||
@ -112,13 +112,9 @@ class MidiConvert:
|
|||||||
midi_obj: VoidMido,
|
midi_obj: VoidMido,
|
||||||
midi_name: str,
|
midi_name: str,
|
||||||
enable_old_exe_format: bool = False,
|
enable_old_exe_format: bool = False,
|
||||||
pitched_note_rtable: Dict[
|
pitched_note_rtable: MidiInstrumentTableType = MM_TOUCH_PITCHED_INSTRUMENT_TABLE,
|
||||||
int, Tuple[str, int]
|
percussion_note_rtable: MidiInstrumentTableType = MM_TOUCH_PERCUSSION_INSTRUMENT_TABLE,
|
||||||
] = MM_TOUCH_PITCHED_INSTRUMENT_TABLE,
|
vol_processing_function: FittingFunctionType = natural_curve,
|
||||||
percussion_note_rtable: Dict[
|
|
||||||
int, Tuple[str, int]
|
|
||||||
] = MM_TOUCH_PERCUSSION_INSTRUMENT_TABLE,
|
|
||||||
vol_processing_function: Callable[[float], float] = natural_curve,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
简单的midi转换类,将midi对象转换为我的世界结构或者包
|
简单的midi转换类,将midi对象转换为我的世界结构或者包
|
||||||
@ -162,13 +158,9 @@ class MidiConvert:
|
|||||||
cls,
|
cls,
|
||||||
midi_file_path: str,
|
midi_file_path: str,
|
||||||
old_exe_format: bool = False,
|
old_exe_format: bool = False,
|
||||||
pitched_note_table: Dict[
|
pitched_note_table: MidiInstrumentTableType = MM_TOUCH_PITCHED_INSTRUMENT_TABLE,
|
||||||
int, Tuple[str, int]
|
percussion_note_table: MidiInstrumentTableType = MM_TOUCH_PERCUSSION_INSTRUMENT_TABLE,
|
||||||
] = MM_TOUCH_PITCHED_INSTRUMENT_TABLE,
|
vol_processing_func: FittingFunctionType = natural_curve,
|
||||||
percussion_note_table: Dict[
|
|
||||||
int, Tuple[str, int]
|
|
||||||
] = MM_TOUCH_PERCUSSION_INSTRUMENT_TABLE,
|
|
||||||
vol_processing_func: Callable[[float], float] = natural_curve,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
直接输入文件地址,将midi文件读入
|
直接输入文件地址,将midi文件读入
|
||||||
@ -211,7 +203,7 @@ class MidiConvert:
|
|||||||
self,
|
self,
|
||||||
max_score: int,
|
max_score: int,
|
||||||
scoreboard_name: str,
|
scoreboard_name: str,
|
||||||
progressbar_style: tuple = DEFAULT_PROGRESSBAR_STYLE,
|
progressbar_style: ProgressBarStyleType = DEFAULT_PROGRESSBAR_STYLE,
|
||||||
) -> List[SingleCommand]:
|
) -> List[SingleCommand]:
|
||||||
"""
|
"""
|
||||||
生成进度条
|
生成进度条
|
||||||
|
@ -16,13 +16,25 @@ Terms & Conditions: License.md in the root directory
|
|||||||
# Email TriM-Organization@hotmail.com
|
# Email TriM-Organization@hotmail.com
|
||||||
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
||||||
|
|
||||||
from typing import Any, Dict, List, Literal, Optional, Tuple, Union
|
from typing import Any, Dict, List, Literal, Optional, Tuple, Union, Iterable, Sequence, Mapping, Callable
|
||||||
|
|
||||||
import mido
|
import mido
|
||||||
|
|
||||||
from .subclass import SingleNote
|
from .subclass import SingleNote
|
||||||
|
|
||||||
ProgressStyle = Tuple[str, Tuple[str, str]]
|
MidiNoteNameTableType = Mapping[int, Tuple[str, ...]]
|
||||||
|
"""
|
||||||
|
Midi音符名称对照表类型
|
||||||
|
"""
|
||||||
|
|
||||||
|
MidiInstrumentTableType = Mapping[int, Tuple[str, int]]
|
||||||
|
"""
|
||||||
|
Midi乐器对照表类型
|
||||||
|
"""
|
||||||
|
|
||||||
|
FittingFunctionType = Callable[[float], float]
|
||||||
|
|
||||||
|
ProgressBarStyleType = Tuple[str, Tuple[str, str]]
|
||||||
"""
|
"""
|
||||||
进度条样式类型
|
进度条样式类型
|
||||||
"""
|
"""
|
||||||
|
@ -21,7 +21,7 @@ import random
|
|||||||
from .constants import MM_INSTRUMENT_DEVIATION_TABLE, MC_INSTRUMENT_BLOCKS_TABLE
|
from .constants import MM_INSTRUMENT_DEVIATION_TABLE, MC_INSTRUMENT_BLOCKS_TABLE
|
||||||
from .subclass import SingleNote
|
from .subclass import SingleNote
|
||||||
|
|
||||||
from typing import Any, Dict, Tuple, Optional, Callable, Literal, Union
|
from .types import Any, Dict, Tuple, Optional, Callable, Literal, Union, MidiInstrumentTableType
|
||||||
|
|
||||||
|
|
||||||
def mctick2timestr(mc_tick: int) -> str:
|
def mctick2timestr(mc_tick: int) -> str:
|
||||||
@ -47,7 +47,7 @@ def empty_midi_channels(channel_count: int = 17, staff: Any = {}) -> Dict[int, A
|
|||||||
|
|
||||||
def inst_to_sould_with_deviation(
|
def inst_to_sould_with_deviation(
|
||||||
instrumentID: int,
|
instrumentID: int,
|
||||||
reference_table: Dict[int, Tuple[str, int]],
|
reference_table: MidiInstrumentTableType,
|
||||||
default_instrument: str = "note.flute",
|
default_instrument: str = "note.flute",
|
||||||
default_deviation: Optional[int] = 5,
|
default_deviation: Optional[int] = 5,
|
||||||
) -> Tuple[str, int]:
|
) -> Tuple[str, int]:
|
||||||
@ -133,7 +133,7 @@ def straight_line(vol: float) -> float:
|
|||||||
|
|
||||||
def note_to_command_parameters(
|
def note_to_command_parameters(
|
||||||
note_: SingleNote,
|
note_: SingleNote,
|
||||||
reference_table: Dict[int, Tuple[str, int]],
|
reference_table: MidiInstrumentTableType,
|
||||||
volume_percentage: float = 1,
|
volume_percentage: float = 1,
|
||||||
volume_processing_method: Callable[[float], float] = natural_curve,
|
volume_processing_method: Callable[[float], float] = natural_curve,
|
||||||
) -> Tuple[str, float, float, Union[float, Literal[None]],]:
|
) -> Tuple[str, float, float, Union[float, Literal[None]],]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user