![]() |
nCine 2025.06.r503-ff15d8d
A cross-platform 2D game engine
|
A class representing an OpenAL buffer. More...
#include <AudioBuffer.h>
Public Types | |
enum class | Format { MONO8 , STEREO8 , MONO16 , STEREO16 } |
![]() | |
enum class | ObjectType { BASE = 0 , TEXTURE , SHADER , SCENENODE , SPRITE , MESH_SPRITE , ANIMATED_SPRITE , PARTICLE , PARTICLE_SYSTEM , FONT , TEXTNODE , AUDIOBUFFER , AUDIOBUFFER_PLAYER , AUDIOSTREAM_PLAYER } |
Object types. | |
Public Member Functions | |
AudioBuffer () | |
Creates an OpenAL buffer name. | |
AudioBuffer (const char *bufferName, const unsigned char *bufferPtr, unsigned long int bufferSize) | |
A constructor creating a buffer from memory. | |
AudioBuffer (const char *filename) | |
A constructor creating a buffer from a file. | |
AudioBuffer (AudioBuffer &&other) | |
Move constructor. | |
AudioBuffer & | operator= (AudioBuffer &&other) |
Move assignment operator. | |
void | init (const char *name, Format format, int frequency) |
Initializes an empty buffer with the specified format and frequency. | |
bool | loadFromMemory (const char *bufferName, const unsigned char *bufferPtr, unsigned long int bufferSize) |
bool | loadFromFile (const char *filename) |
bool | loadFromSamples (const unsigned char *bufferPtr, unsigned long int bufferSize) |
Loads samples in raw PCM format from a memory buffer. | |
unsigned int | bufferId () const |
Returns the OpenAL buffer id. | |
int | bytesPerSample () const |
Returns the number of bytes per sample. | |
int | numChannels () const |
Returns the number of audio channels. | |
int | frequency () const |
Returns the samples frequency. | |
unsigned long int | numSamples () const |
Returns number of samples. | |
float | duration () const |
Returns the duration in seconds. | |
unsigned long | bufferSize () const |
Returns the size of the buffer in bytes. | |
![]() | |
Object (ObjectType type) | |
Constructs an object with a specified type and adds it to the index. | |
Object (ObjectType type, const char *name) | |
Constructs an object with a specified type and name and adds it to the index. | |
virtual | ~Object () |
Removes an object from the index and then destroys it. | |
Object (Object &&other) | |
Move constructor. | |
Object & | operator= (Object &&other) |
Move assignment operator. | |
unsigned int | id () const |
Returns the object identification number. | |
ObjectType | type () const |
Returns the object type (RTTI) | |
const char * | name () const |
Returns the object name. | |
void | setName (const char *name) |
Sets the object name. | |
Static Public Member Functions | |
static ObjectType | sType () |
![]() | |
static ObjectType | sType () |
Static method to return class type. | |
template<class T > | |
static T * | fromId (unsigned int id) |
Returns a casted pointer to the object with the specified id, if any exists. | |
Additional Inherited Members | |
![]() | |
static const unsigned int | MaxNameLength = 128 |
Maximum length for an object name. | |
![]() | |
Object (const Object &other) | |
Protected copy constructor used to clone objects. | |
![]() | |
ObjectType | type_ |
Object type. | |
A class representing an OpenAL buffer.
It inherits from Object
because a buffer can be shared by more than one AudioBufferPlayer
object.