当前位置: 首页>>代码示例>>C++>>正文


C++ AudioStream::readBuffer方法代码示例

本文整理汇总了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;
	}
开发者ID:nuvie,项目名称:nuvie,代码行数:34,代码来源:rate_arm.cpp

示例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;
}
开发者ID:TC01,项目名称:xoreos,代码行数:28,代码来源:asf.cpp

示例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;
}
开发者ID:Termimad,项目名称:scummvm,代码行数:17,代码来源:audiostream.cpp

示例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;
}
开发者ID:Glyth,项目名称:xoreos,代码行数:23,代码来源:audiostream.cpp

示例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;
}
开发者ID:project-cabal,项目名称:cabal,代码行数:23,代码来源:audiostream.cpp

示例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;
}
开发者ID:DeejStar,项目名称:xoreos,代码行数:24,代码来源:asf.cpp


注:本文中的AudioStream::readBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。