Skip to content

MuseScore I/O の内部構造を段階的に整理し import/export の責務境界を明確化#167

Merged
igapyon merged 1 commit intodevelfrom
tiga0414jce
Apr 14, 2026
Merged

MuseScore I/O の内部構造を段階的に整理し import/export の責務境界を明確化#167
igapyon merged 1 commit intodevelfrom
tiga0414jce

Conversation

@igapyon
Copy link
Copy Markdown
Owner

@igapyon igapyon commented Apr 14, 2026

概要

src/ts/musescore-io.ts の内部構造を整理し、MuseScore import / export の責務境界をこれまでより明確にする変更です。 このコミットでは、公開 API の追加や削除ではなく、主に内部 helper・状態・処理単位の分解と再構成が行われています。

あわせて、生成物である src/js/main.js および mikuscore.html が更新されています。

変更内容

1. MuseScore import 側の処理分解

src/ts/musescore-io.ts で、MuseScore -> MusicXML 変換の part / measure / voice 単位の処理が分解されています。

含まれる変更例:

  • measure 単位の attribute 出力要否判定の切り出し
  • import 時の measure header 組み立て処理の分離
  • part 内 voice 番号解決 helper の分離
  • primary measure / staff measure 解決 helper の追加
  • measure 完成処理の分離
  • voice 出力処理の分離

2. MusicXML export 側の処理分解

MusicXML -> MuseScore 変換でも、metadata / part scaffold / measure context / staff state / voice rendering などの単位で helper や型が追加されています。

含まれる変更例:

  • part identity、document body、staff state などの型追加
  • MusicXML metadata 読み取り helper の整理
  • part 定義 body / instrument XML の組み立て処理の分離
  • measure context に clef / key / time / repeat などの出力判断を集約
  • direction seed の XML 化 helper の追加
  • export の voice / measure / staff 単位の描画処理分離
  • MusicXML note / direction / barline の child dispatch 処理分解

3. measure / voice / event データフローの明示化

内部的に、以下のような責務のまとまりがより明示されています。

  • import 側:
    • measure header 判定
    • part voice 解決
    • voice event 出力
    • measure 完成処理
  • export 側:
    • metadata 抽出
    • part scaffold 構築
    • measure context 構築
    • staff state 更新
    • voice event 生成
    • child dispatch 処理

4. 生成物の更新

以下の生成物が更新されています。

  • src/js/main.js
  • mikuscore.html

変更ファイル

  • src/ts/musescore-io.ts
  • src/js/main.js
  • mikuscore.html

目的

この変更の主目的は、src/ts/musescore-io.ts に集中していた import / export / 共通 helper の責務を段階的に整理し、今後の仕様拡張や追加分割に備えた内部構造に近づけることです。

## 概要

`src/ts/musescore-io.ts` の内部構造を整理し、MuseScore import / export の責務境界をこれまでより明確にする変更です。
このコミットでは、公開 API の追加や削除ではなく、主に内部 helper・状態・処理単位の分解と再構成が行われています。

あわせて、生成物である `src/js/main.js` および `mikuscore.html` が更新されています。

## 変更内容

### 1. MuseScore import 側の処理分解

`src/ts/musescore-io.ts` で、MuseScore -> MusicXML 変換の part / measure / voice 単位の処理が分解されています。

含まれる変更例:
- measure 単位の attribute 出力要否判定の切り出し
- import 時の measure header 組み立て処理の分離
- part 内 voice 番号解決 helper の分離
- primary measure / staff measure 解決 helper の追加
- measure 完成処理の分離
- voice 出力処理の分離

### 2. MusicXML export 側の処理分解

MusicXML -> MuseScore 変換でも、metadata / part scaffold / measure context / staff state / voice rendering などの単位で helper や型が追加されています。

含まれる変更例:
- part identity、document body、staff state などの型追加
- MusicXML metadata 読み取り helper の整理
- part 定義 body / instrument XML の組み立て処理の分離
- measure context に clef / key / time / repeat などの出力判断を集約
- direction seed の XML 化 helper の追加
- export の voice / measure / staff 単位の描画処理分離
- MusicXML note / direction / barline の child dispatch 処理分解

### 3. measure / voice / event データフローの明示化

内部的に、以下のような責務のまとまりがより明示されています。

- import 側:
  - measure header 判定
  - part voice 解決
  - voice event 出力
  - measure 完成処理
- export 側:
  - metadata 抽出
  - part scaffold 構築
  - measure context 構築
  - staff state 更新
  - voice event 生成
  - child dispatch 処理

### 4. 生成物の更新

以下の生成物が更新されています。

- `src/js/main.js`
- `mikuscore.html`

## 変更ファイル

- `src/ts/musescore-io.ts`
- `src/js/main.js`
- `mikuscore.html`

## 目的

この変更の主目的は、`src/ts/musescore-io.ts` に集中していた import / export / 共通 helper の責務を段階的に整理し、今後の仕様拡張や追加分割に備えた内部構造に近づけることです。
@igapyon igapyon merged commit 932515a into devel Apr 14, 2026
@igapyon igapyon deleted the tiga0414jce branch April 14, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant