Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

ark::SoundChunk Class Reference

#include <SoundChunk.h>

List of all members.

Public Member Functions

 SoundChunk ()
 SoundChunk (Sample *buff, const unsigned fc)
 SoundChunk (Sample **buff, const unsigned cc, const unsigned fc)
 ~SoundChunk ()
 SoundChunk (SoundChunk const &chnk)
SoundChunk & operator= (SoundChunk const &chnk)
SoundChunk copy (Allocator &alloc=SystemAllocator::global()) const
void setDestroyer (Allocator &pool)
void setDestroyer (MemoryGate<> &gate)
void resetDestroyer ()
bool hasDestroyer () const
void destroyMemory ()
SoundChunk & release ()
bool isValid () const
unsigned frameCount () const
void setFrameCount (unsigned n)
unsigned channelCount () const
void setChannelCount (unsigned n)
Sample * buffer (unsigned n)
Sample const * buffer (unsigned n) const
void setBuffer (unsigned n, Sample *buff)
Sample * operator[] (unsigned n)
Sample const * operator[] (unsigned n) const
Sample * begin (unsigned n)
Sample const * begin (unsigned n) const
Sample * end (unsigned n)
Sample const * end (unsigned n) const
SoundChunk subChunk (unsigned b, unsigned len)
void write (unsigned pos, Sample *buff, unsigned len)
void write (unsigned to, SoundChunk const &buff)
bool writeChannel (unsigned chan, unsigned pos, Sample *buff, unsigned len)
void clear (unsigned b, unsigned len)
void clear ()
void clearChannel (unsigned n, unsigned b, unsigned len)
void clearChannel (unsigned n)

Private Types

enum  _ExitStrategy { USE_NONE = 0, USE_GATE, USE_POOL, USE_ENUM_END }

Private Member Functions

void _destroy ()

Private Attributes

Sample * _buffers [ARK_MAX_CHANNELS]
unsigned _frameCount
unsigned _channelCount
union {
   MemoryGate *   _gate
   Allocator *   _pool
} _exit
int _exitCmd


Detailed Description

Note:
SoundChunk is compile time optimized for stereo.


Member Enumeration Documentation

enum ark::SoundChunk::_ExitStrategy [private]
 

Enumerator:
USE_NONE 
USE_GATE 
USE_POOL 
USE_ENUM_END 


Constructor & Destructor Documentation

ark::SoundChunk::SoundChunk (   )  [inline]
 

ark::SoundChunk::SoundChunk (  Sample *  buff,
const unsigned  fc
)  [inline]
 

ark::SoundChunk::SoundChunk (  Sample **  buff,
const unsigned  cc,
const unsigned  fc
)  [inline]
 

ark::SoundChunk::~SoundChunk (   )  [inline]
 

ark::SoundChunk::SoundChunk (  SoundChunk const &  chnk  )  [inline]
 


Member Function Documentation

void ark::SoundChunk::_destroy (   )  [inline, private]
 

Sample const* ark::SoundChunk::begin (  unsigned  n  )  const [inline]
 

Sample* ark::SoundChunk::begin (  unsigned  n  )  [inline]
 

Sample const* ark::SoundChunk::buffer (  unsigned  n  )  const [inline]
 

Sample* ark::SoundChunk::buffer (  unsigned  n  )  [inline]
 

unsigned ark::SoundChunk::channelCount (   )  const [inline]
 

void ark::SoundChunk::clear (   )  [inline]
 

clear Clears the entire chunk to 0.

See also:
clearChannel()

void ark::SoundChunk::clear (  unsigned  b,
unsigned  len
)  [inline]
 

clear Clears all channels of this chunk in the specified region to 0.

Parameters:
b The begion offset of the region to clear
len The length of the region to clear
See also:
clearChannel()

void ark::SoundChunk::clearChannel (  unsigned  n  )  [inline]
 

clearChannel Clears the entire channel specified.

Parameters:
n The channel to clear
See also:
clear()

void ark::SoundChunk::clearChannel (  unsigned  n,
unsigned  b,
unsigned  len
)  [inline]
 

clearChannel Clears a specified range in a specific channel to 0.

Parameters:
n The channel to clear
b The begin offset of the region to clear
len The length of the region to clear
See also:
clear()

SoundChunk ark::SoundChunk::copy (  Allocator &  alloc = SystemAllocator::global()  )  const [inline]
 

copy Copies the chunk contents into a new chunk and returns it. New chunks are allocated from the system allocator, unless another allocator is passed as a parameter.

