Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
Burger::SoundBufferRez Class Reference

Convenience class for sound files in resources. More...

Inheritance diagram for Burger::SoundBufferRez:
Inheritance graph
[legend]
Collaboration diagram for Burger::SoundBufferRez:
Collaboration graph
[legend]

Public Member Functions

const Burger::StaticRTTIget_StaticRTTI (void) const noexcept override
 Get the description to the class.
 
uint_t Upload (SoundManager *pSoundManager) override
 Load resource and upload.
 
void Set (RezFile *pRezFile, uint_t uRezNum)
 Set the resource to track.
 
- Public Member Functions inherited from Burger::SoundManager::Buffer
virtual ~Buffer ()
 Destructor.
 
uint_t Init (const void *pSoundFile, uintptr_t uLength)
 Attach sound data to buffer.
 
uint_t Init (const BufferDescription_t *pRawData)
 Attach sound data to buffer.
 
virtual void Shutdown (void)
 Release resources.
 
BufferDecoderGetBufferDescription (void)
 Returns the contained BufferDecoder_t state.
 
const BufferDecoderGetBufferDescription (void) const
 Returns the contained BufferDecoder_t state.
 
void SetSampleRate (uint_t uSampleRate)
 Sets the buffer's sample rate.
 
uint_t GetSampleRate (void) const
 Gets the buffer's sample rate.
 
void SetPan (uint_t uPan)
 Sets the buffer's stereo pan setting.
 
uint_t GetPan (void) const
 Gets the buffer's stereo pan setting.
 
void SetVolume (uint_t uVolume)
 Sets the buffer's default volume.
 
uint_t GetVolume (void) const
 Gets the buffer's default volume setting.
 
IDirectSoundBuffer8GetDirectSoundBuffer8 (void) const
 Gets the buffer's DirectSoundBuffer8.
 
uint_t IsUploaded (void) const
 
- Public Member Functions inherited from Burger::ReferenceCounter
 ReferenceCounter () noexcept
 Sets the reference count to zero.
 
virtual ~ReferenceCounter ()
 Destructor.
 
void AddRef (void) noexcept
 Increase the reference count by 1.
 
void Release (void) noexcept
 Decrease the reference count by 1.
 
- Public Member Functions inherited from Burger::Base
const charget_class_name (void) const noexcept
 Get the name of the class.
 
virtual ~Base () noexcept=default
 Destructor.
 

Static Public Member Functions

static SoundBufferRezNew (void)
 Create a new sound buffer.
 
static SoundBufferRezNew (RezFile *pRezFile, uint_t uRezNum)
 Create a new sound buffer.
 
- Static Public Member Functions inherited from Burger::SoundManager::Buffer
static BufferNew (void)
 Create a new sound buffer.
 

Static Public Attributes

static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 
- Static Public Attributes inherited from Burger::SoundManager::Buffer
static const Burger::StaticRTTI g_StaticRTTI
 
- Static Public Attributes inherited from Burger::ReferenceCounter
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 
- Static Public Attributes inherited from Burger::Base
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 

Protected Member Functions

 SoundBufferRez (void)
 Default constructor.
 
 SoundBufferRez (RezFile *pRezFile, uint_t uRezNum)
 Default constructor.
 
- Protected Member Functions inherited from Burger::SoundManager::Buffer
 Buffer ()
 Constructor.
 

Protected Attributes

RezFilem_pRezFile
 Pointer to the resource class that the resource is attached to.
 
uint_t m_uRezNum
 Resource number of the sound file.
 
- Protected Attributes inherited from Burger::SoundManager::Buffer
IDirectSoundBuffer8m_pDirectSoundBuffer8
 DirectSound8 buffer (Windows Only)
 
const voidm_pBufferData
 Buffer data.
 
uintptr_t m_uBufferSize
 Size of the buffer.
 
BufferDecoder m_Decoder
 Description of the sound data.
 
uint_t m_uPan
 Pan setting.
 
uint_t m_uVolume
 Volume for the buffer.
 

Private Member Functions

 SoundBufferRez (const SoundBufferRez &)=delete
 
SoundBufferRezoperator= (const SoundBufferRez &)=delete
 
 SoundBufferRez (SoundBufferRez &&)=delete
 
SoundBufferRezoperator= (SoundBufferRez &&)=delete
 

