From e369b77263822e9b361559aa944ae1e8f6a85a9e Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Fri, 19 Dec 2014 18:44:52 +0300 Subject: [PATCH] Document AudioSpec class --- SDL2pp/AudioSpec.hh | 77 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/SDL2pp/AudioSpec.hh b/SDL2pp/AudioSpec.hh index e8bd0bd..e051661 100644 --- a/SDL2pp/AudioSpec.hh +++ b/SDL2pp/AudioSpec.hh @@ -26,24 +26,97 @@ namespace SDL2pp { +//////////////////////////////////////////////////////////// +/// \brief Audio format specification +/// +/// \headerfile SDL2pp/Audiospec.hh +/// +//////////////////////////////////////////////////////////// class AudioSpec : public SDL_AudioSpec { - public: + //////////////////////////////////////////////////////////// + /// \brief Create empty (invalid) audio format specification + /// + //////////////////////////////////////////////////////////// AudioSpec(); + + //////////////////////////////////////////////////////////// + /// \brief Create audio format specification with given properties + /// + /// \param freq Sampling frequency in samples/second + /// \param format Sample format, see http://wiki.libsdl.org/SDL_AudioSpec#Remarks + /// \param channels Number of separate audio channels + /// \param samples Audio buffer size in samples (power of 2) + /// + /// \see http://wiki.libsdl.org/SDL_AudioSpec#Remarks + /// + //////////////////////////////////////////////////////////// AudioSpec(int freq, SDL_AudioFormat format, Uint8 channels, Uint16 samples); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// ~AudioSpec(); + //////////////////////////////////////////////////////////// + /// \brief Move constructor + /// + /// \param other SDL2pp::AudioSpec object to move data from + /// + //////////////////////////////////////////////////////////// AudioSpec(AudioSpec&& other); + + //////////////////////////////////////////////////////////// + /// \brief Move assignment operator + /// + /// \param other SDL2pp::AudioSpec object to move data from + /// + /// \returns Reference to self + /// + //////////////////////////////////////////////////////////// AudioSpec& operator=(AudioSpec&& other); + + // Deleted copy constructor and assignment AudioSpec(const AudioSpec& other) = delete; AudioSpec& operator=(const AudioSpec& other) = delete; - void MergeChanges(const SDL_AudioSpec& obtained); + //////////////////////////////////////////////////////////// + /// \brief Get pointer to contained SDL_AudioSpec structure + /// + /// \returns Pointer to SDL_AudioSpec structure + /// + //////////////////////////////////////////////////////////// const SDL_AudioSpec* Get() const; + //////////////////////////////////////////////////////////// + /// \brief Merges audio format changes from another SDL2pp::AudioSpec + /// + /// \param obtained SDL2pp::AudioSpec to merge data from + /// + //////////////////////////////////////////////////////////// + void MergeChanges(const SDL_AudioSpec& obtained); + + //////////////////////////////////////////////////////////// + /// \brief Checks if format of another SDL2pp::AudioSpec is the same + /// + /// \param other SDL2pp::AudioSpec to compare to + /// + //////////////////////////////////////////////////////////// bool IsSameFormat(const AudioSpec& other) const; }; } #endif + +//////////////////////////////////////////////////////////// +/// \class SDL2pp::AudioSpec +/// \ingroup audio +/// +/// This class extends SDL_AudioSpec - a structure that describes +/// audio format. It may be used to describe format of loaded +/// SDL2pp::Wav audio fragments and to specify desired or actual +/// audio output format of SDL2pp::AudioDevice +/// +////////////////////////////////////////////////////////////