本文整理汇总了C++中Breakpoint::amplitude方法的典型用法代码示例。如果您正苦于以下问题:C++ Breakpoint::amplitude方法的具体用法?C++ Breakpoint::amplitude怎么用?C++ Breakpoint::amplitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Breakpoint
的用法示例。
在下文中一共展示了Breakpoint::amplitude方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: accum_samples
// ---------------------------------------------------------------------------
// accum_samples
// ---------------------------------------------------------------------------
// helper
//
static void accum_samples( CSOUND * csound,
Oscillator & oscil, Breakpoint & bp,
double * bufbegin )
{
if( bp.amplitude() > 0 || oscil.amplitude() > 0 )
{
double radfreq = radianFreq( csound, bp.frequency() );
double amp = bp.amplitude();
double bw = bp.bandwidth();
// initialize the oscillator if it is changing from zero
// to non-zero amplitude in this control block:
if ( oscil.amplitude() == 0. )
{
// don't initialize with bogus values, Oscillator
// only guards against out-of-range target values
// in generateSamples(), parameter mutators are
// dangerous:
if ( radfreq > PI ) // don't alias
amp = 0.;
if ( bw > 1. ) // clamp bandwidth
bw = 1.;
else if ( bw < 0. )
bw = 0.;
#ifdef DEBUG_LORISGENS
/*
std::cerr << "initializing oscillator " << std::endl;
std::cerr << "parameters: " << bp.frequency() << " ";
std::cerr << amp << " " << bw << std::endl;
*/
#endif
// initialize frequency, amplitude, and bandwidth to
// their target values:
/*
oscil.setRadianFreq( radfreq );
oscil.setAmplitude( amp );
oscil.setBandwidth( bw );
*/
oscil.resetEnvelopes( bp, (double) csound->esr );
// roll back the phase:
oscil.resetPhase( bp.phase() - ( radfreq * (double) csound->ksmps ) );
}
// accumulate samples into buffer:
// oscil.generateSamples( bufbegin, bufbegin + nsamps, radfreq, amp, bw );
oscil.oscillate( bufbegin, bufbegin + csound->ksmps,
bp, (double) csound->esr );
}
}
示例2: if
// ---------------------------------------------------------------------------
// resetEnvelopes
// ---------------------------------------------------------------------------
// Reset the instantaneous envelope parameters
// (frequency, amplitude, bandwidth, and phase).
// The sample rate is needed to convert the
// Breakpoint frequency (Hz) to radians per sample.
//
void
Oscillator::resetEnvelopes( const Breakpoint & bp, double srate )
{
// Remember that the oscillator only knows about
// radian frequency! Convert!
i_frequency = bp.frequency() * TwoPi / srate;
i_amplitude = bp.amplitude();
i_bandwidth = bp.bandwidth();
determ_phase = bp.phase();
// clamp bandwidth:
if ( i_bandwidth > 1. )
{
debugger << "clamping bandwidth at 1." << endl;
i_bandwidth = 1.;
}
else if ( i_bandwidth < 0. )
{
debugger << "clamping bandwidth at 0." << endl;
i_bandwidth = 0.;
}
// don't alias:
if ( i_frequency > Pi )
{
debugger << "fading out aliasing Partial" << endl;
i_amplitude = 0.;
}
}
示例3: if
// ---------------------------------------------------------------------------
// resetEnvelopes
// ---------------------------------------------------------------------------
// Reset the instantaneous envelope parameters
// (frequency, amplitude, bandwidth, and phase).
// The Breakpoint frequency (Hz) is in radians per sample.
void
RealtimeOscillator::restoreEnvelopes( const Breakpoint & bp) noexcept
{
// Remember that the oscillator only knows about
// radian frequency! Convert!
m_instfrequency = bp.frequency();
m_instamplitude = bp.amplitude();
m_instbandwidth = bp.bandwidth();
m_determphase = bp.phase();
// clamp bandwidth:
if ( m_instbandwidth > 1. )
{
m_instbandwidth = 1.;
}
else if ( m_instbandwidth < 0. )
{
m_instbandwidth = 0.;
}
// don't alias:
if ( m_instfrequency > Pi )
{
m_instamplitude = 0.;
}
// Reset the fitler state too.
m_filter.clear();
}