本文整理汇总了C++中Signal::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ Signal::reset方法的具体用法?C++ Signal::reset怎么用?C++ Signal::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal::reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fetch
unsigned int FlacDecoder::fetch(Signal& outleft, Signal& outright)
{
outleft.reset();
outright.reset();
if (_opened)
{
unsigned int request_size=Signal::size;
while (request_size > _bufferl.size() - _bufferpos)
{
if (!FLAC__stream_decoder_process_single(_streamdecoder) ||
(FLAC__stream_decoder_get_state(_streamdecoder) != FLAC__STREAM_DECODER_READ_FRAME &&
FLAC__stream_decoder_get_state(_streamdecoder) != FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC &&
FLAC__stream_decoder_get_state(_streamdecoder) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA &&
FLAC__stream_decoder_get_state(_streamdecoder) != FLAC__STREAM_DECODER_READ_METADATA ))
{
break;
}
}
const unsigned int to_read=request_size >_bufferl.size() - _bufferpos ? _bufferl.size() - _bufferpos : request_size;
for (unsigned int i=0; i < to_read; i++)
{
outleft.samples[i]=_bufferl.at(_bufferpos);
outright.samples[i]=_bufferr.at(_bufferpos++);
}
if (to_read == 0)
{
_ended=true;
}
return to_read;
}
_ended=true;
return 0;
}
示例2: fetch
unsigned int BassDecoder::fetch(Signal& left, Signal& right){
if (_music)
{
DWORD readed=0;
#if defined(LIBTOOLS_WINDOWS) && !defined(BASS_H)
if (!BASS_ChannelGetData || ! BASS_ErrorGetCode) {
std::cerr << "Error missing BASS_ChannelGetData or BASS_ErrorGetCode functions" << std::endl;
return 0;
}
#endif
readed=BASS_ChannelGetData((DWORD)_music, (void*)_samplesForSignals, _bytesFrame);
if(readed==-1 && BASS_ErrorGetCode() == BASS_ERROR_ENDED) {
left.reset();
right.reset();
_ended=true;
return 0;
}
if (readed < _bytesFrame)
{
for (unsigned int i=readed; i< _bytesFrame ;i++)
((char*)_samplesForSignals)[i]=0;
}
const unsigned int signal_size=Signal::size;
if (_infos.chans>=2)
{
unsigned int k=0;
for (unsigned int i=0; i < signal_size;)
{
left.samples[i]=_samplesForSignals[k++];
right.samples[i++]=_samplesForSignals[k++];
k+=_infos.chans-2;
}
}
else if (_infos.chans==1) //mono
{
unsigned int k=0;
for (unsigned int i=0; i < signal_size;)
{
left.samples[i]=_samplesForSignals[k];
right.samples[i++]=_samplesForSignals[k++];
}
}
return readed/sizeof(sample);
}
return 0;
}
示例3: tfd
void Signal::tfd(Signal& out_tfd)
{
out_tfd.reset();
for (unsigned int k=0; k < Signal::size;k++)
{
for (unsigned int n=0; n < Signal::size;n++)
{
double a=2*3.14159*k*n/(double)(Signal::size);
double cos_a=cos(a);
double sin_a=sin(a);
out_tfd.samples[k] += (sample) (abs(samples[n])*(sqrt(abs(cos_a*cos_a+sin_a*sin_a))));
}
}
}