pub struct Module {Show 15 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 mix_volume: f32,
}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.).
mix_volume: f32Song-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.
Non-IT formats leave this at 1.0 (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.