本文整理汇总了C++中OutputBuffer::write方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputBuffer::write方法的具体用法?C++ OutputBuffer::write怎么用?C++ OutputBuffer::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputBuffer
的用法示例。
在下文中一共展示了OutputBuffer::write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
bool Variation::process(Ports<InputBuffer*>& inp, Ports<OutputBuffer*>& outp)
{
assert(inp.size()==1);
InputBuffer* in = inp[0].data;
if (!in->hasTokens(2)) return false;
assert(outp.size()==1);
OutputBuffer* out = outp[0].data;
if ((out->tokenno()==0) && (in->tokenno()!=-1))
in->prependZeros(1);
const int N = in->info().size;
double lastNorm = 0.0;
double nextNorm = Map<VectorXd>(in->token(0),N).norm();
while (in->hasTokens(2))
{
Map<VectorXd> last(in->token(0),N);
lastNorm = nextNorm;
Map<VectorXd> next(in->token(1),N);
nextNorm = next.norm();
if (lastNorm*nextNorm !=0)
lastNorm = 1 - last.dot(next) / (lastNorm * nextNorm);
else
lastNorm = 0.0;
out->write(&lastNorm,1);
in->consumeToken();
}
return true;
}
示例2: process
bool AudioFileReader::process(Ports<InputBuffer*>& inp, Ports<OutputBuffer*>& outp)
{
assert(inp.size()==0);
assert(outp.size()==1);
OutputBuffer* out = outp[0].data;
int nbRead = readFramesIntoBuffer();
if (nbRead==0)
return false;
if (m_rescale)
for (int i=0;i<nbRead;i++)
m_readBuffer[i] = (m_readBuffer[i] - m_mean) * m_factor;
out->write(m_readBuffer,nbRead);
return true;
}
示例3: write_cb
int OutputBuffer::write_cb(void *context, const char *buffer, int len)
{
OutputBuffer * p = reinterpret_cast<OutputBuffer*>(context);
return (p->write(reinterpret_cast<const uint8_t*>(buffer), static_cast<size_t>(len)) ? len : -1);
}