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.
pub fn latest_trigger_of_sample(
&self,
instrument: u16,
sample: u16
) -> Result<u64, OutOfBoundsError>
pub fn latest_trigger_of_sample(
&self,
instrument: u16,
sample: u16
) -> Result<u64, OutOfBoundsError>
Get the latest trigger of specific sample.
Get the latest trigger of specific channel.
Get the module playing speed.
Mute the specific channel.
pub fn mute_instrument(
&mut self,
instrument: u16,
mute: bool
) -> Result<bool, OutOfBoundsError>
pub fn mute_instrument(
&mut self,
instrument: u16,
mute: bool
) -> Result<bool, OutOfBoundsError>
Mute the specific instrument.
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.