# Music Authoring Interface

## Source Of Truth

Task `TODOS.phase-72.72.22.1.12` is implemented in `V2Editor` as the
`EV2EditorToolSurface::MusicAuthoring` surface and `Tool.MusicAuthoring` editor
tab. The interface depends on `V2Audio` so authored views are backed by the same
adaptive music state machine, horizontal resequencing arrangement, and vertical
music layering arrangement used by runtime audio.

The contract is
`V2/ue/Content/V2/Audio/MusicAuthoringInterface_V2_Contract.json`. The focused
automation spec is `V2.Editor.Music.AuthoringInterface`, with module coverage in
`V2.Editor.Module`.

## Authoring Surface

`FV2MusicAuthoringWidgetSpec` defines the operational editor surface with a
state graph, transition editor, layer assignment matrix, game state simulation
panel, and validation panel. The model is built through:

- `BuildMusicAuthoringWidgetSpec`
- `BuildMusicAuthoringSimulationRequest`
- `BuildMusicAuthoringInterfaceModel`

`FV2MusicAuthoringInterfaceModel` exposes the rows needed by an editor widget:

- `EV2MusicAuthoringIssueType` for blocking validation failures and nonblocking
  build evidence.
- `FV2MusicAuthoringStateRow` for adaptive music states.
- `FV2MusicAuthoringTransitionRow` for transition rules such as
  `Music.Transition.ExplorationToTension`.
- `FV2MusicAuthoringLayerAssignmentRow` for vertical layers such as
  `Music.Layer.Combat.Drums` and `Music.Layer.Tension.Strings.Sunset`.
- `FV2MusicAuthoringIssue` entries for validation and build evidence.
- `FV2MusicAuthoringSimulationRequest` and `FV2MusicAuthoringSimulationResult`
  for in-editor game state preview.

## Game State Simulation

The simulation request feeds the active game state, desired state, current
section, stage/profile ids, game intensity, and context tags into the authored
model. The model evaluates:

- adaptive state resolution through
  `FV2AdaptiveMusicStateMachine::ResolveState`;
- horizontal section preview through
  `FV2HorizontalMusicResequencingArrangement::ResolveSection`;
- vertical layer preview through
  `FV2VerticalMusicLayeringArrangement::ResolveLayers`.

A valid preview returns `FV2MusicAuthoringSimulationResult` with
`Editor.MusicAuthoring.Accepted.GameStateSimulation`, a target section such as
`Music.Section.Tension.Chorus`, and active layer ids for the simulated context.

## Validation Commands

Run the focused and adjacent checks:

```bash
python3 V2/ue/Tools/check-v2-music-authoring-interface.py
python3 V2/ue/Tools/check-v2-editor-module.py
python3 V2/ue/Tools/check-v2-audio-module.py
python3 V2/ue/Tools/check-v2-ci-workflow.py
python3 V2/ue/Tools/check-v2-buildgraph.py
python3 V2/tools/validate-v2-docs.py
python3 -m json.tool V2/ue/Content/V2/Audio/MusicAuthoringInterface_V2_Contract.json
```
