libopenmpt
0.2.3746
cross-platform C++ and C library to decode tracked music files
|
#include <libopenmpt/libopenmpt.hpp>
Public Types | |
enum | render_param { RENDER_MASTERGAIN_MILLIBEL = 1, RENDER_STEREOSEPARATION_PERCENT = 2, RENDER_INTERPOLATIONFILTER_LENGTH = 3, RENDER_VOLUMERAMPING_STRENGTH = 4 } |
Parameter index to use with openmpt::module::get_render_param and openmpt::module::set_render_param. More... | |
enum | command_index { command_note = 0, command_instrument = 1, command_volumeffect = 2, command_effect = 3, command_volume = 4, command_parameter = 5 } |
Public Member Functions | |
module (std::istream &stream, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map()) | |
Construct a openmpt::module. | |
module (const std::vector< std::uint8_t > &data, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map()) | |
module (const std::uint8_t *beg, const std::uint8_t *end, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map()) | |
module (const std::uint8_t *data, std::size_t size, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map()) | |
module (const std::vector< char > &data, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map()) | |
module (const char *beg, const char *end, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map()) | |
module (const char *data, std::size_t size, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map()) | |
module (const void *data, std::size_t size, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map()) | |
virtual | ~module () |
void | select_subsong (std::int32_t subsong) |
Select a subsong from a multi-song module. | |
void | set_repeat_count (std::int32_t repeat_count) |
Set Repeat Count. | |
std::int32_t | get_repeat_count () const |
Get Repeat Count. | |
double | get_duration_seconds () const |
Get approximate song duration. | |
double | set_position_seconds (double seconds) |
Set approximate current song position. | |
double | get_position_seconds () const |
Get approximate current song position. | |
double | set_position_order_row (std::int32_t order, std::int32_t row) |
Set approximate current song position. | |
std::int32_t | get_render_param (int param) const |
Get render parameter. | |
void | set_render_param (int param, std::int32_t value) |
Set render parameter. | |
std::vector< std::string > | get_metadata_keys () const |
Get the list of supported metadata item keys. | |
std::string | get_metadata (const std::string &key) const |
Get a metadata item value. | |
std::int32_t | get_current_speed () const |
std::int32_t | get_current_tempo () const |
std::int32_t | get_current_order () const |
std::int32_t | get_current_pattern () const |
std::int32_t | get_current_row () const |
std::int32_t | get_current_playing_channels () const |
float | get_current_channel_vu_mono (std::int32_t channel) const |
float | get_current_channel_vu_left (std::int32_t channel) const |
float | get_current_channel_vu_right (std::int32_t channel) const |
float | get_current_channel_vu_rear_left (std::int32_t channel) const |
float | get_current_channel_vu_rear_right (std::int32_t channel) const |
std::int32_t | get_num_subsongs () const |
std::int32_t | get_num_channels () const |
std::int32_t | get_num_orders () const |
std::int32_t | get_num_patterns () const |
std::int32_t | get_num_instruments () const |
std::int32_t | get_num_samples () const |
std::vector< std::string > | get_subsong_names () const |
std::vector< std::string > | get_channel_names () const |
std::vector< std::string > | get_order_names () const |
std::vector< std::string > | get_pattern_names () const |
std::vector< std::string > | get_instrument_names () const |
std::vector< std::string > | get_sample_names () const |
std::int32_t | get_order_pattern (std::int32_t order) const |
std::int32_t | get_pattern_num_rows (std::int32_t pattern) const |
std::uint8_t | get_pattern_row_channel_command (std::int32_t pattern, std::int32_t row, std::int32_t channel, int command) const |
std::string | format_pattern_row_channel_command (std::int32_t pattern, std::int32_t row, std::int32_t channel, int command) const |
std::string | highlight_pattern_row_channel_command (std::int32_t pattern, std::int32_t row, std::int32_t channel, int command) const |
std::string | format_pattern_row_channel (std::int32_t pattern, std::int32_t row, std::int32_t channel, std::size_t width=0, bool pad=true) const |
std::string | highlight_pattern_row_channel (std::int32_t pattern, std::int32_t row, std::int32_t channel, std::size_t width=0, bool pad=true) const |
std::vector< std::string > | get_ctls () const |
std::string | ctl_get (const std::string &ctl) const |
void | ctl_set (const std::string &ctl, const std::string &value) |
std::size_t | read (std::int32_t samplerate, std::size_t count, std::int16_t *mono) |
Render audio data. | |
std::size_t | read (std::int32_t samplerate, std::size_t count, std::int16_t *left, std::int16_t *right) |
Render audio data. | |
std::size_t | read (std::int32_t samplerate, std::size_t count, std::int16_t *left, std::int16_t *right, std::int16_t *rear_left, std::int16_t *rear_right) |
Render audio data. | |
std::size_t | read (std::int32_t samplerate, std::size_t count, float *mono) |
Render audio data. | |
std::size_t | read (std::int32_t samplerate, std::size_t count, float *left, float *right) |
Render audio data. | |
std::size_t | read (std::int32_t samplerate, std::size_t count, float *left, float *right, float *rear_left, float *rear_right) |
Render audio data. | |
std::size_t | read_interleaved_stereo (std::int32_t samplerate, std::size_t count, std::int16_t *interleaved_stereo) |
Render audio data. | |
std::size_t | read_interleaved_quad (std::int32_t samplerate, std::size_t count, std::int16_t *interleaved_quad) |
Render audio data. | |
std::size_t | read_interleaved_stereo (std::int32_t samplerate, std::size_t count, float *interleaved_stereo) |
Render audio data. | |
std::size_t | read_interleaved_quad (std::int32_t samplerate, std::size_t count, float *interleaved_quad) |
Render audio data. |
Friends | |
class | module_ext |
Parameter index to use with openmpt::module::get_render_param and openmpt::module::set_render_param.
openmpt::module::module | ( | std::istream & | stream, |
std::ostream & | log = std::clog , |
||
const std::map< std::string, std::string > & | ctls = detail::initial_ctls_map() |
||
) |
Construct a openmpt::module.
stream | Input stream from which the module is loaded. After the constructor has finished successfully, the input position of stream is set to the byte after the last byte that has been read. If the constructor fails, the state of the input position of stream is undefined. |
log | Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. |
ctls | A map of initial ctl values, see openmpt::modules::get_ctls. |
openmpt::module::module | ( | const std::vector< std::uint8_t > & | data, |
std::ostream & | log = std::clog , |
||
const std::map< std::string, std::string > & | ctls = detail::initial_ctls_map() |
||
) |
data | Data to load the module from. |
log | Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. |
ctls | A map of initial ctl values, see openmpt::modules::get_ctls. |
openmpt::module::module | ( | const std::uint8_t * | beg, |
const std::uint8_t * | end, | ||
std::ostream & | log = std::clog , |
||
const std::map< std::string, std::string > & | ctls = detail::initial_ctls_map() |
||
) |
beg | Begin of data to load the module from. |
end | End of data to load the module from. |
log | Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. |
ctls | A map of initial ctl values, see openmpt::modules::get_ctls. |
openmpt::module::module | ( | const std::uint8_t * | data, |
std::size_t | size, | ||
std::ostream & | log = std::clog , |
||
const std::map< std::string, std::string > & | ctls = detail::initial_ctls_map() |
||
) |
data | Data to load the module from. |
size | Amount of data available. |
log | Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. |
ctls | A map of initial ctl values, see openmpt::modules::get_ctls. |
openmpt::module::module | ( | const std::vector< char > & | data, |
std::ostream & | log = std::clog , |
||
const std::map< std::string, std::string > & | ctls = detail::initial_ctls_map() |
||
) |
data | Data to load the module from. |
log | Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. |
ctls | A map of initial ctl values, see openmpt::modules::get_ctls. |
openmpt::module::module | ( | const char * | beg, |
const char * | end, | ||
std::ostream & | log = std::clog , |
||
const std::map< std::string, std::string > & | ctls = detail::initial_ctls_map() |
||
) |
beg | Begin of data to load the module from. |
end | End of data to load the module from. |
log | Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. |
ctls | A map of initial ctl values, see openmpt::modules::get_ctls. |
openmpt::module::module | ( | const char * | data, |
std::size_t | size, | ||
std::ostream & | log = std::clog , |
||
const std::map< std::string, std::string > & | ctls = detail::initial_ctls_map() |
||
) |
data | Data to load the module from. |
size | Amount of data available. |
log | Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. |
ctls | A map of initial ctl values, see openmpt::modules::get_ctls. |
openmpt::module::module | ( | const void * | data, |
std::size_t | size, | ||
std::ostream & | log = std::clog , |
||
const std::map< std::string, std::string > & | ctls = detail::initial_ctls_map() |
||
) |
data | Data to load the module from. |
size | Amount of data available. |
log | Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. |
ctls | A map of initial ctl values, see openmpt::modules::get_ctls. |
|
virtual |
std::string openmpt::module::ctl_get | ( | const std::string & | ctl | ) | const |
void openmpt::module::ctl_set | ( | const std::string & | ctl, |
const std::string & | value | ||
) |
std::string openmpt::module::format_pattern_row_channel | ( | std::int32_t | pattern, |
std::int32_t | row, | ||
std::int32_t | channel, | ||
std::size_t | width = 0 , |
||
bool | pad = true |
||
) | const |
std::string openmpt::module::format_pattern_row_channel_command | ( | std::int32_t | pattern, |
std::int32_t | row, | ||
std::int32_t | channel, | ||
int | command | ||
) | const |
std::vector<std::string> openmpt::module::get_channel_names | ( | ) | const |
std::vector<std::string> openmpt::module::get_ctls | ( | ) | const |
float openmpt::module::get_current_channel_vu_left | ( | std::int32_t | channel | ) | const |
float openmpt::module::get_current_channel_vu_mono | ( | std::int32_t | channel | ) | const |
float openmpt::module::get_current_channel_vu_rear_left | ( | std::int32_t | channel | ) | const |
float openmpt::module::get_current_channel_vu_rear_right | ( | std::int32_t | channel | ) | const |
float openmpt::module::get_current_channel_vu_right | ( | std::int32_t | channel | ) | const |
std::int32_t openmpt::module::get_current_order | ( | ) | const |
std::int32_t openmpt::module::get_current_pattern | ( | ) | const |
std::int32_t openmpt::module::get_current_playing_channels | ( | ) | const |
std::int32_t openmpt::module::get_current_row | ( | ) | const |
std::int32_t openmpt::module::get_current_speed | ( | ) | const |
std::int32_t openmpt::module::get_current_tempo | ( | ) | const |
double openmpt::module::get_duration_seconds | ( | ) | const |
Get approximate song duration.
std::vector<std::string> openmpt::module::get_instrument_names | ( | ) | const |
std::string openmpt::module::get_metadata | ( | const std::string & | key | ) | const |
Get a metadata item value.
key | Metadata item key to query. Use openmpt::module::get_metadata_keys to check for available keys. |
std::vector<std::string> openmpt::module::get_metadata_keys | ( | ) | const |
Get the list of supported metadata item keys.
std::int32_t openmpt::module::get_num_channels | ( | ) | const |
std::int32_t openmpt::module::get_num_instruments | ( | ) | const |
std::int32_t openmpt::module::get_num_orders | ( | ) | const |
std::int32_t openmpt::module::get_num_patterns | ( | ) | const |
std::int32_t openmpt::module::get_num_samples | ( | ) | const |
std::int32_t openmpt::module::get_num_subsongs | ( | ) | const |
std::vector<std::string> openmpt::module::get_order_names | ( | ) | const |
std::int32_t openmpt::module::get_order_pattern | ( | std::int32_t | order | ) | const |
std::vector<std::string> openmpt::module::get_pattern_names | ( | ) | const |
std::int32_t openmpt::module::get_pattern_num_rows | ( | std::int32_t | pattern | ) | const |
std::uint8_t openmpt::module::get_pattern_row_channel_command | ( | std::int32_t | pattern, |
std::int32_t | row, | ||
std::int32_t | channel, | ||
int | command | ||
) | const |
double openmpt::module::get_position_seconds | ( | ) | const |
Get approximate current song position.
std::int32_t openmpt::module::get_render_param | ( | int | param | ) | const |
Get render parameter.
param | Parameter to query. See openmpt::module::render_param. |
std::int32_t openmpt::module::get_repeat_count | ( | ) | const |
Get Repeat Count.
std::vector<std::string> openmpt::module::get_sample_names | ( | ) | const |
std::vector<std::string> openmpt::module::get_subsong_names | ( | ) | const |
std::string openmpt::module::highlight_pattern_row_channel | ( | std::int32_t | pattern, |
std::int32_t | row, | ||
std::int32_t | channel, | ||
std::size_t | width = 0 , |
||
bool | pad = true |
||
) | const |
std::string openmpt::module::highlight_pattern_row_channel_command | ( | std::int32_t | pattern, |
std::int32_t | row, | ||
std::int32_t | channel, | ||
int | command | ||
) | const |
std::size_t openmpt::module::read | ( | std::int32_t | samplerate, |
std::size_t | count, | ||
std::int16_t * | mono | ||
) |
Render audio data.
samplerate | Samplerate to render output. Should be in [8000,192000], but this is not enforced. |
count | Number auf audio frames to render per channel. |
mono | Pointer to a buffer of at least count elements that receives the mono/center output. |
0 | The end of song has been reached. |
std::size_t openmpt::module::read | ( | std::int32_t | samplerate, |
std::size_t | count, | ||
std::int16_t * | left, | ||
std::int16_t * | right | ||
) |
Render audio data.
samplerate | Samplerate to render output. Should be in [8000,192000], but this is not enforced. |
count | Number auf audio frames to render per channel. |
left | Pointer to a buffer of at least count elements that receives the left output. |
right | Pointer to a buffer of at least count elements that receives the right output. |
0 | The end of song has been reached. |
std::size_t openmpt::module::read | ( | std::int32_t | samplerate, |
std::size_t | count, | ||
std::int16_t * | left, | ||
std::int16_t * | right, | ||
std::int16_t * | rear_left, | ||
std::int16_t * | rear_right | ||
) |
Render audio data.
samplerate | Samplerate to render output. Should be in [8000,192000], but this is not enforced. |
count | Number auf audio frames to render per channel. |
left | Pointer to a buffer of at least count elements that receives the left output. |
right | Pointer to a buffer of at least count elements that receives the right output. |
rear_left | Pointer to a buffer of at least count elements that receives the rear left output. |
rear_right | Pointer to a buffer of at least count elements that receives the rear right output. |
0 | The end of song has been reached. |
std::size_t openmpt::module::read | ( | std::int32_t | samplerate, |
std::size_t | count, | ||
float * | mono | ||
) |
Render audio data.
samplerate | Samplerate to render output. Should be in [8000,192000], but this is not enforced. |
count | Number auf audio frames to render per channel. |
mono | Pointer to a buffer of at least count elements that receives the mono/center output. |
0 | The end of song has been reached. |
std::size_t openmpt::module::read | ( | std::int32_t | samplerate, |
std::size_t | count, | ||
float * | left, | ||
float * | right | ||
) |
Render audio data.
samplerate | Samplerate to render output. Should be in [8000,192000], but this is not enforced. |
count | Number auf audio frames to render per channel. |
left | Pointer to a buffer of at least count elements that receives the left output. |
right | Pointer to a buffer of at least count elements that receives the right output. |
0 | The end of song has been reached. |
std::size_t openmpt::module::read | ( | std::int32_t | samplerate, |
std::size_t | count, | ||
float * | left, | ||
float * | right, | ||
float * | rear_left, | ||
float * | rear_right | ||
) |
Render audio data.
samplerate | Samplerate to render output. Should be in [8000,192000], but this is not enforced. |
count | Number auf audio frames to render per channel. |
left | Pointer to a buffer of at least count elements that receives the left output. |
right | Pointer to a buffer of at least count elements that receives the right output. |
rear_left | Pointer to a buffer of at least count elements that receives the rear left output. |
rear_right | Pointer to a buffer of at least count elements that receives the rear right output. |
0 | The end of song has been reached. |
std::size_t openmpt::module::read_interleaved_quad | ( | std::int32_t | samplerate, |
std::size_t | count, | ||
std::int16_t * | interleaved_quad | ||
) |
Render audio data.
samplerate | Samplerate to render output. Should be in [8000,192000], but this is not enforced. |
count | Number auf audio frames to render per channel. |
interleaved_quad | Pointer to a buffer of at least count*4 elements that receives the interleaved suad surround output in the order (L,R,RL,RR). |
0 | The end of song has been reached. |
std::size_t openmpt::module::read_interleaved_quad | ( | std::int32_t | samplerate, |
std::size_t | count, | ||
float * | interleaved_quad | ||
) |
Render audio data.
samplerate | Samplerate to render output. Should be in [8000,192000], but this is not enforced. |
count | Number auf audio frames to render per channel. |
interleaved_quad | Pointer to a buffer of at least count*4 elements that receives the interleaved suad surround output in the order (L,R,RL,RR). |
0 | The end of song has been reached. |
std::size_t openmpt::module::read_interleaved_stereo | ( | std::int32_t | samplerate, |
std::size_t | count, | ||
std::int16_t * | interleaved_stereo | ||
) |
Render audio data.
samplerate | Samplerate to render output. Should be in [8000,192000], but this is not enforced. |
count | Number auf audio frames to render per channel. |
interleaved_stereo | Pointer to a buffer of at least count*2 elements that receives the interleaved stereo output in the order (L,R). |
0 | The end of song has been reached. |
std::size_t openmpt::module::read_interleaved_stereo | ( | std::int32_t | samplerate, |
std::size_t | count, | ||
float * | interleaved_stereo | ||
) |
Render audio data.
samplerate | Samplerate to render output. Should be in [8000,192000], but this is not enforced. |
count | Number auf audio frames to render per channel. |
interleaved_stereo | Pointer to a buffer of at least count*2 elements that receives the interleaved stereo output in the order (L,R). |
0 | The end of song has been reached. |
void openmpt::module::select_subsong | ( | std::int32_t | subsong | ) |
Select a subsong from a multi-song module.
subsong | Index of the subsong. |
double openmpt::module::set_position_order_row | ( | std::int32_t | order, |
std::int32_t | row | ||
) |
Set approximate current song position.
If order or row are out of range, to position is not modified and the current position is returned.
order | Pattern order number to seek to. |
row | Pattern row number to seek to. |
double openmpt::module::set_position_seconds | ( | double | seconds | ) |
Set approximate current song position.
seconds | Seconds to seek to. If seconds is out of range, the position gets set to song start or end respectively. |
void openmpt::module::set_render_param | ( | int | param, |
std::int32_t | value | ||
) |
Set render parameter.
param | Parameter to set. See openmpt::module::render_param. |
value | The value to set param to. |
void openmpt::module::set_repeat_count | ( | std::int32_t | repeat_count | ) |
Set Repeat Count.
repeat_count | Repeat Count
|
|
friend |