cAudio  2.3.0
3d Audio Engine
Public Member Functions | Protected Attributes | List of all members
cAudio::cMemorySource Class Reference

Class used to read from a memory buffer. More...

#include <cMemorySource.h>

Inheritance diagram for cAudio::cMemorySource:
Inheritance graph
[legend]
Collaboration diagram for cAudio::cMemorySource:
Collaboration graph
[legend]

Public Member Functions

 cMemorySource (const void *data, int size, bool copy)
 
virtual bool isValid ()
 Returns whether the source is valid. More...
 
virtual int getCurrentPos ()
 Returns the current location in the data stream.
 
virtual int getSize ()
 Returns the total size of the data stream.
 
virtual int read (void *output, int size)
 Reads out a section of the data stream. More...
 
virtual bool seek (int amount, bool relative)
 Seek to a position in the data stream. More...
 
- Public Member Functions inherited from cAudio::IRefCounted
virtual void grab ()
 Increments the reference count by one.
 
virtual bool drop ()
 Decrements the reference count by one. If it hits zero, this object is deleted.
 
int getReferenceCount () const
 Returns the current reference count of this object.
 
- Public Member Functions inherited from cAudio::cMemoryOverride
void * operator new (size_t size, const char *file, int line, const char *function)
 
void * operator new (size_t size)
 
void * operator new (size_t size, void *pointer)
 
void * operator new[] (size_t size, const char *file, int line, const char *function)
 
void * operator new[] (size_t size)
 
void operator delete (void *pointer)
 
void operator delete (void *pointer, void *)
 
void operator delete (void *pointer, const char *, int, const char *)
 
void operator delete[] (void *pointer)
 
void operator delete[] (void *pointer, const char *, int, const char *)
 

Protected Attributes

char * Data
 
int Size
 
bool Valid
 
int Pos
 
- Protected Attributes inherited from cAudio::IRefCounted
int RefCount
 

Detailed Description

Class used to read from a memory buffer.

Definition at line 13 of file cMemorySource.h.

Constructor & Destructor Documentation

◆ cMemorySource()

cAudio::cMemorySource::cMemorySource ( const void *  data,
int  size,
bool  copy 
)

Default Constructor

Parameters
dataPointer to a data buffer to use.
sizeSize of the target buffer.
copyWhether to copy the buffer or use the provided pointer. On destruct, that pointer will be deleted unless copy is true.

Definition at line 12 of file cMemorySource.cpp.

Member Function Documentation

◆ isValid()

bool cAudio::cMemorySource::isValid ( )
virtual

Returns whether the source is valid.

Returns
Returns false in case of an error, like the file couldn't be found.

Implements cAudio::IDataSource.

Definition at line 37 of file cMemorySource.cpp.

Here is the caller graph for this function:

◆ read()

int cAudio::cMemorySource::read ( void *  output,
int  size 
)
virtual

Reads out a section of the data stream.

Parameters
outputPointer to a location to put the read data.
sizeSize in bytes of the data to read.
Returns
Number of bytes actually read. 0 bytes may indicate end of file or stream.

Implements cAudio::IDataSource.

Definition at line 52 of file cMemorySource.cpp.

◆ seek()

bool cAudio::cMemorySource::seek ( int  amount,
bool  relative 
)
virtual

Seek to a position in the data stream.

Parameters
amountAmount in bytes to seek to.
relativeIf true the number of bytes in amount is relative to the current position in the stream.
Returns
True if seek was successful, false if not.

Implements cAudio::IDataSource.

Definition at line 72 of file cMemorySource.cpp.


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