本文整理汇总了C++中Blip_Buffer::samples_avail方法的典型用法代码示例。如果您正苦于以下问题:C++ Blip_Buffer::samples_avail方法的具体用法?C++ Blip_Buffer::samples_avail怎么用?C++ Blip_Buffer::samples_avail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blip_Buffer
的用法示例。
在下文中一共展示了Blip_Buffer::samples_avail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_samples
// Read samples as unsigned 8-bit
long read_samples( Blip_Buffer& buf, unsigned char* out, long out_size )
{
// Limit number of samples read to those available
long count = buf.samples_avail();
if ( count > out_size )
count = out_size;
// Begin reading samples from Blip_Buffer
Blip_Reader reader;
int bass = reader.begin( buf );
for ( long n = count; n--; )
{
// Read 16-bit sample and convert to output format
long s = reader.read();
reader.next( bass );
if ( (short) s != s ) // clamp to 16 bits
s = 0x7fff - (s >> 24);
*out++ = (s >> 8) + 0x80;
}
// End reading and remove the samples
reader.end( buf );
buf.remove_samples( count );
return count;
}
示例2: make_nonlinear
long Nes_Nonlinearizer::make_nonlinear( Blip_Buffer& buf, long count )
{
require( apu );
long avail = buf.samples_avail();
if ( count > avail )
count = avail;
if ( count && enabled )
{
Blip_Buffer::buf_t_* p = buf.buffer_;
long accum = this->accum;
long prev = this->prev;
for ( unsigned n = count; n; --n )
{
long entry = ENTRY( accum );
check( (entry >= 0) == (accum >= 0) );
accum += *p;
*p++ = (entry - prev) << (blip_sample_bits - 16);
prev = entry;
}
this->prev = prev;
this->accum = accum;
}
return count;
}