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


C++ Signal::size方法代码示例

本文整理汇总了C++中Signal::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Signal::size方法的具体用法?C++ Signal::size怎么用?C++ Signal::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Signal的用法示例。


在下文中一共展示了Signal::size方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

TEST(core_signal_test, empty_slot_is_not_same_as_no_slot) {
  Signal signal;

  signal.connect();
  ASSERT_EQ(1u, signal.size());

  signal.connect(Signal::Slot());
  ASSERT_EQ(2u, signal.size());
}
开发者ID:dawikur,项目名称:ioDirect,代码行数:9,代码来源:signal_test.cpp

示例2: decimatedSpectrum

Contour<float> DioF0Estimator::estimate(const Signal &signal, double msFramePeriod)
{
    int decimationRatio = qMax(1, qMin(12, (int)(signal.samplingFrequency() / decimatedFs)));
    int decimatedLength = 1 + signal.size() / decimationRatio;
    fft = new Fft(Fft::suitableLength(decimatedLength), Fft::Real);

    Spectrum decimatedSpectrum(createDecimatedSpectrum(signal, decimationRatio));

    Contour<float> result(estimate(decimatedSpectrum, signal.size(), signal.samplingFrequency(), msFramePeriod));

    delete fft;

    return result;
}
开发者ID:qtau-devgroup,项目名称:libstand,代码行数:14,代码来源:DioF0Estimator.cpp

示例3: bitsOut

// receiver: decode received bits.  Ns samples per bit.
Bits
BluetoothReceiver::receive(const Signal& input) {
    // Input length should be a multiple of Ns
    int nBits = input.size()/Ns;
    _ASSERTE((input.size()) % Ns == 0);
    Bits bitsOut(nBits);

    for (int i=0; i<nBits; ++i) {
        slice sl_i(i*Ns, Ns);
        bitsOut[i] = receiveBit(input[sl_i]);
    }

    return bitsOut;
}
开发者ID:usefulalgorithm,项目名称:final-project,代码行数:15,代码来源:bluetooth.cpp

示例4: revert

void Downsampler::revert(Signal& signal) const
{
    // Resize and set the sample rate on the signal
    int revertedSize = _fineStructure.size();
    signal.resize(revertedSize);
    signal.sampleRate = _fineStructure.sampleRate;

    // Move the values to their new positions and add the fine structure
    double sizeRatio = signal.size() / revertedSize;
    for(int i = revertedSize - 1; i >= 0; i--)
        signal[i] = signal[sizeRatio * i] + _fineStructure[i];
}
开发者ID:jettca,项目名称:TextureAnimation,代码行数:12,代码来源:Downsampler.cpp

示例5: signal

TEST(core_signal_test, executing_signal_actually_works_for_all_of_them) {
  Signal signal;
  int a = 0, b = 0;

  signal.connect([&a](int _i) { a = _i; });
  signal.connect([&b](int _i) { b = _i + 1; });

  signal(5);

  ASSERT_EQ(2u, signal.size());
  ASSERT_EQ(5, a);
  ASSERT_EQ(6, b);
}
开发者ID:dawikur,项目名称:ioDirect,代码行数:13,代码来源:signal_test.cpp

示例6: limiterDiscriminator

// receiveBit: decode one bit of received data
bool
BluetoothReceiver::receiveBit(const Signal& inputSlice) {
    // Check input: Ns samples per bit
    _ASSERTE(inputSlice.size() == Ns);
    double phase = 0.0; // Integrate over phase difference
    for (int i=0; i<Ns; ++i) {
        Sample bpOut   = bandpassFilter.FilterStep(inputSlice[i]);
        Sample diffOut = differentiatorFilter.FilterStep(bpOut);
        phase += limiterDiscriminator(bpOut, diffOut);
    }

    return (phase < 0.0);
}
开发者ID:usefulalgorithm,项目名称:final-project,代码行数:14,代码来源:bluetooth.cpp

示例7: inverse

TransformeeFourier::Signal TransformeeFourier::inverse(const Signal & signal){
	Signal returnRecompoTransfoFourier;
	double N = signal.size();
	returnRecompoTransfoFourier.resize((int)(N));
	
	for(double j = -N/2; j < N/2; j++){
		returnRecompoTransfoFourier[(j+(N/2))] = 0;
		for(double i = 0; i < N; i ++){	
			std::complex<double> c(0.0, ((j+(N/2)))*i*M_PI*2.0/N);
			returnRecompoTransfoFourier[(j+(N/2))] += signal[i] * exp(c);
		}	
	}
	return returnRecompoTransfoFourier;
}
开发者ID:Bergil,项目名称:MathImage_AnalyseFrequentielle,代码行数:14,代码来源:TransformeeFourier.cpp

示例8: fourier

void TransformeeFourier::fourier(const Signal & contour){
	
	Signal returnTransfoFourier;
	double N = contour.size();
	tabComplex.resize((int)(N)); 
	
	for(double j = -N/2; j < N/2; j++){
		tabComplex[(j+(N/2))] = 0;
		for(double i = 0; i < N; i ++){	
			std::complex<double> c(0.0, ((j+(N/2)))*i*M_PI*2.0/N);
			tabComplex[(j+(N/2))] += contour[i] * exp(-c);
		}
		tabComplex[(j+(N/2))] /= N;		
	}
	
}
开发者ID:Bergil,项目名称:MathImage_AnalyseFrequentielle,代码行数:16,代码来源:TransformeeFourier.cpp

示例9: Spectrum

DioF0Estimator::Spectrum DioF0Estimator::createDecimatedSpectrum(const Signal &signal, int decimationRatio)
{
    int decimatedLength = 1 + signal.size() / decimationRatio;
    int fftLength = fft->fftLength;
    double *decimatedWave = new double[fftLength];
    Decimator::decimate(signal, decimationRatio, decimatedWave, decimatedLength);
    double mean = 0.0;
    for(int i = 0; i < decimatedLength; i++)
    {
        mean += decimatedWave[i];
    }
    mean /= decimatedLength;
    for(int i = 0; i < decimatedLength; i++)
    {
        decimatedWave[i] -= mean;
    }
    for(int i = decimatedLength; i < fftLength; i++)
    {
        decimatedWave[i] = 0.0;
    }
    fft->execute(Fft::Forward, decimatedWave);
    return Spectrum(decimatedWave, decimatedLength, fftLength, (double)signal.samplingFrequency() / decimationRatio);
}
开发者ID:qtau-devgroup,项目名称:libstand,代码行数:23,代码来源:DioF0Estimator.cpp

示例10: filter

Downsampler::Downsampler(Signal& signal, double targetRate):
    _fineStructure(signal),
    _newSampleRate(signal.sampleRate /
        pow(2, (int)(log(signal.sampleRate / targetRate) / log(2))))
{
    int oldSize = signal.size();

    // Apply a lowpass filter to obtain the fine structure
    LowpassFilter filter(_newSampleRate / 2);
    filter.filter(signal);
    for(int i = 0; i < oldSize; i++)
        _fineStructure[i] -= signal[i];

    // Fill values into new positions
    int newSize = (int)(_newSampleRate / signal.sampleRate * oldSize);
    double sizeRatio = oldSize / newSize;
    for(int i = 0; i < newSize; i++)
        signal[i] = signal[(int)(sizeRatio * i)];

    // Set the new size and sample rate
    signal.resize(std::min(newSize, oldSize));
    signal.sampleRate = _newSampleRate;
}
开发者ID:jettca,项目名称:TextureAnimation,代码行数:23,代码来源:Downsampler.cpp


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