Detailed Description

Convenience class for sound files in resources.


When this class is created, only it's variables are initialized but data isn't actually loaded, to upload the sound to the audio hardware, call SoundManager::Play() or call Upload() directly.

This is a reference counted class, as such it can only be created with a call to New() and disposed of by a call to Release(). Delete() will likely asset with a "refcount is not zero" error.

Constructor & Destructor Documentation

◆ SoundBufferRez() [1/4]

Burger::SoundBufferRez::SoundBufferRez ( const SoundBufferRez & )
privatedelete

◆ SoundBufferRez() [2/4]

Burger::SoundBufferRez::SoundBufferRez ( SoundBufferRez && )
privatedelete

◆ SoundBufferRez() [3/4]

Burger::SoundBufferRez::SoundBufferRez ( void )
protected

Default constructor.


This creates an incomplete class, follow up with a call to Set(RezFile *,uint_t) to have the class access a valid sound file

See also
SoundBufferRez(RezFile *,uint_t) or Set(RezFile *,uint_t)

◆ SoundBufferRez() [4/4]

Burger::SoundBufferRez::SoundBufferRez ( Burger::RezFile * pRezFile,
uint_t uRezNum )
protected

Default constructor.


Sets up the RezFile and resource number of the sound file this buffer derives the audio data from.

Parameters
pRezFilePointer to a RezFile to load data from
uRezNumResource number of the sound file
See also
SoundBufferRez() or Set(RezFile *,uint_t)

Member Function Documentation

◆ get_StaticRTTI()

const Burger::StaticRTTI * Burger::SoundBufferRez::get_StaticRTTI ( void ) const
overridevirtualnoexcept

Get the description to the class.


This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.

Returns
Pointer to a global, read only instance of StaticRTTI for the true class

Reimplemented from Burger::SoundManager::Buffer.

◆ New() [1/2]

Burger::SoundBufferRez *BURGER_API Burger::SoundBufferRez::New ( RezFile * pRezFile,
uint_t uRezNum )
static

Create a new sound buffer.


Parameters
pRezFilePointer to a RezFile to load data from
uRezNumResource number of the sound file
Returns
Pointer to a SoundBufferRez class with a refcount of 1 or NULL if out of memory.

◆ New() [2/2]

Burger::SoundBufferRez *BURGER_API Burger::SoundBufferRez::New ( void )
static

Create a new sound buffer.


Returns
Pointer to a SoundBufferRez class with a refcount of 1 or NULL if out of memory.

◆ operator=() [1/2]

SoundBufferRez & Burger::SoundBufferRez::operator= ( const SoundBufferRez & )
privatedelete

◆ operator=() [2/2]

SoundBufferRez & Burger::SoundBufferRez::operator= ( SoundBufferRez && )
privatedelete

◆ Set()

void Burger::SoundBufferRez::Set ( RezFile * pRezFile,
uint_t uRezNum )

Set the resource to track.


Set the resource number to upload into the sound buffer.

It will purge the previous buffer.

Note
Do not call this function if this buffer is currently being used for sound playback. Behavior is undefined if an audio buffer is manually purged while still in use by audio hardware.
Parameters
pRezFilePointer to a RezFile to load data from
uRezNumResource number of the sound file

◆ Upload()

uint_t Burger::SoundBufferRez::Upload ( SoundManager * pSoundManager)
overridevirtual

Load resource and upload.


If the sound hardware already has the data uploaded, this function will do nothing. Otherwise, it will call the RezFile class to load in the sound data and it will be passed to the audio hardware. After the upload is complete, the RezFile data chunk is marked "released" so it can be purged.

Parameters
pSoundManagerA pointer to the parent SoundManager that manages the audio hardware
Returns
Zero if successful (Or already loaded) or non-zero if an error occurred.

Reimplemented from Burger::SoundManager::Buffer.

Member Data Documentation

◆ g_StaticRTTI

const Burger::StaticRTTI Burger::SoundBufferRez::g_StaticRTTI
static

The global description of the class.


This record contains the name of this class and a reference to the parent

◆ m_pRezFile

RezFile* Burger::SoundBufferRez::m_pRezFile
protected

Pointer to the resource class that the resource is attached to.

◆ m_uRezNum

uint_t Burger::SoundBufferRez::m_uRezNum
protected

Resource number of the sound file.