pub struct Module {Show 18 fields
pub name: String,
pub comment: String,
pub profile: CompatibilityProfile,
pub frequency_type: FrequencyType,
pub restart_position: usize,
pub default_tempo: usize,
pub default_bpm: usize,
pub pattern_order: Vec<Vec<usize>>,
pub pattern: Vec<Pattern>,
pub pattern_names: Vec<String>,
pub channel_names: Vec<String>,
pub channel_defaults: Vec<ChannelDefault>,
pub instrument: Vec<Instrument>,
pub midi_macros: Option<MidiMacros>,
pub pattern_highlight: PatternHighlight,
pub mix_plugins: Option<MixPlugins>,
pub pitch_wheel_depth: u8,
pub mix_volume: Volume,
}Expand description
SoundTracker Module with Steroid
Fields§
§name: String§comment: String§profile: CompatibilityProfileThe format this module was authored in, plus the playback
quirks that match its authoring tracker. See
crate::compatibility_profile::CompatibilityProfile for
the named constructors importers use; editor-authored
modules typically leave this at
CompatibilityProfile::modern for clean, quirk-free
playback.
frequency_type: FrequencyType§restart_position: usizeRestart index in pattern_order
default_tempo: usize§default_bpm: usize§pattern_order: Vec<Vec<usize>>Defines the exact order for the patterns playback It is possible to have several music in the same Module
pattern: Vec<Pattern>§pattern_names: Vec<String>§channel_names: Vec<String>§channel_defaults: Vec<ChannelDefault>Per-channel initial state, applied at song start before any pattern row plays. Each entry bundles every property a format’s header can pre-set on a channel: panning, channel volume, mute, surround. Empty means “use defaults for every channel” (centre pan, full volume, unmuted, no surround).
Populated by formats whose header carries per-channel hints
— currently S3M (channel_settings) and IT (initial channel
pan/volume + surround sentinel). XM/MOD leave it empty:
those formats centre every channel at song start, and any
per-channel state that follows is encoded in the patterns.
instrument: Vec<Instrument>§midi_macros: Option<MidiMacros>Optional MIDI-macro table. Populated by the IT importer when
the source file carries an embedded-macros flag; None for
non-IT formats and for IT files without macros. Consumed by
the replayer’s MIDI-macro interpreter (per-channel filter
automation, MIDI-out, etc.).
pattern_highlight: PatternHighlightPattern-grid display hint (rows per beat / rows per measure).
Populated from the IT header; XM/S3M/MOD inherit the
PatternHighlight::default() 4/16 cadence.
mix_plugins: Option<MixPlugins>Optional IT-style mix-plugin table (OpenMPT extension).
None for non-IT formats and for IT files without an
embedded plugin section.
pitch_wheel_depth: u8MIDI pitch-wheel depth declared by the module author, in
semitones. The IT header carries this byte (ITTECH:94, “PWD:
Pitch wheel depth for MIDI controllers”) so downstream MIDI-
out code knows how to scale tracker pitch effects (Gxx/Fxx/
Exx) to MIDI 14-bit pitch-bend values when forwarding notes
played through InstrMidi / InstrOpl / InstrSid
instruments.
Not consumed by the core replayer. xmrsplayer renders
only InstrumentType::Default (sampled) instruments
natively; the synth / MIDI-out paths are the responsibility
of code that wraps the player and observes its events. This
field exists so such wrappers can read a single source of
truth instead of carrying their own per-module config.
Macro-driven pitch bend (Zxx / SFx macros encoding
En ll mm bytes) is unaffected — the macro author writes
the absolute 14-bit value directly, and xmrsplayer’s
MidiObserver emits it
verbatim. PWD only matters when downstream code is
generating pitch bend from a tracker semitone delta.
IT importer copies the header byte. Other formats default to 2 semitones — the General MIDI default a receiver would assume in the absence of an explicit RPN setup. Range per ITTECH is 0..=15.
mix_volume: VolumeSong-level mix volume scalar (0..1). IT-specific: each IT file carries a “mix volume” register (0..128, default 48) which is a constant mixer-level headroom applied on top of the Vxx-animated global volume. It is NOT part of the Vxx effect chain — authors set it once to reserve dynamic range for resonant-filter peaks and multi-voice summing.
Mix master amplifier, Q1.15 in [0, 1]. Multiplies the
final mixed audio. Was f32 — see Volume for the
conversion convention.
IT-specific (the IT importer reads it from the file
header). Non-IT formats leave this at Volume::FULL
(identity). The player reads it once at construction
and applies it as a final constant multiplier separate
from both global_volume and user-facing
amplification.
Implementations§
Source§impl Module
impl Module
Sourcepub fn get_song_length(&self, song: usize) -> usize
pub fn get_song_length(&self, song: usize) -> usize
get song length
Sourcepub fn get_num_channels(&self) -> usize
pub fn get_num_channels(&self) -> usize
get number of channels
Sourcepub fn get_num_rows(&self, pat_idx: usize) -> usize
pub fn get_num_rows(&self, pat_idx: usize) -> usize
get number of rows
Source§impl Module
impl Module
Sourcepub fn load_mod(source: &[u8]) -> Result<Self, DecodeError>
pub fn load_mod(source: &[u8]) -> Result<Self, DecodeError>
Try to import an Amiga ProTracker MOD file.
Sourcepub fn load_xm(source: &[u8]) -> Result<Self, DecodeError>
pub fn load_xm(source: &[u8]) -> Result<Self, DecodeError>
Try to import a Fast Tracker II XM module file.
Sourcepub fn load_s3m(source: &[u8]) -> Result<Self, DecodeError>
pub fn load_s3m(source: &[u8]) -> Result<Self, DecodeError>
Try to import a ScreamTracker 3 S3M module file.
Sourcepub fn load_it(source: &[u8]) -> Result<Self, DecodeError>
pub fn load_it(source: &[u8]) -> Result<Self, DecodeError>
Try to import an Impulse Tracker IT module file.
Sourcepub fn load(source: &[u8]) -> Result<Self, DecodeError>
pub fn load(source: &[u8]) -> Result<Self, DecodeError>
Try to auto-detect and import any supported historical module
file (MOD / XM / S3M / IT). Formats are tried in the order
XM → S3M → IT → MOD; the Amiga format is tried last because it
has the weakest header signature for detection. Only formats
whose import_* feature is enabled are attempted.
SID is not auto-detected here — it has its own dedicated entry
point via crate::import::sid::sid_module::SidModule::load.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Module
impl<'de> Deserialize<'de> for Module
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl ModuleDuration for Module
impl ModuleDuration for Module
Source§fn duration(&self, song: usize) -> Duration
fn duration(&self, song: usize) -> Duration
song, with default
options. Returns Duration::ZERO for out-of-range / empty
inputs. Read moreSource§fn duration_with(&self, song: usize, opts: DurationOptions) -> Duration
fn duration_with(&self, song: usize, opts: DurationOptions) -> Duration
Self::duration but with explicit options. Useful
to measure several consecutive plays (set stop_on_loop: false) or to tighten the runaway cap on memory-constrained
targets. Read more