本文整理汇总了C++中AudioStream::readBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioStream::readBuffer方法的具体用法?C++ AudioStream::readBuffer怎么用?C++ AudioStream::readBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioStream
的用法示例。
在下文中一共展示了AudioStream::readBuffer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flow
virtual int flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) {
assert(input.isStereo() == stereo);
#ifdef DEBUG_RATECONV
debug("Copy st=%d rev=%d", stereo, reverseStereo);
#endif
st_size_t len;
st_sample_t *ostart = obuf;
if (stereo)
osamp *= 2;
// Reallocate temp buffer, if necessary
if (osamp > _bufferSize) {
free(_buffer);
_buffer = (st_sample_t *)malloc(osamp * 2);
_bufferSize = osamp;
}
// Read up to 'osamp' samples into our temporary buffer
len = input.readBuffer(_buffer, osamp);
if (len <= 0)
return 0;
// Mix the data into the output buffer
if (stereo && reverseStereo)
obuf = ARM_CopyRate_R(len, obuf, vol_l, vol_r, _buffer);
else if (stereo)
obuf = ARM_CopyRate_S(len, obuf, vol_l, vol_r, _buffer);
else
obuf = ARM_CopyRate_M(len, obuf, vol_l, vol_r, _buffer);
return (obuf-ostart)/2;
}
示例2: readBuffer
size_t ASFStream::readBuffer(int16 *buffer, const size_t numSamples) {
size_t samplesDecoded = 0;
for (;;) {
if (_curAudioStream) {
const size_t n = _curAudioStream->readBuffer(buffer + samplesDecoded, numSamples - samplesDecoded);
if (n == kSizeInvalid)
return kSizeInvalid;
samplesDecoded += n;
if (_curAudioStream->endOfData()) {
delete _curAudioStream;
_curAudioStream = 0;
}
}
if (samplesDecoded == numSamples || endOfData())
break;
if (!_curAudioStream) {
_curAudioStream = createAudioStream();
}
}
return samplesDecoded;
}
示例3: readBuffer
int QueuingAudioStreamImpl::readBuffer(int16 *buffer, const int numSamples) {
Common::StackLock lock(_mutex);
int samplesDecoded = 0;
while (samplesDecoded < numSamples && !_queue.empty()) {
AudioStream *stream = _queue.front()._stream;
samplesDecoded += stream->readBuffer(buffer + samplesDecoded, numSamples - samplesDecoded);
if (stream->endOfData()) {
StreamHolder tmp = _queue.pop();
if (tmp._disposeAfterUse == DisposeAfterUse::YES)
delete stream;
}
}
return samplesDecoded;
}
示例4: readBuffer
size_t QueuingAudioStreamImpl::readBuffer(int16 *buffer, const size_t numSamples) {
Common::StackLock lock(_mutex);
size_t samplesDecoded = 0;
while (samplesDecoded < numSamples && !_queue.empty()) {
AudioStream *stream = _queue.front()._stream;
const size_t n = stream->readBuffer(buffer + samplesDecoded, numSamples - samplesDecoded);
if (n == kSizeInvalid)
return kSizeInvalid;
samplesDecoded += n;
if (stream->endOfData()) {
StreamHolder tmp = _queue.front();
_queue.pop();
if (tmp._disposeAfterUse)
delete stream;
}
}
return samplesDecoded;
}
示例5: readBuffer
int QueuingAudioStreamImpl::readBuffer(int16 *buffer, const int numSamples) {
Common::StackLock lock(_mutex);
int samplesDecoded = 0;
while (samplesDecoded < numSamples && !_queue.empty()) {
AudioStream *stream = _queue.front()._stream;
samplesDecoded += stream->readBuffer(buffer + samplesDecoded, numSamples - samplesDecoded);
// Done with the stream completely
if (stream->endOfStream()) {
StreamHolder tmp = _queue.pop();
if (tmp._disposeAfterUse == DisposeAfterUse::YES)
delete stream;
continue;
}
// Done with data but not the stream, bail out
if (stream->endOfData())
break;
}
return samplesDecoded;
}
示例6: readBuffer
int ASFStream::readBuffer(int16 *buffer, const int numSamples) {
int samplesDecoded = 0;
for (;;) {
if (_curAudioStream) {
samplesDecoded += _curAudioStream->readBuffer(buffer + samplesDecoded, numSamples - samplesDecoded);
if (_curAudioStream->endOfData()) {
delete _curAudioStream;
_curAudioStream = 0;
}
}
if (samplesDecoded == numSamples || endOfData())
break;
if (!_curAudioStream) {
_curAudioStream = createAudioStream();
}
}
return samplesDecoded;
}