Struct exmod::Context[][src]

pub struct Context(_);
Expand description

Module context.

Can contain only one module and provides functions for manipulating it.

Implementations

Create a context.

The module parameter sets a contents of the module. The rate parameter specifies a sample rate (in Hz) with which samples will be generated.

Example
use exmod::Context;

let context = Context::new(include_bytes!("module.xm"), 44100).unwrap();

Returns a raw pointer to the inner context.

Creates a context directly from the raw pointer of another context.

Safety

Pointer must be previously allocated via new function or it’s equivalent - xm_create_context_safe.

Play the module and put a generated sample in the output slice.

Requires mutability because generating samples moves a playback cursor within context.

Create silence if the end of the module or the specified loop count is reached.

See examples crate folder for comprehensive example.

Get the current number of playback loops of the module.

The number will increase with each loop. When the maximum number of loops is reached, calls to generate_sample will only generate silence. You can set number of loops with set_max_loop_count.

Set the max number of playback loops of the module. See also loop_count.

Get the number of module channels.

Get the module length.

Get the number of module patterns.

Get the number of module rows.

Get the number of module instruments.

Get the number of module samples.

Get the panning of specific channel.

Get the volume of specific channel.

Get the frequency of specific channel.

Check if the channel is active.

Get the latest trigger of specific instrument.

Get the latest trigger of specific sample.

Get the latest trigger of specific channel.

Get the module playing speed.

Get the current playback position.

Mute the specific channel.

Mute the specific instrument.

Seek the playback cursor to the specified position.

Safety

Seek feature is broken by design and usually leads to access violation error, use at your own risk.

Get the module name.

Safety

The library relies that the module name will be encoded in UTF-8. If not, UB or invalid string is possible.

Get the the name of the tracker in which the module was created.

Safety

The library relies that the tracker name will be encoded in UTF-8. If not, UB or invalid string is possible.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.