mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-04 03:15:59 -04:00
Document Wav class
This commit is contained in:
parent
7f059d8a1a
commit
4a48c58f5f
@ -28,30 +28,113 @@ namespace SDL2pp {
|
||||
|
||||
class RWops;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Chunk of audio data read from a .WAV file
|
||||
///
|
||||
/// \headerfile SDL2pp/Wav.hh
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class Wav {
|
||||
private:
|
||||
Uint8* audio_buffer_;
|
||||
Uint32 audio_length_;
|
||||
Uint8* audio_buffer_; ///< Raw audio data
|
||||
Uint32 audio_length_; ///< Raw audio data length in bytes
|
||||
|
||||
AudioSpec spec_;
|
||||
AudioSpec spec_; ///< Description of audio data format
|
||||
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load audio from file on disk
|
||||
///
|
||||
/// \param file Path to the wav file
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Wav(const std::string& file);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load audio using RWops
|
||||
///
|
||||
/// \param rwops SDL2pp::RWops used to access wav data
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Wav(RWops& rwops);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
~Wav();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Move constructor
|
||||
///
|
||||
/// \param other SDL2pp::Wav object to move data from
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Wav(Wav&& other);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Move assignment operator
|
||||
///
|
||||
/// \param other SDL2pp::Wav object to move data from
|
||||
///
|
||||
/// \returns Reference to self
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Wav& operator=(Wav&& other);
|
||||
|
||||
// Deleted copy constructor and assignment
|
||||
Wav(const Wav& other) = delete;
|
||||
Wav& operator=(const Wav& other) = delete;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get length of audio data
|
||||
///
|
||||
/// \returns Length of audio data in bytes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 GetLength() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get pointer to raw audio data
|
||||
///
|
||||
/// \returns Pointer to raw audio data
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint8* GetBuffer();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get constant pointer to raw audio data
|
||||
///
|
||||
/// \returns Constant pointer to raw audio data
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Uint8* GetBuffer() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get descriptor of audio format
|
||||
///
|
||||
/// \returns SDL2pp::AudioSpec describing format of audio data
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const AudioSpec& GetSpec() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class SDL2pp::Wav
|
||||
/// \ingroup Audio
|
||||
///
|
||||
/// SDL2pp::Wav is a wrapper around basic SDL2 audio fragment
|
||||
/// handling functionality, basically SDL_LoadWAV and related
|
||||
/// functions.
|
||||
///
|
||||
/// The class holds raw audio data which is loaded from a disk
|
||||
/// file or from an arbitrary source with SDL2pp::RWops and
|
||||
/// may be used in audio playback.
|
||||
///
|
||||
/// See audio_wav demo for an example.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user