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
exception :
public std::exception {
149 exception(
const std::string & text ) noexcept;
155 const char * what()
const noexcept
override;
157 #if defined(_MSC_VER)
181 static const char library_features LIBOPENMPT_ATTR_DEPRECATED [] =
"library_features";
183 static const char core_version LIBOPENMPT_ATTR_DEPRECATED [] =
"core_version";
185 static const char build LIBOPENMPT_ATTR_DEPRECATED [] =
"build";
187 static const char credits LIBOPENMPT_ATTR_DEPRECATED [] =
"credits";
189 static const char contact LIBOPENMPT_ATTR_DEPRECATED [] =
"contact";
191 static const char license LIBOPENMPT_ATTR_DEPRECATED [] =
"license";
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 );
279 static const std::uint64_t probe_file_header_flags_containers LIBOPENMPT_ATTR_DEPRECATED = 0x2ull;
282 static const std::uint64_t probe_file_header_flags_default LIBOPENMPT_ATTR_DEPRECATED = 0x1ull | 0x2ull;
285 static const std::uint64_t probe_file_header_flags_none LIBOPENMPT_ATTR_DEPRECATED = 0x0ull;
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 );
385 LIBOPENMPT_CXX_API
int probe_file_header( std::uint64_t flags, std::istream & stream );
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 module( std::istream & stream, std::ostream & log = std::clog,
const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
483 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 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 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 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 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 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 module(
const std::vector<char> & data, std::ostream & log = std::clog,
const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() );
553 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 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 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() );
584 void select_subsong( std::int32_t subsong );
591 std::int32_t get_selected_subsong()
const;
600 void set_repeat_count( std::int32_t repeat_count );
609 std::int32_t get_repeat_count()
const;
616 double get_duration_seconds()
const;
624 double set_position_seconds(
double seconds );
630 double get_position_seconds()
const;
641 double set_position_order_row( std::int32_t order, std::int32_t row );
651 std::int32_t get_render_param(
int param )
const;
660 void set_render_param(
int param, std::int32_t value );
675 std::size_t read( std::int32_t samplerate, std::size_t count, std::int16_t * mono );
689 std::size_t read( std::int32_t samplerate, std::size_t count, std::int16_t * left, std::int16_t * right );
705 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 std::size_t read( std::int32_t samplerate, std::size_t count,
float * mono );
732 std::size_t read( std::int32_t samplerate, std::size_t count,
float * left,
float * right );
748 std::size_t read( std::int32_t samplerate, std::size_t count,
float * left,
float * right,
float * rear_left,
float * rear_right );
761 std::size_t read_interleaved_stereo( std::int32_t samplerate, std::size_t count, std::int16_t * interleaved_stereo );
774 std::size_t read_interleaved_quad( std::int32_t samplerate, std::size_t count, std::int16_t * interleaved_quad );
787 std::size_t read_interleaved_stereo( std::int32_t samplerate, std::size_t count,
float * interleaved_stereo );
800 std::size_t read_interleaved_quad( std::int32_t samplerate, std::size_t count,
float * interleaved_quad );
808 std::vector<std::string> get_metadata_keys()
const;
829 std::string get_metadata(
const std::string & key )
const;
837 double get_current_estimated_bpm()
const;
842 std::int32_t get_current_speed()
const;
847 std::int32_t get_current_tempo()
const;
852 std::int32_t get_current_order()
const;
857 std::int32_t get_current_pattern()
const;
862 std::int32_t get_current_row()
const;
867 std::int32_t get_current_playing_channels()
const;
875 float get_current_channel_vu_mono( std::int32_t channel )
const;
882 float get_current_channel_vu_left( std::int32_t channel )
const;
889 float get_current_channel_vu_right( std::int32_t channel )
const;
896 float get_current_channel_vu_rear_left( std::int32_t channel )
const;
903 float get_current_channel_vu_rear_right( std::int32_t channel )
const;
910 std::int32_t get_num_subsongs()
const;
916 std::int32_t get_num_channels()
const;
921 std::int32_t get_num_orders()
const;
926 std::int32_t get_num_patterns()
const;
931 std::int32_t get_num_instruments()
const;
936 std::int32_t get_num_samples()
const;
943 std::vector<std::string> get_subsong_names()
const;
949 std::vector<std::string> get_channel_names()
const;
955 std::vector<std::string> get_order_names()
const;
961 std::vector<std::string> get_pattern_names()
const;
967 std::vector<std::string> get_instrument_names()
const;
973 std::vector<std::string> get_sample_names()
const;
980 std::int32_t get_order_pattern( std::int32_t order )
const;
987 std::int32_t get_pattern_num_rows( std::int32_t pattern )
const;
997 std::uint8_t get_pattern_row_channel_command( std::int32_t pattern, std::int32_t row, std::int32_t channel,
int command )
const;
1008 std::string format_pattern_row_channel_command( std::int32_t pattern, std::int32_t row, std::int32_t channel,
int command )
const;
1030 std::string highlight_pattern_row_channel_command( std::int32_t pattern, std::int32_t row, std::int32_t channel,
int command )
const;
1042 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;
1053 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;
1086 std::vector<std::string> get_ctls()
const;
1095 LIBOPENMPT_ATTR_DEPRECATED std::string ctl_get(
const std::string & ctl )
const;
1103 bool ctl_get_boolean( std::string_view ctl )
const;
1111 std::int64_t ctl_get_integer( std::string_view ctl )
const;
1119 double ctl_get_floatingpoint( std::string_view ctl )
const;
1127 std::string ctl_get_text( std::string_view ctl )
const;
1137 LIBOPENMPT_ATTR_DEPRECATED
void ctl_set(
const std::string & ctl,
const std::string & value );
1146 void ctl_set_boolean( std::string_view ctl,
bool value );
1155 void ctl_set_integer( std::string_view ctl, std::int64_t value );
1164 void ctl_set_floatingpoint( std::string_view ctl,
double value );
1173 void ctl_set_text( std::string_view ctl, std::string_view value );
1185 #endif // LIBOPENMPT_HPP
Definition: libopenmpt.hpp:302
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...
command_index
Parameter index to use with openmpt::module::get_pattern_row_channel_command, openmpt::module::format...
Definition: libopenmpt.hpp:444
Probe for the default set of formats in openmpt::probe_file_header().
Definition: libopenmpt.hpp:294
static const char library_version LIBOPENMPT_ATTR_DEPRECATED[]
Return a verbose library version string from openmpt::string::get().
Definition: libopenmpt.hpp:179
probe_file_header_result
Possible return values for openmpt::probe_file_header().
Definition: libopenmpt.hpp:300
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...
Definition: libopenmpt.hpp:301
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 std::vector< std::string > get_supported_extensions()
Get a list of supported file extensions.
libopenmpt exception base class
Definition: libopenmpt.hpp:145
Probe for module-specific container formats in openmpt::probe_file_header().
Definition: libopenmpt.hpp:292
LIBOPENMPT_CXX_API bool is_extension_supported2(std::string_view extension)
Query whether a file extension is supported.
Definition: libopenmpt.hpp:130
Probe for no formats in openmpt::probe_file_header().
Definition: libopenmpt.hpp:296
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::uint32_t get_core_version()
Get the core version number.
Definition: libopenmpt.hpp:303
render_param
Parameter index to use with openmpt::module::get_render_param and openmpt::module::set_render_param.
Definition: libopenmpt.hpp:404
probe_file_header_flags
Possible values for openmpt::probe_file_header() flags parameter.
Definition: libopenmpt.hpp:288
LIBOPENMPT_ATTR_DEPRECATED LIBOPENMPT_CXX_API bool is_extension_supported(const std::string &extension)
Query whether a file extension is supported.
LIBOPENMPT_CXX_API std::size_t probe_file_header_get_recommended_size()
Get recommended header size for successfull format probing.
LIBOPENMPT_CXX_API std::uint32_t get_library_version()
Get the libopenmpt version number.
Definition: libopenmpt_ext.hpp:37
Definition: libopenmpt.hpp:397
Probe for module formats in openmpt::probe_file_header().
Definition: libopenmpt.hpp:290