Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
jop::SoundBuffer Class Reference

#include <SoundBuffer.hpp>

Inheritance diagram for jop::SoundBuffer:
jop::Resource jop::SafeReferenceable< Resource > jop::SerializeInfo

Public Types

enum  AudioFormat { AudioFormat::undefined, AudioFormat::wav, AudioFormat::ogg }
 

Public Member Functions

 SoundBuffer (const std::string &name)
 Constructor. More...
 
 SoundBuffer (const SoundBuffer &other, const std::string &newName)
 Copy constructor. More...
 
 ~SoundBuffer () override
 Destructor. More...
 
bool load (const std::string &path)
 Load a new buffer from file. More...
 
bool load (const void *ptr, const uint32 size)
 Load a new buffer from memory. More...
 
- Public Member Functions inherited from jop::Resource
 Resource (const std::string &name)
 Constructor. More...
 
virtual ~Resource ()=0
 Virtual destructor. More...
 
const std::string & getName () const
 Get the name of this resource. More...
 
void setPersistence (const unsigned short level)
 Set the persistence level. More...
 
unsigned short getPersistence () const
 Get the persistence level. More...
 
- Public Member Functions inherited from jop::SafeReferenceable< Resource >
WeakReference< ResourcegetReference () const
 Get a weak reference to the bound object. More...
 
- Public Member Functions inherited from jop::SerializeInfo
 SerializeInfo ()
 
void setSerializePackage (const uint16 package)
 
uint16 getSerializePackage () const
 
void setShouldSerialize (const bool set)
 
bool shouldSerialize () const
 
void setLightSerializeable (const bool set)
 
bool isLightSerializeable () const
 

Static Public Member Functions

static SoundBuffergetDefault ()
 Get default sound buffer. More...
 

Friends

class AudioReader
 
class SoundEffect
 
class SoundStream
 

Additional Inherited Members

- Protected Member Functions inherited from jop::Resource
 Resource (const Resource &other, const std::string &newName)
 Copy constructor. More...
 
- Protected Member Functions inherited from jop::SafeReferenceable< Resource >
 SafeReferenceable (Resource *ref)
 Constructor. More...
 
 SafeReferenceable (SafeReferenceable< Resource > &&other)
 Move constructor. More...
 
SafeReferenceableoperator= (SafeReferenceable< Resource > &&other)
 Move assignment operator. More...
 
 ~SafeReferenceable ()
 Protected destructor. More...
 

Detailed Description

Sound data storage

Definition at line 38 of file SoundBuffer.hpp.

Member Enumeration Documentation

Enumerator
undefined 
wav 
ogg 

Definition at line 42 of file SoundBuffer.hpp.

Constructor & Destructor Documentation

jop::SoundBuffer::SoundBuffer ( const std::string &  name)

Constructor.

Initializes the internal buffer to be empty.

Parameters
nameName of this resource
jop::SoundBuffer::SoundBuffer ( const SoundBuffer other,
const std::string &  newName 
)

Copy constructor.

Parameters
otherThe other buffer to be copied
newNameNew name of this resource
jop::SoundBuffer::~SoundBuffer ( )
override

Destructor.

Warning
Destroying a sound buffer while it's being used by a SoundEffect instance, will most likely lead to a crash.

Member Function Documentation

static SoundBuffer& jop::SoundBuffer::getDefault ( )
static

Get default sound buffer.

Returns
Reference to the buffer
bool jop::SoundBuffer::load ( const std::string &  path)

Load a new buffer from file.

Parameters
pathPath for wanted resource
Returns
True if successful
bool jop::SoundBuffer::load ( const void *  ptr,
const uint32  size 
)

Load a new buffer from memory.

Parameters
ptrPointer to data
sizeSize if the data in bytes
Returns
True if successful

Friends And Related Function Documentation

friend class AudioReader
friend

Definition at line 60 of file SoundBuffer.hpp.

friend class SoundEffect
friend

Definition at line 61 of file SoundBuffer.hpp.

friend class SoundStream
friend

Definition at line 62 of file SoundBuffer.hpp.


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