MityDSP Documentation Index
tcDspBufPool

Introduction

The tcDspBufPool class provides an automatically-sized semi-static buffer pool for buffers up to 64K bytes. When a request for a buffer of a given size is made, the next larger free list is checked for a free buffer. If none exist, a new buffer is created. When a buffer is released, it is not deleted, but returned to the free list.

This means that all buffers are created once, usually at or near initialization for most applications, and are reused without ever being deleted.

Internal buffer sizes range from 16 bytes to 64 Kbytes in powers of 4.

See also:
MityDSP::tcDspBufPool Class Reference

Example

This is a simple example of tcDspBufPool creation and usage:

{
tcDspBufPool::thBufHandle ahBufPool;
int myMsgSize = 987;
char *myMsg;
// allocate a buffer of the desired size
ahBufPool = tcDspBufPool::GetInstance()->Alloc(myMsgSize);
// get a pointer to the actual storage
myMsg = (char *)tcDspBufPool::GetInstance()->GetAddr(ahBufPool);
// manipulate buffer as required
...
// return buffer to pool when done
tcDspBufPool::GetInstance()->Free(ahBufPool);
...
}

  
Generated on Mon Apr 22 2013 11:33:02 for MityDSP Core by  Doxygen Version 1.8.1.1
Copyright © 2009, Critical Link LLC, All rights reserved.