Skip to main content

Crate xmrs

Crate xmrs 

Source
Expand description

§xmrs — A Safe SoundTracker Library

§Architecture

xmrs
├── core/                        ← Modern DAW data model (format-agnostic)
│   ├── module::Module
│   │    ├── instrument: Vec<Instrument>
│   │    ├── tracks: Vec<Track> ──► Cell { event, effects: Vec<TrackEffect> }
│   │    ├── clips: SortedClips
│   │    ├── automation: Vec<AutomationLane>
│   │    ├── timeline_map: TimelineMap
│   │    └── quirks: PlaybackQuirks (default all-off)
│   ├── compatibility::{PlaybackQuirks, PanResetPolicy}
│   ├── instr_{opl, sid, robsid} ← chip-synth voices (cfg `synth_opl`/`synth_sid`)
│   ├── daw/                     ← AutomationLane, Clip, Track, TimelineMap, Euclidean
│   └── fixed/                   ← Q-format primitives
│
├── format/                      ← Native `.xmr` project format (cfg `format`)
│   ├── container                ← chunked byte grammar, PNG-style case bits
│   ├── wire::v1                 ← frozen schema v1 payloads (CBOR)
│   ├── pcm                      ← raw `PCM ` blob region, deduplicated
│   └── document::{read, write}  ← Module ⇄ bytes, + LoadReport
│
└── tracker/                     ← Historical-format support
    ├── format::ModuleFormat     ← (gated on any `import_*`)
    ├── profiles::{ft2, it214, st3, pt}    ← preset quirks
    ├── period::FrequencyType
    ├── codepage                 ← CP437 / Latin-1
    ├── mix_plugin               ← IT OpenMPT extension (cfg import_it)
    └── import/                  ← XM / IT / S3M / MOD / SID readers
        ├── build/               ← Pattern → Tracks + Clips + TimelineMap
        └── extract/             ← TrackImportUnit → AutomationLane

§Features

Default std + import matches the desktop / server case. For a clean no-tracker build:

[dependencies]
xmrs = { version = "0.15", default-features = false, features = ["std"] }

In this mode Module carries only the universal fields: no origin, no mix_plugins. The historical presets in tracker::profiles are absent — quirks are all-off by default.

InstrumentType’s variant set does not shrink: the chip instruments (Opl / Sid / RobSid) are format-agnostic, integer-only data and are compiled in every build. Only their render engines gate on synth_opl / synth_sid. That split is what lets a .xmr written by a full build be read, kept and re-saved by a build that cannot synthesise a note of it.

§Saving

Module derives serde, so any codec will round-trip it — fine for a cache, wrong for an archive, since a derived repr carries no version. Enable format for the project’s own archival format instead (module format, absent without it): a chunked container, a frozen per-schema wire layer, sample data kept out of CBOR, and a LoadReport that names anything a read had to skip.

Modules§

core
Core data model — format-agnostic. Core data model — format-agnostic.
edit
Edit command API (atomic, undoable mutations of Module) Editing API: atomic, validated, undoable commands.
format
Native .xmr file format — chunked container + CBOR wire types (gated on the format feature). See src/core/FORMAT_RFC.md. Native .xmr file format — the chunked container, the frozen wire::vN types, the migration chain, and the CBOR codec. See src/core/FORMAT_RFC.md for the specification and the reasoning.
generators
Signal / event generators (runtime synthesis & rhythm engines) — see the module docs. Sits beside core and tracker: not format I/O, not the bare model, but the things that generate at playback. Signal / event generators — the runtime engines that produce sound or note events at playback, as opposed to crate::core (the format-agnostic data model) and crate::tracker (format I/O and the format-tied data structures).
prelude
The Xmrs Prelude The Xmrs Prelude.
tracker
Format-tied items: presets, importers, format helpers. (Chip-synthesis instruments are format-agnostic and live in crate::core, not here.) Most sub-modules are gated behind one or more import_* features. Format-tied items: presets of crate::core::compatibility::PlaybackQuirks mirroring historical trackers, the format::ModuleFormat tag, and the import readers / build / extract pipelines. (The chip-synthesis instrument types are not here — they are format-agnostic authoring primitives and live under crate::core.)

Macros§

q8_8
Q8.8 from an f32 literal. Same compile-time-fold caveat as q15!.
q15
Q1.15 from an f32 literal. Compile-time foldable at release opt level.