XPMP2
X-Plane multiplayer library 2 - using instancing
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
XPMP2::SoundWAV Class Reference

Represents a WAV file, read into memory, played by XP's Sound API. More...

#include <Sound.h>

+ Inheritance diagram for XPMP2::SoundWAV:

Public Member Functions

 SoundWAV (SoundSystem *_pSndSys, const std::string &_filePath, bool _bLoop, float _coneDir, float _conePitch, float _coneInAngle, float _coneOutAngle, float _coneOutVol)
 Constructor, will load immediately and throw an exception if loading is unsuccessful. More...
 
 ~SoundWAV () override
 Destructor. More...
 
bool isReady () override
 Ready to play? As we load right away in the constructor we're always ready. More...
 
- Public Member Functions inherited from XPMP2::SoundFile
 SoundFile (SoundSystem *_pSndSys, const std::string &_filePath, bool _bLoop, float _coneDir, float _conePitch, float _coneInAngle, float _coneOutAngle, float _coneOutVol)
 Construct a sound object from a file name and have it loaded asynchonously. More...
 
virtual ~SoundFile ()
 Make sure destructor is virtual. More...
 
 SoundFile (const SoundFile &o)=delete
 Copying is not permitted. More...
 
bool hasConeInfo () const
 Has full cone information? More...
 

Public Attributes

int16_t * pBuf = nullptr
 audio buffer of PCM16 data More...
 
uint32_t bufferSize = 0
 buffer size in bytes More...
 
int freqHz = 0
 sound frequency in Hz More...
 
int numChannels = 0
 number of channels in the sound sample More...
 
- Public Attributes inherited from XPMP2::SoundFile
SoundSystempSndSys = nullptr
 Sound system for which this object was created. More...
 
std::string filePath
 File path to sound file. More...
 
bool bLoop = true
 sound to be played in a loop? More...
 
float coneDir = NAN
 Which direction relative to plane's heading does the cone point to? (180 would be typical for jet engines) More...
 
float conePitch = NAN
 Which pitch does the cone point to (up/down)? (0 would be typical, ie. level with the plane) More...
 
float coneInAngle = NAN
 Inside cone angle. This is the angle spread within which the sound is unattenuated. More...
 
float coneOutAngle = NAN
 Outside cone angle. This is the angle spread outside of which the sound is attenuated to its SoundFile::coneOutVol. More...
 
float coneOutVol = NAN
 Cone outside volume. More...
 

Protected Member Functions

void WavRead ()
 Reads a WAV file into a PCM16 memory buffer, throws exceptions in case of errors. More...
 

Detailed Description

Represents a WAV file, read into memory, played by XP's Sound API.

Constructor & Destructor Documentation

◆ SoundWAV()

XPMP2::SoundWAV::SoundWAV ( SoundSystem _pSndSys,
const std::string &  _filePath,
bool  _bLoop,
float  _coneDir,
float  _conePitch,
float  _coneInAngle,
float  _coneOutAngle,
float  _coneOutVol 
)

Constructor, will load immediately and throw an exception if loading is unsuccessful.

◆ ~SoundWAV()

XPMP2::SoundWAV::~SoundWAV ( )
override

Destructor.

Member Function Documentation

◆ isReady()

bool XPMP2::SoundWAV::isReady ( )
inlineoverridevirtual

Ready to play? As we load right away in the constructor we're always ready.

Implements XPMP2::SoundFile.

◆ WavRead()

void XPMP2::SoundWAV::WavRead ( )
protected

Reads a WAV file into a PCM16 memory buffer, throws exceptions in case of errors.

Member Data Documentation

◆ bufferSize

uint32_t XPMP2::SoundWAV::bufferSize = 0

buffer size in bytes

◆ freqHz

int XPMP2::SoundWAV::freqHz = 0

sound frequency in Hz

◆ numChannels

int XPMP2::SoundWAV::numChannels = 0

number of channels in the sound sample

◆ pBuf

int16_t* XPMP2::SoundWAV::pBuf = nullptr

audio buffer of PCM16 data


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