Parameters:
alloc The allocator to create the copy with, defaults to the system allocator
Returns:
A copy of this sound chunk's contents, minus configuration data (ie. destroyers)

void ark::SoundChunk::destroyMemory (   )  [inline]
 

destroyMemory If this->hasDestroyer() == true, then the memory for this chunk is destroyed with the installed destroyer, otherwise, does nothing.

See also:
setDstroyer()

hasDestroyer()

Sample const* ark::SoundChunk::end (  unsigned  n  )  const [inline]
 

Sample* ark::SoundChunk::end (  unsigned  n  )  [inline]
 

unsigned ark::SoundChunk::frameCount (   )  const [inline]
 

bool ark::SoundChunk::hasDestroyer (   )  const [inline]
 

hasDestroyer

Returns:
True if a destroyer is installed
See also:
setDestroyer()

resetDestroyer()

bool ark::SoundChunk::isValid (   )  const [inline]
 

SoundChunk& ark::SoundChunk::operator= (  SoundChunk const &  chnk  )  [inline]
 

Sample const* ark::SoundChunk::operator[] (  unsigned  n  )  const [inline]
 

Sample* ark::SoundChunk::operator[] (  unsigned  n  )  [inline]
 

SoundChunk& ark::SoundChunk::release (   )  [inline]
 

release Convenience function, calls resetDestroeyer() and returns a reference to *this. Useful for removing RAII hook just as you return a sound chunk from a function.

See also:
resetDestroyer()

void ark::SoundChunk::resetDestroyer (   )  [inline]
 

resetDestroyer Removes any currently registered destroyer.

See also:
setDestroyer()

hasDestroyer()

void ark::SoundChunk::setBuffer (  unsigned  n,
Sample *  buff
)  [inline]
 

void ark::SoundChunk::setChannelCount (  unsigned  n  )  [inline]
 

void ark::SoundChunk::setDestroyer (  MemoryGate<> &  gate  )  [inline]
 

setDestroyer Sets a memory gate as the designated destroyer for this chunk, invalidating all previously registered destroyers.

Parameters:
gate The new destroyer
See also:
resetDestroyer()

hasDestroyer()

void ark::SoundChunk::setDestroyer (  Allocator &  pool  )  [inline]
 

setDestroyer Sets an allocator as the designated destroyer for this chunk, invalidating all previously registered destroyers.

Parameters:
pool The new destroyer
See also:
resetDestroyer()

hasDestroyer()

void ark::SoundChunk::setFrameCount (  unsigned  n  )  [inline]
 

SoundChunk ark::SoundChunk::subChunk (  unsigned  b,
unsigned  len
)  [inline]
 

subChunk Creates a subchunk from the desired region of this chunk. The subchunk does not own it's memory and thus no destroyer should be installed.

Parameters:
b The begin offset for the subchunk
len The length of the subchunk
Returns:
A sound chunk containing the subchunk

void ark::SoundChunk::write (  unsigned  to,
SoundChunk const &  buff
)  [inline]
 

write Writes the passed chunk at the specified offset.

Parameters:
to The offset to write to
buff The sound chunk to write
See also:
writeChannel()

void ark::SoundChunk::write (  unsigned  pos,
Sample *  buff,
unsigned  len
)  [inline]
 

write Writes a sample buffer to a specified offset of each channel in this chunk.

Parameters:
pos The offset to write to
buff The buffer to write
len The length of the buffer to write
See also:
writeChannel()

bool ark::SoundChunk::writeChannel (  unsigned  chan,
unsigned  pos,
Sample *  buff,
unsigned  len
)  [inline]
 

writeChannel Writes a buffer to a specified offset of a specific channel in this chunk.

Parameters:
chan The channel to write to
pos The offset to write to
buff The data to write
len The length of the data to write
See also:
write()


Member Data Documentation

Sample* ark::SoundChunk::_buffers[ARK_MAX_CHANNELS] [private]
 

unsigned ark::SoundChunk::_channelCount [private]
 

union { ... } ark::SoundChunk::_exit [private]
 

int ark::SoundChunk::_exitCmd [private]
 

unsigned ark::SoundChunk::_frameCount [private]
 

MemoryGate* ark::SoundChunk::_gate [private]
 

Allocator* ark::SoundChunk::_pool [private]
 


The documentation for this class was generated from the following file:
Generated on Tue Sep 6 14:54:41 2005 for Arkonnekt Sound by  doxygen 1.4.4