Skip to main content

Module

Struct Module 

Source
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: CompatibilityProfile

The 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: usize

Restart 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: f32

Song-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

Source

pub fn get_song_length(&self, song: usize) -> usize

get song length

Source

pub fn get_num_channels(&self) -> usize

get number of channels

Source

pub fn get_num_rows(&self, pat_idx: usize) -> usize

get number of rows

Source§

impl Module

Source

pub fn load_mod(source: &[u8]) -> Result<Self, DecodeError>

Try to import an Amiga ProTracker MOD file.

Source

pub fn load_xm(source: &[u8]) -> Result<Self, DecodeError>

Try to import a Fast Tracker II XM module file.

Source

pub fn load_s3m(source: &[u8]) -> Result<Self, DecodeError>

Try to import a ScreamTracker 3 S3M module file.

Source

pub fn load_it(source: &[u8]) -> Result<Self, DecodeError>

Try to import an Impulse Tracker IT module file.

Source

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 Debug for Module

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Module

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Module

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Module

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,