本文整理汇总了C++中setBufferSize函数的典型用法代码示例。如果您正苦于以下问题:C++ setBufferSize函数的具体用法?C++ setBufferSize怎么用?C++ setBufferSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setBufferSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: die
int MOVE::localInit(double *p, int n_args)
{
if (n_args < 6) {
die(name(), "Wrong number of args.");
return(DONT_SCHEDULE);
}
m_dist = p[4];
m_rvbamp = p[5];
m_inchan = n_args > 6 ? (int)p[6] : AVERAGE_CHANS;
// copy global params into instrument
if (get_path_params(&rholoc[0], &thetaloc[0], &cartflag, &mindiff) < 0) {
die(name(), "get_path_params failed.");
return(DONT_SCHEDULE);
}
// treat mindiff as update rate in seconds
if (mindiff > 0.0) {
m_updateSamps = (int) (SR * mindiff + 0.5);
if (m_updateSamps <= BUFLEN)
{
setBufferSize(m_updateSamps);
#ifdef debug
printf("buffer size reset to %d samples\n", getBufferSize());
#endif
}
// if update rate is larger than BUFLEN samples, set buffer size
// to be some integer fraction of the desired update count, then
// reset update count to be multiple of this.
else {
int divisor = 2;
int newBufferLen;
while ((newBufferLen = m_updateSamps / divisor) > BUFLEN)
divisor++;
setBufferSize(newBufferLen);
m_updateSamps = newBufferLen * divisor;
#ifdef debug
printf("buffer size reset to %d samples\n", getBufferSize());
#endif
}
#ifdef debug
printf("updating every %d samps\n", m_updateSamps);
#endif
}
// tables for positional lookup
tableset(SR, m_dur, ARRAYSIZE, tabr);
tableset(SR, m_dur, ARRAYSIZE, tabt);
return 0;
}
示例2: die
int DMOVE::localInit(double *p, int n_args)
{
if (n_args < 7)
return die(name(), "Wrong number of args.");
m_dist = p[6];
if (m_dist < 0.0) {
rtcmix_advise(name(), "Using cartesian coordinate system");
m_dist *= -1.0;
m_cartflag = 1;
}
m_inchan = n_args > 7 ? (int)p[7] : AVERAGE_CHANS;
// copy global params into instrument
int ignoreme;
if (get_params(&ignoreme, &mindiff) < 0)
return die(name(), "get_params failed.");
// treat mindiff as update rate in seconds
if (mindiff > 0.0) {
m_updateSamps = (int) (SR * mindiff + 0.5);
if (m_updateSamps <= RTBUFSAMPS)
{
setBufferSize(m_updateSamps);
#ifdef debug
printf("buffer size reset to %d samples\n", getBufferSize());
#endif
}
// if update rate is larger than RTBUFSAMPS samples, set buffer size
// to be some integer fraction of the desired update count, then
// reset update count to be multiple of this.
else {
int divisor = 2;
int newBufferLen;
while ((newBufferLen = m_updateSamps / divisor) > RTBUFSAMPS)
divisor++;
setBufferSize(newBufferLen);
m_updateSamps = newBufferLen * divisor;
#ifdef debug
printf("buffer size reset to %d samples\n", getBufferSize());
#endif
}
#ifdef debug
printf("updating every %d samps\n", m_updateSamps);
#endif
}
return 0;
}
示例3: getBufferSize
gl::Error StreamingIndexBufferInterface::reserveBufferSpace(unsigned int size, GLenum indexType)
{
unsigned int curBufferSize = getBufferSize();
unsigned int writePos = getWritePosition();
if (size > curBufferSize)
{
gl::Error error = setBufferSize(std::max(size, 2 * curBufferSize), indexType);
if (error.isError())
{
return error;
}
setWritePosition(0);
}
else if (writePos + size > curBufferSize || writePos + size < writePos)
{
gl::Error error = discard();
if (error.isError())
{
return error;
}
setWritePosition(0);
}
return gl::Error(GL_NO_ERROR);
}
示例4: memcpy
RESULT eDVBSectionReader::start(const eDVBSectionFilterMask &mask)
{
RESULT res;
if (fd < 0)
return -ENODEV;
notifier->start();
dmx_sct_filter_params sct;
sct.pid = mask.pid;
sct.timeout = 0;
sct.flags = DMX_IMMEDIATE_START;
if (mask.flags & eDVBSectionFilterMask::rfCRC)
{
sct.flags |= DMX_CHECK_CRC;
checkcrc = 1;
} else
checkcrc = 0;
memcpy(sct.filter.filter, mask.data, DMX_FILTER_SIZE);
memcpy(sct.filter.mask, mask.mask, DMX_FILTER_SIZE);
memcpy(sct.filter.mode, mask.mode, DMX_FILTER_SIZE);
setBufferSize(8192*8);
res = ::ioctl(fd, DMX_SET_FILTER, &sct);
if (!res)
{
active = 1;
}
return res;
}
示例5: i
RESULT eDVBTSRecorder::start()
{
std::map<int,int>::iterator i(m_pids.begin());
if (m_running)
return -1;
if (m_target_fd == -1)
return -2;
if (i == m_pids.end())
return -3;
char filename[128];
snprintf(filename, 128, "/dev/dvb/adapter%d/demux%d", m_demux->adapter, m_demux->demux);
m_source_fd = ::open(filename, O_RDONLY | O_CLOEXEC);
if (m_source_fd < 0)
{
eDebug("FAILED to open demux (%s) in ts recoder (%m)", filename);
return -3;
}
setBufferSize(1024*1024);
dmx_pes_filter_params flt;
memset(&flt, 0, sizeof(flt));
flt.pes_type = DMX_PES_OTHER;
flt.output = DMX_OUT_TSDEMUX_TAP;
flt.pid = i->first;
++i;
flt.input = DMX_IN_FRONTEND;
flt.flags = 0;
int res = ::ioctl(m_source_fd, DMX_SET_PES_FILTER, &flt);
if (res)
{
eDebug("DMX_SET_PES_FILTER: %m");
::close(m_source_fd);
m_source_fd = -1;
return -3;
}
::ioctl(m_source_fd, DMX_START);
if (!m_target_filename.empty())
m_thread->startSaveMetaInformation(m_target_filename);
m_thread->start(m_source_fd);
m_running = 1;
while (i != m_pids.end()) {
startPID(i->first);
++i;
}
return 0;
}
示例6: m_nInputBufferPos
// ---------------------------------------------------------------------
FileReader::FileReader(FileInputStream *inputStream, encoding::TextEncoding
decoder, uint32_t sizeBuffer)
: m_nInputBufferPos(0), m_nInputBufferLength(0)
{
setBufferSize(sizeBuffer);
setDecoder(encoding::BaseDecoder::getDecoder(decoder));
setInputStream(inputStream);
}
示例7: window
void QQnxRasterWindow::adjustBufferSize()
{
// When having a raster window we don't need any buffers, since
// Qt will draw to the parent TLW backing store.
const QSize windowSize = window()->parent() ? QSize(1,1) : window()->size();
if (windowSize != bufferSize())
setBufferSize(windowSize);
}
示例8: setBufferSize
DisplayWrapper::DisplayWrapper()
{
bufferSize = 0;
outputLocation = 0;
setBufferSize(0);
display = DriverStationLCD::GetInstance();
displayDirty = true;
}
示例9: dialog
void RosoutPanel::onSetup(wxCommandEvent& evt)
{
RosoutSetupDialog dialog(this, topic_, max_messages_);
if (dialog.ShowModal() == wxOK)
{
setTopic(dialog.getTopic());
setBufferSize(dialog.getBufferSize());
}
}
示例10: memcpy
RESULT eDVBSectionReader::start(const eDVBSectionFilterMask &mask)
{
RESULT res;
if (fd < 0)
return -ENODEV;
notifier->start();
#if HAVE_DVB_API_VERSION < 3
dmxSctFilterParams sct;
#else
dmx_sct_filter_params sct;
#endif
sct.pid = mask.pid;
sct.timeout = 0;
#if HAVE_DVB_API_VERSION < 3
sct.flags = 0;
#else
sct.flags = DMX_IMMEDIATE_START;
#endif
#if !FUZZING
if (mask.flags & eDVBSectionFilterMask::rfCRC)
{
sct.flags |= DMX_CHECK_CRC;
checkcrc = 1;
} else
#endif
checkcrc = 0;
memcpy(sct.filter.filter, mask.data, DMX_FILTER_SIZE);
memcpy(sct.filter.mask, mask.mask, DMX_FILTER_SIZE);
#if HAVE_DVB_API_VERSION >= 3
memcpy(sct.filter.mode, mask.mode, DMX_FILTER_SIZE);
setBufferSize(8192*8);
#endif
res = ::ioctl(fd, DMX_SET_FILTER, &sct);
if (!res)
{
#if HAVE_DVB_API_VERSION < 3
res = ::ioctl(fd, DMX_SET_NEGFILTER_MASK, mask.mode);
if (!res)
{
res = ::ioctl(fd, DMX_START, 0);
if (!res)
active = 1;
}
#else
active = 1;
#endif
}
return res;
}
示例11: setDefaultColor
/*
* デストラクタ。
* @return なし
*/
ScreenControl::~ScreenControl()
{
setDefaultColor();
setWindow(mInitWindow.Left, mInitWindow.Top, mInitWindow.Right, mInitWindow.Bottom);
setBufferSize(mInitBufferSize.X, mInitBufferSize.Y);
// 初期ハンドルの再設定
SetConsoleActiveScreenBuffer(mInitHandle);
// スクリーンバッファを解放
CloseHandle(mHandle);
mHandle = NULL;
}
示例12: getBufferSize
angle::Result StaticIndexBufferInterface::reserveBufferSpace(const gl::Context *context,
unsigned int size,
gl::DrawElementsType indexType)
{
unsigned int curSize = getBufferSize();
if (curSize == 0)
{
return setBufferSize(context, size, indexType);
}
ASSERT(curSize >= size && indexType == getIndexType());
return angle::Result::Continue;
}
示例13: pStart
ParticleSystem::ParticleSystem(Image * sprite, unsigned int buffer) : pStart(0), pLast(0), pEnd(0), active(true), emissionRate(0),
emitCounter(0), lifetime(-1), life(0), particleLifeMin(0), particleLifeMax(0),
direction(0), spread(0), relative(false), speedMin(0), speedMax(0), gravityMin(0),
gravityMax(0), radialAccelerationMin(0), radialAccelerationMax(0),
tangentialAccelerationMin(0), tangentialAccelerationMax(0),
sizeStart(1), sizeEnd(1), sizeVariation(0), rotationMin(0), rotationMax(0),
spinStart(0), spinEnd(0), spinVariation(0)
{
this->sprite = sprite;
sprite->retain();
colorStart = Color(255, 255, 255, 255);
colorEnd = Color(255, 255, 255, 255);
setBufferSize(buffer);
}
示例14: ACE_TRACE
unsigned EthernetFrame::setBack(ACE_UINT8* buffer, const unsigned bufLen) {
ACE_TRACE("EthernetFrame::setBack");
throwIfUninitialized(); // setHeader() has to be called first
if ( getExpectedLength() != bufLen + minBytesToDetermineLength() ) {
ND_ERROR("Expected length %d != %d + buffer size %d (type is %04X)!\n",
getExpectedLength(), minBytesToDetermineLength(), bufLen, getEtherType());
throw std::runtime_error("Expected Ethernet header/payload length is different than buffer.");
}
setBufferSize(getExpectedLength());
copyUnit(ptrUnit() + minBytesToDetermineLength(), buffer, bufLen);
return getUnitLength();
}
示例15: pMem
ParticleSystem::ParticleSystem(const ParticleSystem &p)
: pMem(nullptr)
, pFree(nullptr)
, pHead(nullptr)
, pTail(nullptr)
, particleVerts(nullptr)
, texture(p.texture)
, active(p.active)
, insertMode(p.insertMode)
, maxParticles(p.maxParticles)
, activeParticles(0)
, emissionRate(p.emissionRate)
, emitCounter(0.0f)
, position(p.position)
, prevPosition(p.prevPosition)
, areaSpreadDistribution(p.areaSpreadDistribution)
, areaSpread(p.areaSpread)
, lifetime(p.lifetime)
, life(p.lifetime) // Initialize with the maximum life time.
, particleLifeMin(p.particleLifeMin)
, particleLifeMax(p.particleLifeMax)
, direction(p.direction)
, spread(p.spread)
, speedMin(p.speedMin)
, speedMax(p.speedMax)
, linearAccelerationMin(p.linearAccelerationMin)
, linearAccelerationMax(p.linearAccelerationMax)
, radialAccelerationMin(p.radialAccelerationMin)
, radialAccelerationMax(p.radialAccelerationMax)
, tangentialAccelerationMin(p.tangentialAccelerationMin)
, tangentialAccelerationMax(p.tangentialAccelerationMax)
, linearDampingMin(p.linearDampingMin)
, linearDampingMax(p.linearDampingMax)
, sizes(p.sizes)
, sizeVariation(p.sizeVariation)
, rotationMin(p.rotationMin)
, rotationMax(p.rotationMax)
, spinStart(p.spinStart)
, spinEnd(p.spinEnd)
, spinVariation(p.spinVariation)
, offsetX(p.offsetX)
, offsetY(p.offsetY)
, colors(p.colors)
, quads(p.quads)
, relativeRotation(p.relativeRotation)
{
setBufferSize(maxParticles);
}