A TUI-based JSON editor for YM2151 event logs, written in Rust for Windows. The application provides visualization and editing capabilities for YM2151 synthesizer event data.
src/
├── main.rs - Entry point, terminal setup, event loop
├── app.rs - Application state and business logic
├── models.rs - Data structures (Ym2151Event, Ym2151Log)
└── ui.rs - UI rendering logic
time: f64 - Absolute timestamp in secondsaddr: String - Register address (hex)data: String - Register data value (hex)events: VecCumulative - Shows delta time from previous event (for editing)Timestamp - Shows absolute time from start (internal format for saving)Events with address 0x08 are displayed as “KeyON” instead of the register address to improve readability. This register controls note on/off operations in YM2151.
Format: {time} KeyON {data}
Two modes for time visualization:
Cumulative Mode (default):
0.010000 40 16 (10ms after previous event)Timestamp Mode:
0.010000 40 16 (10ms from start)Toggle with T key during runtime.
Loading:
ym2151-log-editor path/to/file.json
Saving:
S key to save| Key | Action | |—–|——–| | ↑/↓ | Navigate through events | | / or ENTER | Insert new event before current line | | DELETE | Delete current event | | 0-9 | Set wait time (0-9ms, Cumulative mode only) | | P | Preview playback from start to current event | | T | Toggle time display mode | | S | Save current file | | Q/ESC | Quit application |
┌─────────────────────────────────────┐
│ YM2151 Log Editor - filename │
│ Time: Cumulative/Timestamp │
├─────────────────────────────────────┤
│ Event list (scrollable) │
│ > 0.000000 20 4F │
│ 0.010000 KeyON 78 │
│ ... │
├─────────────────────────────────────┤
│ ↑/↓: Navigate | T: Toggle | S: Save│
└─────────────────────────────────────┘
cargo build --release
# With file argument
cargo run -- path/to/file.json
# Or run compiled binary
./target/release/ym2151-log-editor path/to/file.json
# Run in development mode
cargo run -- test_data/sample.json
# Run tests (when implemented)
cargo test
# Check code
cargo clippy
cargo fmt
test_data/sample.json - Sample YM2151 log with various eventsratatui = "0.29" # TUI framework
crossterm = "0.29" # Terminal backend
serde = "1.0" # Serialization framework
serde_json = "1.0" # JSON support
This jumpstart implementation provides a solid foundation for the YM2151 Log Editor. The core visualization and file handling features are working, and the architecture is designed to easily accommodate future enhancements for editing capabilities.
The main use case of “JSON visualization and easier time field editing” has a strong foundation with the time toggle feature, though actual editing of time values will be added in Phase 2.