libSDL2pp
C++ bindings/wrapper for SDL2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL2pp::Wav Class Reference

Chunk of audio data read from a .WAV file More...

#include <SDL2pp/Wav.hh>

Public Member Functions

 Wav (const std::string &file)
 Load audio from file on disk.
 
 Wav (RWops &rwops)
 Load audio using RWops.
 
 ~Wav ()
 Destructor.
 
 Wav (Wav &&other) noexcept
 Move constructor.
 
Wavoperator= (Wav &&other) noexcept
 Move assignment operator.
 
 Wav (const Wav &other)=delete
 Deleted copy constructor.
 
Wavoperator= (const Wav &other)=delete
 Deleted assignment operator.
 
Uint32 GetLength () const
 Get length of audio data.
 
Uint8 * GetBuffer ()
 Get pointer to raw audio data.
 
const Uint8 * GetBuffer () const
 Get constant pointer to raw audio data.
 
const AudioSpecGetSpec () const
 Get descriptor of audio format.
 

Detailed Description

Chunk of audio data read from a .WAV file

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.

Constructor & Destructor Documentation

◆ Wav() [1/4]

SDL2pp::Wav::Wav ( const std::string &  file)
explicit

Load audio from file on disk.

Parameters
[in]filePath to the wav file
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_LoadWAV

◆ Wav() [2/4]

SDL2pp::Wav::Wav ( RWops rwops)
explicit

Load audio using RWops.

Parameters
[in]rwopsSDL2pp::RWops used to access wav data
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_LoadWAV_RW

◆ ~Wav()

SDL2pp::Wav::~Wav ( )

Destructor.

◆ Wav() [3/4]

SDL2pp::Wav::Wav ( Wav &&  other)
noexcept

Move constructor.

Parameters
[in]otherSDL2pp::Wav object to move data from

◆ Wav() [4/4]

SDL2pp::Wav::Wav ( const Wav other)
delete

Deleted copy constructor.

This class is not copyable

Member Function Documentation

◆ GetBuffer() [1/2]

Uint8 * SDL2pp::Wav::GetBuffer ( )

Get pointer to raw audio data.

Returns
Pointer to raw audio data

◆ GetBuffer() [2/2]

const Uint8 * SDL2pp::Wav::GetBuffer ( ) const

Get constant pointer to raw audio data.

Returns
Constant pointer to raw audio data

◆ GetLength()

Uint32 SDL2pp::Wav::GetLength ( ) const

Get length of audio data.

Returns
Length of audio data in bytes

◆ GetSpec()

const AudioSpec & SDL2pp::Wav::GetSpec ( ) const

Get descriptor of audio format.

Returns
SDL2pp::AudioSpec describing format of audio data

◆ operator=() [1/2]

Wav & SDL2pp::Wav::operator= ( const Wav other)
delete

Deleted assignment operator.

This class is not copyable

◆ operator=() [2/2]

Wav & SDL2pp::Wav::operator= ( Wav &&  other)
noexcept

Move assignment operator.

Parameters
[in]otherSDL2pp::Wav object to move data from
Returns
Reference to self

The documentation for this class was generated from the following files: