Annwvyn::AnnAudioFile Class Reference

Ogre resource that contain the data from a binary file for the audio engine importing. More...

#include <AnnAudioFile.hpp>

Inheritance diagram for Annwvyn::AnnAudioFile:
Collaboration diagram for Annwvyn::AnnAudioFile:

Public Member Functions

 AnnAudioFile (Ogre::ResourceManager *creator, const Ogre::String &name, Ogre::ResourceHandle handle, const Ogre::String &group, bool isManual=false, Ogre::ManualResourceLoader *loader=nullptr)
 Create an audio file. This is intended to be called by a resource manager, not by the user. More...
 
virtual ~AnnAudioFile ()
 
const bytegetData () const
 Return a raw const pointer to the data, in bytes. More...
 
size_t getSize () const override
 Return the size. More...
 

Static Public Member Functions

static sf_count_t sfVioGetFileLen (void *audioFileRawPtr)
 Get the length of the file. Give that function pointer to libsndfile. More...
 
static sf_count_t sfVioSeek (sf_count_t offset, int whence, void *audioFileRawPtr)
 Seek (move reading cursor) inside virtual file Give that function pointer to libsndfile. More...
 
static sf_count_t sfVioRead (void *ptr, sf_count_t count, void *audiFileRawPtr)
 REad "count" bytes from cursor to ptr. Will return number of bytes actually read. Will not read past the end of data but do not check writing to the pointer. Give that function pointer to libsndfile. More...
 
static sf_count_t sfVioWriteDummy (const void *, sf_count_t, void *)
 Do nothing. Dummy function just to fill up the interface. Give that function pointer to libsndfile. More...
 
static sf_count_t sfVioTell (void *audioFileRawPtr)
 return current cursor position. Give that function pointer to libsndfile. More...
 
static SF_VIRTUAL_IO * getSndFileVioStruct ()
 Get the virtual I/O struct. Will initialize it at 1st call. Give that function pointer to libsndfile. More...
 
static void clearSndFileVioStruct ()
 For cleanup. Will deallocate the VioStruct and set the pointer back to nullptr. More...
 

Public Attributes

size_t sf_offset
 Current cursor position. the only "state" used while reading the file from libsndfile (except for the data itself, that is non mutable) More...
 

Static Public Attributes

static std::unique_ptr< SF_VIRTUAL_IO > sfVioStruct { nullptr }
 Structure that will contain function pointers to all the functions defined below. More...
 

Protected Member Functions

void loadImpl () override
 Actually load the data. More...
 
void unloadImpl () override
 Clear the data vector. More...
 
size_t calculateSize () const override
 Return the size of the data vector. More...
 

Private Member Functions

void readFromStream (Ogre::DataStreamPtr &stream)
 Read bytes from a data stream and stick them inside the "data" re-sizable array. More...
 

Static Private Member Functions

static AnnAudioFilecast (void *audioFileRawPtr)
 Utility class that perform a static_cast<AnnAudioFile*> on the pointer you give it. More...
 

Private Attributes

std::vector< bytedata
 Where the data is actually stored, as bytes. More...
 

Detailed Description

Ogre resource that contain the data from a binary file for the audio engine importing.

Definition at line 14 of file AnnAudioFile.hpp.

Constructor & Destructor Documentation

◆ AnnAudioFile()

AnnAudioFile::AnnAudioFile ( Ogre::ResourceManager *  creator,
const Ogre::String &  name,
Ogre::ResourceHandle  handle,
const Ogre::String &  group,
bool  isManual = false,
Ogre::ManualResourceLoader *  loader = nullptr 
)

Create an audio file. This is intended to be called by a resource manager, not by the user.

Definition at line 37 of file AnnAudioFile.cpp.

◆ ~AnnAudioFile()

AnnAudioFile::~AnnAudioFile ( )
virtual

Definition at line 44 of file AnnAudioFile.cpp.

Member Function Documentation

◆ calculateSize()

size_t AnnAudioFile::calculateSize ( ) const
overrideprotected

Return the size of the data vector.

Definition at line 32 of file AnnAudioFile.cpp.

