本文整理汇总了C++中object_pool类的典型用法代码示例。如果您正苦于以下问题:C++ object_pool类的具体用法?C++ object_pool怎么用?C++ object_pool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了object_pool类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: close
void FreeSurround::close()
{
if (decoder)
{
dp.release(this);
decoder = 0;
}
}
开发者ID:stunami,项目名称:mythtv,代码行数:8,代码来源:freesurround.cpp
示例2: LOG
FreeSurround::~FreeSurround()
{
LOG(VB_AUDIO, LOG_DEBUG, QString("FreeSurround::~FreeSurround"));
close();
if (bufs)
{
bp.release((void*)1);
bufs = NULL;
}
LOG(VB_AUDIO, LOG_DEBUG, QString("FreeSurround::~FreeSurround done"));
}
开发者ID:stunami,项目名称:mythtv,代码行数:11,代码来源:freesurround.cpp
示例3: VERBOSE
FreeSurround::~FreeSurround()
{
VERBOSE(VB_AUDIO+VB_EXTRA, QString("FreeSurround::~FreeSurround"));
close();
if (bufs)
{
bp.release((void*)1);
bufs = NULL;
}
VERBOSE(VB_AUDIO+VB_EXTRA, QString("FreeSurround::~FreeSurround done"));
}
开发者ID:DocOnDev,项目名称:mythtv,代码行数:11,代码来源:freesurround.cpp
示例4: open
// load the lib and initialize the interface
void FreeSurround::open()
{
if (!decoder)
{
decoder = (fsurround_decoder*)dp.acquire((void*)1);
decoder->flush();
if (bufs)
bufs->clear();
decoder->sample_rate(srate);
}
SetParams();
}
开发者ID:stunami,项目名称:mythtv,代码行数:13,代码来源:freesurround.cpp
示例5: srate
FreeSurround::FreeSurround(uint srate, bool moviemode, SurroundMode smode) :
srate(srate),
open_(false),
initialized_(false),
bufs(NULL),
decoder(0),
in_count(0),
out_count(0),
processed(true),
processed_size(0),
surround_mode(smode),
latency_frames(0)
{
LOG(VB_AUDIO, LOG_DEBUG,
QString("FreeSurround::FreeSurround rate %1 moviemode %2")
.arg(srate).arg(moviemode));
if (moviemode)
{
params.phasemode = 1;
params.center_width = 25;
params.dimension = 0.5;
}
else
{
params.center_width = 65;
params.dimension = 0.3;
}
switch (surround_mode)
{
case SurroundModeActiveSimple:
params.steering = 0;
break;
case SurroundModeActiveLinear:
params.steering = 1;
latency_frames = block_size/2;
break;
default:
break;
}
bufs = (buffers*)bp.acquire((void*)1);
open();
#ifdef SPEAKERTEST
channel_select++;
if (channel_select>=6)
channel_select = 0;
LOG(VB_AUDIO, LOG_DEBUG,
QString("FreeSurround::FreeSurround channel_select %1")
.arg(channel_select));
#endif
LOG(VB_AUDIO, LOG_DEBUG, QString("FreeSurround::FreeSurround done"));
}
开发者ID:stunami,项目名称:mythtv,代码行数:53,代码来源:freesurround.cpp
示例6: testPoolEfficiency
static void testPoolEfficiency(){
const int test_time = 1;
vector<int> ops;
int tot=0;
for(int i=0;i<test_time;i++){
int op=0;
if(tot){
if(rand()%2==0){
op=1;
}
}
if(op) tot--;
else tot++;
ops.push_back(op);
}
{
LifeCircleLogger logger("use system new");
CCArray *tmp = CCArray::array();
for(int i=0;i<test_time;i++){
if(ops[i]){
tmp->removeLastObject();
}else{
CCSprite *sp = CCSprite::node();
tmp->addObject(sp);
}
}
}{
LifeCircleLogger logger("use MTPool");
CCArray *tmp = CCArray::array();
for(int i=0;i<test_time;i++){
if(ops[i]){
tmp->removeLastObject();
}else{
CCSprite *sp = MTPoolManager::sharedManager()->getObject(sp);
tmp->addObject(sp);
}
}
}{
LifeCircleLogger logger("use boost Pool");
CCArray *tmp = CCArray::array();
for(int i=0;i<test_time;i++){
if(ops[i]){
tmp->removeLastObject();
}else{
CCSprite *sp =spritePool.construct();
tmp->addObject(sp);
}
}
}
}
开发者ID:littleDing,项目名称:cocos2d-x-extension,代码行数:51,代码来源:MTPool.cpp
注:本文中的object_pool类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论