// SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2022-2023 by Ronald "Eidolon" Kinard // // This program is free software distributed under the // terms of the GNU General Public License, version 2. // See the 'LICENSE' file for more details. //----------------------------------------------------------------------------- #ifndef __SRB2_AUDIO_XMP_PLAYER_HPP__ #define __SRB2_AUDIO_XMP_PLAYER_HPP__ #include "source.hpp" #include "xmp.hpp" namespace srb2::audio { template class XmpPlayer final : public Source { Xmp xmp_; std::vector> buf_; public: XmpPlayer(Xmp&& xmp); XmpPlayer(const XmpPlayer&) = delete; XmpPlayer(XmpPlayer&& rhs) noexcept; XmpPlayer& operator=(const XmpPlayer&) = delete; XmpPlayer& operator=(XmpPlayer&& rhs) noexcept; ~XmpPlayer(); virtual std::size_t generate(tcb::span> buffer) override final; bool looping() { return xmp_.looping(); }; void looping(bool looping) { xmp_.looping(looping); } void reset() { xmp_.reset(); } float duration_seconds() const; void seek(float position_seconds); }; extern template class XmpPlayer<1>; extern template class XmpPlayer<2>; } // namespace srb2::audio #endif // __SRB2_AUDIO_XMP_PLAYER_HPP__