◆ cast()

AnnAudioFile * AnnAudioFile::cast ( void *  audioFileRawPtr)
inlinestaticprivate

Utility class that perform a static_cast<AnnAudioFile*> on the pointer you give it.

Definition at line 154 of file AnnAudioFile.cpp.

Here is the caller graph for this function:

◆ clearSndFileVioStruct()

void AnnAudioFile::clearSndFileVioStruct ( )
static

For cleanup. Will deallocate the VioStruct and set the pointer back to nullptr.

Definition at line 180 of file AnnAudioFile.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getData()

const byte * AnnAudioFile::getData ( ) const

Return a raw const pointer to the data, in bytes.

Definition at line 49 of file AnnAudioFile.cpp.

Here is the call graph for this function:

◆ getSize()

size_t AnnAudioFile::getSize ( ) const
override

Return the size.

Definition at line 185 of file AnnAudioFile.cpp.

Here is the call graph for this function:

◆ getSndFileVioStruct()

SF_VIRTUAL_IO * AnnAudioFile::getSndFileVioStruct ( )
static

Get the virtual I/O struct. Will initialize it at 1st call. Give that function pointer to libsndfile.

Definition at line 161 of file AnnAudioFile.cpp.

Here is the call graph for this function:

◆ loadImpl()

void AnnAudioFile::loadImpl ( )
overrideprotected

Actually load the data.

Definition at line 20 of file AnnAudioFile.cpp.

◆ readFromStream()

void AnnAudioFile::readFromStream ( Ogre::DataStreamPtr &  stream)
private

Read bytes from a data stream and stick them inside the "data" re-sizable array.

Definition at line 11 of file AnnAudioFile.cpp.

◆ sfVioGetFileLen()

sf_count_t AnnAudioFile::sfVioGetFileLen ( void *  audioFileRawPtr)
static

Get the length of the file. Give that function pointer to libsndfile.

Definition at line 92 of file AnnAudioFile.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sfVioRead()

sf_count_t AnnAudioFile::sfVioRead ( void *  ptr,
sf_count_t  count,
void *  audiFileRawPtr 
)
static

REad "count" bytes from cursor to ptr. Will return number of bytes actually read. Will not read past the end of data but do not check writing to the pointer. Give that function pointer to libsndfile.

Definition at line 124 of file AnnAudioFile.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sfVioSeek()

sf_count_t AnnAudioFile::sfVioSeek ( sf_count_t  offset,
int  whence,
void *  audioFileRawPtr 
)
static

Seek (move reading cursor) inside virtual file Give that function pointer to libsndfile.

Definition at line 98 of file AnnAudioFile.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sfVioTell()

sf_count_t AnnAudioFile::sfVioTell ( void *  audioFileRawPtr)
static

return current cursor position. Give that function pointer to libsndfile.

Definition at line 147 of file AnnAudioFile.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sfVioWriteDummy()

sf_count_t AnnAudioFile::sfVioWriteDummy ( const void *  ,
sf_count_t  ,
void *   
)
static

Do nothing. Dummy function just to fill up the interface. Give that function pointer to libsndfile.

Definition at line 142 of file AnnAudioFile.cpp.

Here is the caller graph for this function:

◆ unloadImpl()

void AnnAudioFile::unloadImpl ( )
overrideprotected

Clear the data vector.

Definition at line 27 of file AnnAudioFile.cpp.

Member Data Documentation

◆ data

std::vector<byte> Annwvyn::AnnAudioFile::data
private

Where the data is actually stored, as bytes.

Definition at line 17 of file AnnAudioFile.hpp.

◆ sf_offset

size_t Annwvyn::AnnAudioFile::sf_offset

Current cursor position. the only "state" used while reading the file from libsndfile (except for the data itself, that is non mutable)

Definition at line 79 of file AnnAudioFile.hpp.

◆ sfVioStruct

std::unique_ptr< SF_VIRTUAL_IO > AnnAudioFile::sfVioStruct { nullptr }
static

Structure that will contain function pointers to all the functions defined below.

Definition at line 55 of file AnnAudioFile.hpp.


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