# project_io
Project save and load system for DAW applications in Rust. Custom binary format with embedded JSON, autosave and undo/redo history.
## Features
- **Custom format** — `.dawproj` file: fixed binary header + UTF-8 JSON + plugin blobs
- **Integrity check** — FNV-1a 64-bit checksum over all content, verified on load
- **Version detection** — files from newer DAW versions return a clear error
- **Autosave** — background thread saves every N minutes, keeps last N files
- **Undo/redo history** — snapshot stack with memory limits and per-action labels
- **Plugin blobs** — opaque plugin state stored in binary section, indexed from JSON
- **Pretty mode** — human-readable JSON for debugging
## File format
```
┌─────────────────────────────────────┐
│ MAGIC [8 bytes] "DAWPROJ\0" │
│ VERSION [4 bytes] u32 le │
│ FLAGS [4 bytes] u32 le │
│ JSON_LEN [8 bytes] u64 le │
│ BLOB_LEN [8 bytes] u64 le │
│ CHECKSUM [8 bytes] FNV-1a 64 │
├─────────────────────────────────────┤
│ JSON_BODY UTF-8 project state │
├─────────────────────────────────────┤
│ BLOB_BODY binary plugin states │
└─────────────────────────────────────┘
```
## Usage
```rust
use project_io::{ProjectSchema, ProjectSerializer, ProjectDeserializer};
use project_io::autosave::{AutoSave, AutoSaveConfig};
use project_io::history::ProjectHistory;
// Save
let schema = ProjectSchema::new("My Track");
let serializer = ProjectSerializer::new();
serializer.save(&schema, &plugin_blobs, Path::new("my_track.dawproj"))?;
// Load
let (schema, blobs) = ProjectDeserializer::load(Path::new("my_track.dawproj"))?;
// Autosave
let config = AutoSaveConfig::new("/tmp/autosave", "my_track").every_minutes(5);
let autosave = AutoSave::new(config);
autosave.update_snapshot(schema.clone());
autosave.start(); // background thread
// Undo/redo
let mut history = ProjectHistory::new(50);
history.push(&schema, "Add note")?;
schema.bpm = 140.0;
let prev = history.undo(&schema)?.unwrap(); // back to 120 BPM
```
## Part of the DAW crate ecosystem
```
audio_core_dsp
midi_clock_sync
audio_graph
event_queue
mixer
piano_roll
plugin_host
project_io ← you are here
```
## License
MIT