10 #ifndef LIBOPENMPT_HPP
11 #define LIBOPENMPT_HPP
20 #include <string_view>
136 #if defined(_MSC_VER)
137 #pragma warning(push)
138 #pragma warning(disable:4275)
145 class LIBOPENMPT_CXX_API_CLASS
exception :
public std::exception {
149 LIBOPENMPT_CXX_API_MEMBER
exception(
const std::string & text ) noexcept;
155 LIBOPENMPT_CXX_API_MEMBER const
char * what() const noexcept override;
157 #if defined(_MSC_VER)
222 LIBOPENMPT_CXX_API std::string
get(
const std::string & key );
260 LIBOPENMPT_CXX_API
double could_open_probability( std::istream & stream,
double effort = 1.0, std::ostream & log = std::clog );
321 LIBOPENMPT_CXX_API
int probe_file_header( std::uint64_t flags,
const std::byte * data, std::size_t size, std::uint64_t filesize );
337 LIBOPENMPT_CXX_API
int probe_file_header( std::uint64_t flags,
const std::uint8_t * data, std::size_t size, std::uint64_t filesize );
354 LIBOPENMPT_CXX_API
int probe_file_header( std::uint64_t flags,
const std::byte * data, std::size_t size );
370 LIBOPENMPT_CXX_API
int probe_file_header( std::uint64_t flags,
const std::uint8_t * data, std::size_t size );
393 typedef std::map< std::string, std::string > initial_ctls_map;
411 RENDER_MASTERGAIN_MILLIBEL = 1,
418 RENDER_STEREOSEPARATION_PERCENT = 2,
431 RENDER_INTERPOLATIONFILTER_LENGTH = 3,
440 RENDER_VOLUMERAMPING_STRENGTH = 4
446 command_instrument = 1,
447 command_volumeffect = 2,
450 command_parameter = 5
458 void operator = (
const module & );
462 void set_impl( module_impl * i );
473 LIBOPENMPT_CXX_API_MEMBER
module( std::istream & stream, std::ostream & log = std::clog,
const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
483 LIBOPENMPT_CXX_API_MEMBER
module(
const std::vector<std::byte> & data, std::ostream & log = std::clog,
const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
494 LIBOPENMPT_CXX_API_MEMBER
module(
const std::byte * beg,
const std::byte * end, std::ostream & log = std::clog,
const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
505 LIBOPENMPT_CXX_API_MEMBER
module(
const std::byte * data, std::size_t size, std::ostream & log = std::clog,
const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
514 LIBOPENMPT_CXX_API_MEMBER
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() );
524 LIBOPENMPT_CXX_API_MEMBER
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() );
534 LIBOPENMPT_CXX_API_MEMBER
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() );
543 LIBOPENMPT_CXX_API_MEMBER
module(
const std::vector<char> & data, std::ostream & log = std::clog,
const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
553 LIBOPENMPT_CXX_API_MEMBER
module(
const char * beg,
const char * end, std::ostream & log = std::clog,
const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
563 LIBOPENMPT_CXX_API_MEMBER
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() );
573 LIBOPENMPT_CXX_API_MEMBER
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() );
675 LIBOPENMPT_CXX_API_MEMBER std::size_t
read( std::int32_t samplerate, std::size_t count, std::int16_t * mono );
689 LIBOPENMPT_CXX_API_MEMBER std::size_t
read( std::int32_t samplerate, std::size_t count, std::int16_t * left, std::int16_t * right );
705 LIBOPENMPT_CXX_API_MEMBER 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 );
718 LIBOPENMPT_CXX_API_MEMBER std::size_t
read( std::int32_t samplerate, std::size_t count,
float * mono );
732 LIBOPENMPT_CXX_API_MEMBER std::size_t
read( std::int32_t samplerate, std::size_t count,
float * left,
float * right );
748 LIBOPENMPT_CXX_API_MEMBER std::size_t
read( std::int32_t samplerate, std::size_t count,
float * left,
float * right,
float * rear_left,
float * rear_right );
761 LIBOPENMPT_CXX_API_MEMBER std::size_t
read_interleaved_stereo( std::int32_t samplerate, std::size_t count, std::int16_t * interleaved_stereo );
774 LIBOPENMPT_CXX_API_MEMBER std::size_t
read_interleaved_quad( std::int32_t samplerate, std::size_t count, std::int16_t * interleaved_quad );
787 LIBOPENMPT_CXX_API_MEMBER std::size_t
read_interleaved_stereo( std::int32_t samplerate, std::size_t count,
float * interleaved_stereo );
800 LIBOPENMPT_CXX_API_MEMBER std::size_t
read_interleaved_quad( std::int32_t samplerate, std::size_t count,
float * interleaved_quad );
829 LIBOPENMPT_CXX_API_MEMBER std::string
get_metadata(
const std::string & key )
const;
1049 LIBOPENMPT_CXX_API_MEMBER 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;
1060 LIBOPENMPT_CXX_API_MEMBER 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;
1093 LIBOPENMPT_CXX_API_MEMBER std::vector<std::string>
get_ctls()
const;
1134 LIBOPENMPT_CXX_API_MEMBER std::string
ctl_get_text( std::string_view ctl )
const;
1162 LIBOPENMPT_CXX_API_MEMBER
void ctl_set_integer( std::string_view ctl, std::int64_t value );
1180 LIBOPENMPT_CXX_API_MEMBER
void ctl_set_text( std::string_view ctl, std::string_view value );
libopenmpt exception base class
Definition: libopenmpt.hpp:145
LIBOPENMPT_CXX_API_MEMBER exception(const exception &other) noexcept
virtual LIBOPENMPT_CXX_API_MEMBER ~exception() noexcept
LIBOPENMPT_CXX_API_MEMBER exception(exception &&other) noexcept
LIBOPENMPT_CXX_API_MEMBER exception(const std::string &text) noexcept
Definition: libopenmpt_ext.hpp:37
Definition: libopenmpt.hpp:397
LIBOPENMPT_CXX_API_MEMBER float get_current_channel_vu_left(std::int32_t channel) const
Get an approximate indication of the channel volume on the front-left speaker.
LIBOPENMPT_CXX_API_MEMBER std::size_t read_interleaved_stereo(std::int32_t samplerate, std::size_t count, float *interleaved_stereo)
Render audio data.
LIBOPENMPT_CXX_API_MEMBER 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())
LIBOPENMPT_CXX_API_MEMBER float get_current_channel_vu_right(std::int32_t channel) const
Get an approximate indication of the channel volume on the front-right speaker.
virtual LIBOPENMPT_CXX_API_MEMBER ~module()
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_current_pattern() const
Get the current pattern.
LIBOPENMPT_CXX_API_MEMBER module(const std::byte *beg, const std::byte *end, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map())
LIBOPENMPT_CXX_API_MEMBER void set_repeat_count(std::int32_t repeat_count)
Set Repeat Count.
LIBOPENMPT_CXX_API_MEMBER float get_current_channel_vu_mono(std::int32_t channel) const
Get an approximate indication of the channel volume.
LIBOPENMPT_CXX_API_MEMBER double set_position_seconds(double seconds)
Set approximate current song position.
LIBOPENMPT_CXX_API_MEMBER LIBOPENMPT_ATTR_DEPRECATED void ctl_set(const std::string &ctl, const std::string &value)
Set ctl value.
LIBOPENMPT_CXX_API_MEMBER std::vector< std::string > get_metadata_keys() const
Get the list of supported metadata item keys.
LIBOPENMPT_CXX_API_MEMBER double get_position_seconds() const
Get current song position.
LIBOPENMPT_CXX_API_MEMBER void select_subsong(std::int32_t subsong)
Select a sub-song from a multi-song module.
LIBOPENMPT_CXX_API_MEMBER void set_render_param(int param, std::int32_t value)
Set render parameter.
LIBOPENMPT_CXX_API_MEMBER std::size_t read_interleaved_quad(std::int32_t samplerate, std::size_t count, float *interleaved_quad)
Render audio data.
LIBOPENMPT_CXX_API_MEMBER LIBOPENMPT_ATTR_DEPRECATED std::string ctl_get(const std::string &ctl) const
Get current ctl value.
LIBOPENMPT_CXX_API_MEMBER 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())
LIBOPENMPT_CXX_API_MEMBER double set_position_order_row(std::int32_t order, std::int32_t row)
Set approximate current song position.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_num_patterns() const
Get the number of patterns.
LIBOPENMPT_CXX_API_MEMBER 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())
LIBOPENMPT_CXX_API_MEMBER module(std::istream &stream, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map())
Construct an openmpt::module.
LIBOPENMPT_CXX_API_MEMBER void ctl_set_boolean(std::string_view ctl, bool value)
Set ctl boolean value.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_selected_subsong() const
Get currently selected sub-song from a multi-song module.
LIBOPENMPT_CXX_API_MEMBER std::size_t read(std::int32_t samplerate, std::size_t count, float *left, float *right)
Render audio data.
LIBOPENMPT_CXX_API_MEMBER std::size_t read(std::int32_t samplerate, std::size_t count, std::int16_t *mono)
Render audio data.
LIBOPENMPT_CXX_API_MEMBER float get_current_channel_vu_rear_right(std::int32_t channel) const
Get an approximate indication of the channel volume on the rear-right speaker.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_pattern_num_rows(std::int32_t pattern) const
Get the number of rows in a pattern.
LIBOPENMPT_CXX_API_MEMBER void ctl_set_integer(std::string_view ctl, std::int64_t value)
Set ctl integer value.
LIBOPENMPT_CXX_API_MEMBER std::size_t read_interleaved_stereo(std::int32_t samplerate, std::size_t count, std::int16_t *interleaved_stereo)
Render audio data.
LIBOPENMPT_CXX_API_MEMBER std::int64_t ctl_get_integer(std::string_view ctl) const
Get current ctl integer value.
LIBOPENMPT_CXX_API_MEMBER std::vector< std::string > get_sample_names() const
Get a list of sample names.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_current_playing_channels() const
Get the current amount of playing channels.
LIBOPENMPT_CXX_API_MEMBER std::string get_metadata(const std::string &key) const
Get a metadata item value.
LIBOPENMPT_CXX_API_MEMBER std::string format_pattern_row_channel_command(std::int32_t pattern, std::int32_t row, std::int32_t channel, int command) const
Get formatted (human-readable) pattern content.
LIBOPENMPT_CXX_API_MEMBER double get_duration_seconds() const
Get approximate song duration.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_current_speed() const
Get the current speed.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_order_pattern(std::int32_t order) const
Get pattern at order position.
LIBOPENMPT_CXX_API_MEMBER module(const char *beg, const char *end, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map())
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_render_param(int param) const
Get render parameter.
LIBOPENMPT_CXX_API_MEMBER LIBOPENMPT_ATTR_DEPRECATED std::int32_t get_current_tempo() const
Get the current tempo.
LIBOPENMPT_CXX_API_MEMBER 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())
LIBOPENMPT_CXX_API_MEMBER float get_current_channel_vu_rear_left(std::int32_t channel) const
Get an approximate indication of the channel volume on the rear-left speaker.
LIBOPENMPT_CXX_API_MEMBER void ctl_set_floatingpoint(std::string_view ctl, double value)
Set ctl floatingpoint value.
LIBOPENMPT_CXX_API_MEMBER double get_current_tempo2() const
Get the current tempo.
LIBOPENMPT_CXX_API_MEMBER std::vector< std::string > get_instrument_names() const
Get a list of instrument names.
LIBOPENMPT_CXX_API_MEMBER 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.
LIBOPENMPT_CXX_API_MEMBER double get_current_estimated_bpm() const
Get the current estimated beats per minute (BPM).
LIBOPENMPT_CXX_API_MEMBER std::string highlight_pattern_row_channel_command(std::int32_t pattern, std::int32_t row, std::int32_t channel, int command) const
Get highlighting information for formatted pattern content.
LIBOPENMPT_CXX_API_MEMBER std::vector< std::string > get_order_names() const
Get a list of order names.
LIBOPENMPT_CXX_API_MEMBER std::size_t read_interleaved_quad(std::int32_t samplerate, std::size_t count, std::int16_t *interleaved_quad)
Render audio data.
LIBOPENMPT_CXX_API_MEMBER std::vector< std::string > get_ctls() const
Retrieve supported ctl keys.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_current_order() const
Get the current order.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_repeat_count() const
Get Repeat Count.
LIBOPENMPT_CXX_API_MEMBER std::string ctl_get_text(std::string_view ctl) const
Get current ctl text value.
render_param
Parameter index to use with openmpt::module::get_render_param and openmpt::module::set_render_param.
Definition: libopenmpt.hpp:404
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_num_instruments() const
Get the number of instruments.
LIBOPENMPT_CXX_API_MEMBER bool ctl_get_boolean(std::string_view ctl) const
Get current ctl boolean value.
LIBOPENMPT_CXX_API_MEMBER std::uint8_t get_pattern_row_channel_command(std::int32_t pattern, std::int32_t row, std::int32_t channel, int command) const
Get raw pattern content.
LIBOPENMPT_CXX_API_MEMBER double ctl_get_floatingpoint(std::string_view ctl) const
Get current ctl floatingpoint value.
LIBOPENMPT_CXX_API_MEMBER module(const std::byte *data, std::size_t size, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map())
LIBOPENMPT_CXX_API_MEMBER 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
Get highlighting information for formatted pattern content.
command_index
Parameter index to use with openmpt::module::get_pattern_row_channel_command, openmpt::module::format...
Definition: libopenmpt.hpp:444
LIBOPENMPT_CXX_API_MEMBER std::vector< std::string > get_subsong_names() const
Get a list of sub-song names.
LIBOPENMPT_CXX_API_MEMBER std::size_t read(std::int32_t samplerate, std::size_t count, float *mono)
Render audio data.
LIBOPENMPT_CXX_API_MEMBER module(const std::vector< std::byte > &data, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map())
LIBOPENMPT_CXX_API_MEMBER 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.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_num_samples() const
Get the number of samples.
LIBOPENMPT_CXX_API_MEMBER void ctl_set_text(std::string_view ctl, std::string_view value)
Set ctl text value.
LIBOPENMPT_CXX_API_MEMBER module(const std::vector< char > &data, std::ostream &log=std::clog, const std::map< std::string, std::string > &ctls=detail::initial_ctls_map())
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_num_subsongs() const
Get the number of sub-songs.
LIBOPENMPT_CXX_API_MEMBER 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())
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_current_row() const
Get the current row.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_num_channels() const
Get the number of pattern channels.
LIBOPENMPT_CXX_API_MEMBER std::size_t read(std::int32_t samplerate, std::size_t count, std::int16_t *left, std::int16_t *right)
Render audio data.
LIBOPENMPT_CXX_API_MEMBER std::vector< std::string > get_channel_names() const
Get a list of channel names.
LIBOPENMPT_CXX_API_MEMBER 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
Get formatted (human-readable) pattern content.
LIBOPENMPT_CXX_API_MEMBER std::int32_t get_num_orders() const
Get the number of orders.
LIBOPENMPT_CXX_API_MEMBER std::vector< std::string > get_pattern_names() const
Get a list of pattern names.
probe_file_header_flags
Possible values for openmpt::probe_file_header() flags parameter.
Definition: libopenmpt.hpp:288
LIBOPENMPT_CXX_API bool is_extension_supported2(std::string_view extension)
Query whether a file extension is supported.
probe_file_header_result
Possible return values for openmpt::probe_file_header().
Definition: libopenmpt.hpp:300
LIBOPENMPT_ATTR_DEPRECATED LIBOPENMPT_CXX_API bool is_extension_supported(const std::string &extension)
Query whether a file extension is supported.
static const std::uint64_t probe_file_header_flags_modules LIBOPENMPT_ATTR_DEPRECATED
Probe for module formats in openmpt::probe_file_header().
Definition: libopenmpt.hpp:276
LIBOPENMPT_CXX_API double could_open_probability(std::istream &stream, double effort=1.0, std::ostream &log=std::clog)
Roughly scan the input stream to find out whether libopenmpt might be able to open it.
LIBOPENMPT_CXX_API std::vector< std::string > get_supported_extensions()
Get a list of supported file extensions.
LIBOPENMPT_ATTR_DEPRECATED LIBOPENMPT_CXX_API double could_open_propability(std::istream &stream, double effort=1.0, std::ostream &log=std::clog)
Roughly scan the input stream to find out whether libopenmpt might be able to open it.
LIBOPENMPT_CXX_API std::uint32_t get_core_version()
Get the core version number.
LIBOPENMPT_CXX_API int probe_file_header(std::uint64_t flags, const std::byte *data, std::size_t size, std::uint64_t filesize)
Probe the provided bytes from the beginning of a file for supported file format headers to find out w...
LIBOPENMPT_CXX_API std::uint32_t get_library_version()
Get the libopenmpt version number.
LIBOPENMPT_CXX_API std::size_t probe_file_header_get_recommended_size()
Get recommended header size for successfull format probing.
@ probe_file_header_flags_none2
Probe for no formats in openmpt::probe_file_header().
Definition: libopenmpt.hpp:296
@ probe_file_header_flags_default2
Probe for the default set of formats in openmpt::probe_file_header().
Definition: libopenmpt.hpp:294
@ probe_file_header_flags_containers2
Probe for module-specific container formats in openmpt::probe_file_header().
Definition: libopenmpt.hpp:292
@ probe_file_header_flags_modules2
Probe for module formats in openmpt::probe_file_header().
Definition: libopenmpt.hpp:290
@ probe_file_header_result_success
Definition: libopenmpt.hpp:301
@ probe_file_header_result_failure
Definition: libopenmpt.hpp:302
@ probe_file_header_result_wantmoredata
Definition: libopenmpt.hpp:303
LIBOPENMPT_CXX_API std::string get(const std::string &key)
Get library related metadata.
Definition: libopenmpt.hpp:130