Struct libxm::XMContext [] [src]

pub struct XMContext {
    // some fields omitted
}

The XM context.

Methods

impl XMContext

fn new(mod_data: &[u8], rate: u32) -> Result<XMContext, XMError>

Creates an XM context.

Parameters

  • mod_data - The contents of the module.
  • rate - The play rate in Hz. Recommended value is 48000.

fn generate_samples(&mut self, output: &mut [f32])

Plays the module and puts the sound samples in the specified output buffer. The output is in stereo.

fn set_max_loop_count(&mut self, loopcnt: u8)

Sets the maximum number of times a module can loop.

After the specified number of loops, calls to generate_samples() will generate silence.

fn loop_count(&self) -> u8

Gets the loop count of the currently playing module.

This value is 0 when the module is still playing, 1 when the module has looped once, etc.

fn module_name(&self) -> &[u8]

Gets the module name as a byte slice. The string encoding is unknown.

fn tracker_name(&self) -> &[u8]

Gets the tracker name as a byte slice. The string encoding is unknown.

fn number_of_channels(&self) -> u16

Gets the number of channels.

fn module_length(&self) -> u16

Gets the module length (in patterns).

fn number_of_patterns(&self) -> u16

Gets the number of patterns.

fn number_of_rows(&self, pattern: u16) -> u16

Gets the number of rows in a pattern.

Note

Pattern numbers go from 0 to get_number_of_patterns() - 1

fn number_of_instruments(&self) -> u16

Gets the number of instruments.

fn number_of_samples(&self, instrument: u16) -> u16

Gets the number of samples of an instrument.

Note

Instrument numbers go from 1 to get_number_of_instruments()

fn playing_speed(&self) -> PlayingSpeed

Gets the current module speed.

fn position(&self) -> Position

Gets the current position in the module being played.

fn latest_trigger_of_instrument(&self, instrument: u16) -> u64

Gets the latest time (in number of generated samples) when a particular instrument was triggered in any channel.

Note

Instrument numbers go from 1 to get_number_of_instruments()

fn latest_trigger_of_sample(&self, instrument: u16, sample: u16) -> u64

Get the latest time (in number of generated samples) when a particular sample was triggered in any channel.

Note

Instrument numbers go from 1 to get_number_of_instruments()

Sample numbers go from 0 to get_number_of_samples(instrument) - 1

fn latest_trigger_of_channel(&self, channel: u16) -> u64

Get the latest time (in number of generated samples) when any instrument was triggered in a given channel.

Note

Channel numbers go from 1 to get_number_of_channels()

Trait Implementations

impl Send for XMContext

impl Sync for XMContext

impl Drop for XMContext

fn drop(&mut self)