Index: libopenmpt/bindings/freebasic/libopenmpt.bi =================================================================== --- libopenmpt/bindings/freebasic/libopenmpt.bi (revision 21858) +++ libopenmpt/bindings/freebasic/libopenmpt.bi (working copy) @@ -1273,6 +1273,39 @@ '/ Declare Function openmpt_module_get_order_pattern(ByVal module As openmpt_module Ptr, ByVal order As Long) As Long +/'* \brief Check if specified order is a skip ("+++") item + + \param The order item to check. + \return Returns non-zero value if the pattern index at the given order position represents a skip item. During playback, this item is ignored and playback resumes at the next order list item. + \sa openmpt_module_is_order_stop_pattern, openmpt_module_is_pattern_skip_pattern + \since 0.8.0 +'/ +Declare Function openmpt_module_is_order_skip_pattern(ByVal module As openmpt_module Ptr, ByVal order As Long) As Long +/'* \brief Check if specified pattern index is a skip ("+++") item + + \param The pattern index to check. + \return Returns non-zero value if the pattern index represents a skip item. During playback, this item is ignored and playback resumes at the next order list item. + \sa openmpt_module_is_order_stop_pattern, openmpt_module_is_order_skip_pattern, openmpt_module_get_order_pattern + \since 0.8.0 +'/ +Declare Function openmpt_module_is_pattern_skip_pattern(ByVal module As openmpt_module Ptr, ByVal pattern As Long) As Long +/'* \brief Check if specified order is a stop ("---") item + + \param The order item to check. + \return Returns non-zero value if the pattern index at the given order position represents a stop item. When this item is reached, playback continues at the restart position of the current sub-song. + \sa openmpt_module_is_order_skip_pattern, openmpt_module_is_pattern_stop_pattern + \since 0.8.0 +'/ +Declare Function openmpt_module_is_order_stop_pattern(ByVal module As openmpt_module Ptr, ByVal order As Long) As Long +/'* \brief Check if specified pattern index is a stop ("---") item + + \param The pattern index to check. + \return Returns non-zero value if the pattern index represents a stop item. When this item is reached, playback continues at the restart position of the current sub-song. + \sa openmpt_module_is_order_skip_pattern, openmpt_module_is_order_stop_pattern openmpt_module_get_order_pattern + \since 0.8.0 +'/ +Declare Function openmpt_module_is_pattern_stop_pattern(ByVal module As openmpt_module Ptr, ByVal pattern As Long) As Long + /'* \brief Get the number of rows in a pattern \param module The module handle to work on. Index: libopenmpt/libopenmpt.h =================================================================== --- libopenmpt/libopenmpt.h (revision 21858) +++ libopenmpt/libopenmpt.h (working copy) @@ -1330,6 +1330,40 @@ * \return The pattern index found at the given order position of the current sequence. */ LIBOPENMPT_API int32_t openmpt_module_get_order_pattern( openmpt_module * mod, int32_t order ); + +/*! \brief Check if specified order is a skip ("+++") item + * + * \param The order item to check. + * \return Returns non-zero value if the pattern index at the given order position represents a skip item. During playback, this item is ignored and playback resumes at the next order list item. + * \sa openmpt_module_is_order_stop_pattern, openmpt_module_is_pattern_skip_pattern + * \since 0.8.0 + */ +LIBOPENMPT_API int openmpt_module_is_order_skip_pattern( openmpt_module * mod, int32_t order ); +/*! \brief Check if specified pattern index is a skip ("+++") item + * + * \param The pattern index to check. + * \return Returns non-zero value if the pattern index represents a skip item. During playback, this item is ignored and playback resumes at the next order list item. + * \sa openmpt_module_is_order_stop_pattern, openmpt_module_is_order_skip_pattern, openmpt_module_get_order_pattern + * \since 0.8.0 + */ +LIBOPENMPT_API int openmpt_module_is_pattern_skip_pattern( openmpt_module * mod, int32_t pattern ); +/*! \brief Check if specified order is a stop ("---") item + * + * \param The order item to check. + * \return Returns non-zero value if the pattern index at the given order position represents a stop item. When this item is reached, playback continues at the restart position of the current sub-song. + * \sa openmpt_module_is_order_skip_pattern, openmpt_module_is_pattern_stop_pattern + * \since 0.8.0 + */ +LIBOPENMPT_API int openmpt_module_is_order_stop_pattern( openmpt_module * mod, int32_t order ); +/*! \brief Check if specified pattern index is a stop ("---") item + * + * \param The pattern index to check. + * \return Returns non-zero value if the pattern index represents a stop item. When this item is reached, playback continues at the restart position of the current sub-song. + * \sa openmpt_module_is_order_skip_pattern, openmpt_module_is_order_stop_pattern openmpt_module_get_order_pattern + * \since 0.8.0 + */ +LIBOPENMPT_API int openmpt_module_is_order_stop_pattern( openmpt_module * mod, int32_t pattern ); + /*! \brief Get the number of rows in a pattern * * \param mod The module handle to work on. Index: libopenmpt/libopenmpt.hpp =================================================================== --- libopenmpt/libopenmpt.hpp (revision 21858) +++ libopenmpt/libopenmpt.hpp (working copy) @@ -989,6 +989,39 @@ */ LIBOPENMPT_CXX_API_MEMBER std::int32_t get_order_pattern( std::int32_t order ) const; + //! Check if specified order is a skip ("+++") item + /*! + \param The order item to check. + \return Returns true if the pattern index at the given order position represents a skip item. During playback, this item is ignored and playback resumes at the next order list item. + \sa openmpt::module::is_order_stop_pattern, openmpt::module::is_pattern_skip_pattern + \since 0.8.0 + */ + LIBOPENMPT_CXX_API_MEMBER bool is_order_skip_pattern( std::int32_t order ) const ; + //! Check if specified pattern index is a skip ("+++") item + /*! + \param The pattern index to check. + \return Returns true if the pattern index represents a skip item. During playback, this item is ignored and playback resumes at the next order list item. + \sa openmpt::module::is_order_stop_pattern, openmpt::module::is_order_skip_pattern, openmpt::module::get_order_pattern + \since 0.8.0 + */ + LIBOPENMPT_CXX_API_MEMBER bool is_pattern_skip_pattern( std::int32_t pattern ) const; + //! Check if specified order is a stop ("---") item + /*! + \param The order item to check. + \return Returns true if the pattern index at the given order position represents a stop item. When this item is reached, playback continues at the restart position of the current sub-song. + \sa openmpt::module::is_order_skip_pattern, openmpt::module::is_pattern_stop_pattern + \since 0.8.0 + */ + LIBOPENMPT_CXX_API_MEMBER bool is_order_stop_pattern( std::int32_t order ) const; + //! Check if specified pattern index is a stop ("---") item + /*! + \param The pattern index to check. + \return Returns true if the pattern index represents a stop item. When this item is reached, playback continues at the restart position of the current sub-song. + \sa openmpt::module::is_order_skip_pattern, openmpt::module::is_order_stop_pattern openmpt::module::get_order_pattern + \since 0.8.0 + */ + LIBOPENMPT_CXX_API_MEMBER bool is_pattern_stop_pattern( std::int32_t pattern ) const; + //! Get the number of rows in a pattern /*! \param pattern The pattern whose row count should be retrieved. Index: libopenmpt/libopenmpt_c.cpp =================================================================== --- libopenmpt/libopenmpt_c.cpp (revision 21858) +++ libopenmpt/libopenmpt_c.cpp (working copy) @@ -1225,6 +1225,44 @@ return 0; } +int openmpt_module_is_order_skip_pattern( openmpt_module * mod, int32_t order ) { + try { + openmpt::interface::check_soundfile( mod ); + return mod->impl->is_order_skip_pattern( order ) ? 1 : 0; + } catch ( ... ) { + openmpt::report_exception( __func__, mod ); + } + return 0; +} +int openmpt_module_is_pattern_skip_pattern( openmpt_module * mod, int32_t pattern ) { + try { + openmpt::interface::check_soundfile( mod ); + return mod->impl->is_pattern_skip_pattern( pattern ) ? 1 : 0; + } catch ( ... ) { + openmpt::report_exception( __func__, mod ); + } + return 0; +} +int openmpt_module_is_order_stop_pattern( openmpt_module * mod, int32_t order ) { + try { + openmpt::interface::check_soundfile( mod ); + return mod->impl->is_order_stop_pattern( order ) ? 1 : 0; + } catch ( ... ) { + openmpt::report_exception( __func__, mod ); + } + return 0; +} +int openmpt_module_is_is_order_stop_pattern( openmpt_module * mod, int32_t pattern ) { + try { + openmpt::interface::check_soundfile( mod ); + return mod->impl->is_order_stop_pattern( pattern ) ? 1 : 0; + } catch ( ... ) { + openmpt::report_exception( __func__, mod ); + } + return 0; +} + + int32_t openmpt_module_get_pattern_num_rows( openmpt_module * mod, int32_t pattern ) { try { openmpt::interface::check_soundfile( mod ); Index: libopenmpt/libopenmpt_cxx.cpp =================================================================== --- libopenmpt/libopenmpt_cxx.cpp (revision 21858) +++ libopenmpt/libopenmpt_cxx.cpp (working copy) @@ -389,6 +389,20 @@ std::int32_t module::get_order_pattern( std::int32_t order ) const { return impl->get_order_pattern( order ); } + +bool module::is_order_skip_pattern(std::int32_t order) const { + return impl->is_order_skip_pattern( order ); +} +bool module::is_pattern_skip_pattern( std::int32_t pattern ) const { + return module_impl::is_pattern_skip_pattern( pattern ); +} +bool module::is_order_stop_pattern( std::int32_t order ) const { + return impl->is_order_stop_pattern( order ); +} +bool module::is_pattern_stop_pattern( std::int32_t pattern ) const { + return module_impl::is_pattern_stop_pattern( pattern ); +} + std::int32_t module::get_pattern_num_rows( std::int32_t pattern ) const { return impl->get_pattern_num_rows( pattern ); } Index: libopenmpt/libopenmpt_impl.cpp =================================================================== --- libopenmpt/libopenmpt_impl.cpp (revision 21858) +++ libopenmpt/libopenmpt_impl.cpp (working copy) @@ -1457,6 +1457,26 @@ } return m_sndFile->Order()[o]; } + +bool module_impl::is_order_skip_pattern( std::int32_t order ) const { + if ( order < 0 || order >= m_sndFile->Order().GetLengthTailTrimmed() ) { + return false; + } + return is_pattern_skip_pattern( m_sndFile->Order()[order] ); +} +bool module_impl::is_pattern_skip_pattern( std::int32_t pattern ) { + return pattern == OpenMPT::PATTERNINDEX_SKIP; +} +bool module_impl::is_order_stop_pattern( std::int32_t order ) const { + if ( order < 0 || order >= m_sndFile->Order().GetLengthTailTrimmed() ) { + return false; + } + return is_pattern_stop_pattern( m_sndFile->Order()[order] ); +} +bool module_impl::is_pattern_stop_pattern( std::int32_t pattern ) { + return pattern == OpenMPT::PATTERNINDEX_INVALID; +} + std::int32_t module_impl::get_pattern_num_rows( std::int32_t p ) const { if ( !mpt::is_in_range( p, std::numeric_limits::min(), std::numeric_limits::max() ) || !m_sndFile->Patterns.IsValidPat( static_cast( p ) ) ) { return 0; Index: libopenmpt/libopenmpt_impl.hpp =================================================================== --- libopenmpt/libopenmpt_impl.hpp (revision 21858) +++ libopenmpt/libopenmpt_impl.hpp (working copy) @@ -244,6 +244,10 @@ std::vector get_instrument_names() const; std::vector get_sample_names() const; std::int32_t get_order_pattern( std::int32_t o ) const; + bool is_order_skip_pattern( std::int32_t order ) const; + static bool is_pattern_skip_pattern( std::int32_t pattern ); + bool is_order_stop_pattern( std::int32_t order ) const; + static bool is_pattern_stop_pattern( std::int32_t pattern ); std::int32_t get_pattern_num_rows( std::int32_t p ) const; std::uint8_t get_pattern_row_channel_command( std::int32_t p, std::int32_t r, std::int32_t c, int cmd ) const; std::string format_pattern_row_channel_command( std::int32_t p, std::int32_t r, std::int32_t c, int cmd ) const;