Merge pull request #853 from diizy/monstro

Monstro updates
This commit is contained in:
Vesa V
2014-06-15 16:05:18 +03:00
2 changed files with 143 additions and 83 deletions

View File

@@ -89,7 +89,7 @@ MonstroSynth::MonstroSynth( MonstroInstrument * _i, NotePlayHandle * _nph,
m_lfo1_phase = 0.0f;
m_lfo2_phase = 0.0f;
m_lfo1_s = Oscillator::noiseSample( 0.0f );
m_lfo2_s = Oscillator::noiseSample( 0.0f );
@@ -103,15 +103,17 @@ MonstroSynth::MonstroSynth( MonstroInstrument * _i, NotePlayHandle * _nph,
m_invert2r = false;
m_invert3l = false;
m_invert3r = false;
m_integrator = 0.5f - ( 0.5f - INTEGRATOR ) * 44100.0f / m_samplerate;
m_counter2l = 0;
m_counter2r = 0;
m_counter3l = 0;
m_counter3r = 0;
m_counterMax = ( m_samplerate * 10 ) / 44100;
m_minfreq_pd = 1.0f / ( m_samplerate / MIN_FREQ );
m_fmCorrection = 44100.f / m_samplerate * FM_AMOUNT;
}
@@ -127,31 +129,34 @@ MonstroSynth::~MonstroSynth()
void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
{
float modtmp; // temp variable for freq modulation
// macros for modulating with env/lfos
#define modulatefreq( car, mod ) \
if( mod##_e1 != 0.0f ) car = qBound( MIN_FREQ, car * powf( 2.0f, m_env1_buf[f] * mod##_e1 * 2.0f ), MAX_FREQ ); \
if( mod##_e2 != 0.0f ) car = qBound( MIN_FREQ, car * powf( 2.0f, m_env2_buf[f] * mod##_e2 * 2.0f ), MAX_FREQ ); \
if( mod##_l1 != 0.0f ) car = qBound( MIN_FREQ, car * powf( 2.0f, m_lfo1_buf[f] * mod##_l1 ), MAX_FREQ ); \
if( mod##_l2 != 0.0f ) car = qBound( MIN_FREQ, car * powf( 2.0f, m_lfo2_buf[f] * mod##_l2 ), MAX_FREQ );
modtmp = 0.0f; \
if( mod##_e1 != 0.0f ) modtmp += m_env1_buf[f] * mod##_e1; \
if( mod##_e2 != 0.0f ) modtmp += m_env2_buf[f] * mod##_e2; \
if( mod##_l1 != 0.0f ) modtmp += m_lfo1_buf[f] * mod##_l1; \
if( mod##_l2 != 0.0f ) modtmp += m_lfo2_buf[f] * mod##_l2; \
car = qBound( MIN_FREQ, car * powf( 2.0f, modtmp ), MAX_FREQ );
#define modulateabs( car, mod ) \
if( mod##_e1 != 0.0f ) car = qBound( 0.0f, car + mod##_e1 * m_env1_buf[f], 1.0f ); \
if( mod##_e2 != 0.0f ) car = qBound( 0.0f, car + mod##_e2 * m_env2_buf[f], 1.0f ); \
if( mod##_l1 != 0.0f ) car = qBound( 0.0f, car + mod##_l1 * 0.5f * m_lfo1_buf[f], 1.0f ); \
if( mod##_l2 != 0.0f ) car = qBound( 0.0f, car + mod##_l2 * 0.5f * m_lfo2_buf[f], 1.0f );
if( mod##_e1 != 0.0f ) car += m_env1_buf[f] * mod##_e1; \
if( mod##_e2 != 0.0f ) car += m_env2_buf[f] * mod##_e2; \
if( mod##_l1 != 0.0f ) car += m_lfo1_buf[f] * mod##_l1; \
if( mod##_l2 != 0.0f ) car += m_lfo2_buf[f] * mod##_l2;
#define modulatephs( car, mod ) \
if( mod##_e1 != 0.0f ) car += qBound( -1.0f, ( mod##_e1 * m_env1_buf[f] ), 1.0f ); \
if( mod##_e2 != 0.0f ) car += qBound( -1.0f, ( mod##_e2 * m_env2_buf[f] ), 1.0f ); \
if( mod##_l1 != 0.0f ) car += ( mod##_l1 * 0.5f * m_lfo1_buf[f] ); \
if( mod##_l2 != 0.0f ) car += ( mod##_l2 * 0.5f * m_lfo2_buf[f] );
if( mod##_e1 != 0.0f ) car += m_env1_buf[f] * mod##_e1; \
if( mod##_e2 != 0.0f ) car += m_env2_buf[f] * mod##_e2; \
if( mod##_l1 != 0.0f ) car += m_lfo1_buf[f] * mod##_l1; \
if( mod##_l2 != 0.0f ) car += m_lfo2_buf[f] * mod##_l2;
#define modulatevol( car, mod ) \
if( mod##_e1 > 0.0f ) car = qBound( -MODCLIP, car * ( 1.0f - mod##_e1 + mod##_e1 * m_env1_buf[f] ), MODCLIP ); \
if( mod##_e1 < 0.0f ) car = qBound( -MODCLIP, car * ( 1.0f + mod##_e1 * m_env1_buf[f] ), MODCLIP ); \
if( mod##_e2 > 0.0f ) car = qBound( -MODCLIP, car * ( 1.0f - mod##_e2 + mod##_e2 * m_env2_buf[f] ), MODCLIP ); \
if( mod##_e2 < 0.0f ) car = qBound( -MODCLIP, car * ( 1.0f + mod##_e2 * m_env2_buf[f] ), MODCLIP ); \
if( mod##_l1 != 0.0f ) car = qBound( -MODCLIP, car * ( 1.0f + mod##_l1 * m_lfo1_buf[f] ), MODCLIP ); \
if( mod##_l1 != 0.0f ) car = qBound( -MODCLIP, car * ( 1.0f + mod##_l1 * m_lfo1_buf[f] ), MODCLIP ); \
if( mod##_l2 != 0.0f ) car = qBound( -MODCLIP, car * ( 1.0f + mod##_l2 * m_lfo2_buf[f] ), MODCLIP );
// pre-render env's and lfo's
@@ -162,32 +167,36 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
const float pw = ( m_parent->m_osc1Pw.value() / 100.0f );
const float o1pw_e1 = ( m_parent->m_pw1env1.value() );
const float o1pw_e2 = ( m_parent->m_pw1env2.value() );
const float o1pw_l1 = ( m_parent->m_pw1lfo1.value() );
const float o1pw_l2 = ( m_parent->m_pw1lfo2.value() );
const float o1pw_l1 = ( m_parent->m_pw1lfo1.value() * 0.5f );
const float o1pw_l2 = ( m_parent->m_pw1lfo2.value() * 0.5f );
const bool o1pw_mod = o1pw_e1 != 0.0f || o1pw_e2 != 0.0f || o1pw_l1 != 0.0f || o1pw_l2 != 0.0f;
// get phases
const float o1lpo = m_parent->m_osc1l_po;
const float o1rpo = m_parent->m_osc1r_po;
const float o1p_e1 = ( m_parent->m_phs1env1.value() );
const float o1p_e2 = ( m_parent->m_phs1env2.value() );
const float o1p_l1 = ( m_parent->m_phs1lfo1.value() );
const float o1p_l2 = ( m_parent->m_phs1lfo2.value() );
const float o1p_l1 = ( m_parent->m_phs1lfo1.value() * 0.5f );
const float o1p_l2 = ( m_parent->m_phs1lfo2.value() * 0.5f );
const bool o1p_mod = o1p_e1 != 0.0f || o1p_e2 != 0.0f || o1p_l1 != 0.0f || o1p_l2 != 0.0f;
// get pitch
const float o1lfb = ( m_parent->m_osc1l_freq * m_nph->frequency() );
const float o1rfb = ( m_parent->m_osc1r_freq * m_nph->frequency() );
const float o1f_e1 = ( m_parent->m_pit1env1.value() );
const float o1f_e2 = ( m_parent->m_pit1env2.value() );
const float o1f_e1 = ( m_parent->m_pit1env1.value() * 2.0f );
const float o1f_e2 = ( m_parent->m_pit1env2.value() * 2.0f );
const float o1f_l1 = ( m_parent->m_pit1lfo1.value() );
const float o1f_l2 = ( m_parent->m_pit1lfo2.value() );
const bool o1f_mod = o1f_e1 != 0.0f || o1f_e2 != 0.0f || o1f_l1 != 0.0f || o1f_l2 != 0.0f;
// get volumes
const float o1lv = m_parent->m_osc1l_vol;
const float o1rv = m_parent->m_osc1r_vol;
const float o1v_e1 = ( m_parent->m_vol1env1.value() );
const float o1v_e2 = ( m_parent->m_vol1env2.value() );
const float o1v_e1 = ( m_parent->m_vol1env1.value() * 2.0f );
const float o1v_e2 = ( m_parent->m_vol1env2.value() * 2.0f );
const float o1v_l1 = ( m_parent->m_vol1lfo1.value() );
const float o1v_l2 = ( m_parent->m_vol1lfo2.value() );
const bool o1v_mod = o1v_e1 != 0.0f || o1v_e2 != 0.0f || o1v_l1 != 0.0f || o1v_l2 != 0.0f;
// update osc2
// get waveform
@@ -198,25 +207,27 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
const float o2rpo = m_parent->m_osc2r_po;
const float o2p_e1 = ( m_parent->m_phs2env1.value() );
const float o2p_e2 = ( m_parent->m_phs2env2.value() );
const float o2p_l1 = ( m_parent->m_phs2lfo1.value() );
const float o2p_l2 = ( m_parent->m_phs2lfo2.value() );
const float o2p_l1 = ( m_parent->m_phs2lfo1.value() * 0.5f );
const float o2p_l2 = ( m_parent->m_phs2lfo2.value() * 0.5f );
const bool o2p_mod = o2p_e1 != 0.0f || o2p_e2 != 0.0f || o2p_l1 != 0.0f || o2p_l2 != 0.0f;
// get pitch
const float o2lfb = ( m_parent->m_osc2l_freq * m_nph->frequency() );
const float o2rfb = ( m_parent->m_osc2r_freq * m_nph->frequency() );
const float o2f_e1 = ( m_parent->m_pit2env1.value() );
const float o2f_e2 = ( m_parent->m_pit2env2.value() );
const float o2f_e1 = ( m_parent->m_pit2env1.value() * 2.0f );
const float o2f_e2 = ( m_parent->m_pit2env2.value() * 2.0f );
const float o2f_l1 = ( m_parent->m_pit2lfo1.value() );
const float o2f_l2 = ( m_parent->m_pit2lfo2.value() );
const bool o2f_mod = o2f_e1 != 0.0f || o2f_e2 != 0.0f || o2f_l1 != 0.0f || o2f_l2 != 0.0f;
// get volumes
const float o2lv = m_parent->m_osc2l_vol;
const float o2rv = m_parent->m_osc2r_vol;
const float o2v_e1 = ( m_parent->m_vol2env1.value() );
const float o2v_e2 = ( m_parent->m_vol2env2.value() );
const float o2v_l1 = ( m_parent->m_vol2lfo2.value() );
const float o2v_l1 = ( m_parent->m_vol2lfo1.value() );
const float o2v_l2 = ( m_parent->m_vol2lfo2.value() );
const bool o2v_mod = o2v_e1 != 0.0f || o2v_e2 != 0.0f || o2v_l1 != 0.0f || o2v_l2 != 0.0f;
// update osc3
@@ -229,8 +240,9 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
const float o3rpo = m_parent->m_osc3r_po;
const float o3p_e1 = ( m_parent->m_phs3env1.value() );
const float o3p_e2 = ( m_parent->m_phs3env2.value() );
const float o3p_l1 = ( m_parent->m_phs3lfo1.value() );
const float o3p_l2 = ( m_parent->m_phs3lfo2.value() );
const float o3p_l1 = ( m_parent->m_phs3lfo1.value() * 0.5f );
const float o3p_l2 = ( m_parent->m_phs3lfo2.value() * 0.5f );
const bool o3p_mod = o3p_e1 != 0.0f || o3p_e2 != 0.0f || o3p_l1 != 0.0f || o3p_l2 != 0.0f;
// get pitch modulators
const float o3fb = ( m_parent->m_osc3_freq * m_nph->frequency() );
@@ -238,6 +250,7 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
const float o3f_e2 = ( m_parent->m_pit3env2.value() );
const float o3f_l1 = ( m_parent->m_pit3lfo1.value() );
const float o3f_l2 = ( m_parent->m_pit3lfo2.value() );
const bool o3f_mod = o3f_e1 != 0.0f || o3f_e2 != 0.0f || o3f_l1 != 0.0f || o3f_l2 != 0.0f;
// get volumes
const float o3lv = m_parent->m_osc3l_vol;
@@ -246,13 +259,15 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
const float o3v_e2 = ( m_parent->m_vol3env2.value() );
const float o3v_l1 = ( m_parent->m_vol3lfo1.value() );
const float o3v_l2 = ( m_parent->m_vol3lfo2.value() );
const bool o3v_mod = o3v_e1 != 0.0f || o3v_e2 != 0.0f || o3v_l1 != 0.0f || o3v_l2 != 0.0f;
// get sub
const float o3sub = ( m_parent->m_osc3Sub.value() + 100.0f ) / 200.0f;
const float o3s_e1 = ( m_parent->m_sub3env1.value() );
const float o3s_e2 = ( m_parent->m_sub3env2.value() );
const float o3s_l1 = ( m_parent->m_sub3lfo1.value() );
const float o3s_l2 = ( m_parent->m_sub3lfo2.value() );
const float o3s_l1 = ( m_parent->m_sub3lfo1.value() * 0.5f );
const float o3s_l2 = ( m_parent->m_sub3lfo2.value() * 0.5f );
const bool o3s_mod = o3s_e1 != 0.0f || o3s_e2 != 0.0f || o3s_l1 != 0.0f || o3s_l2 != 0.0f;
//o2-o3 modulation
@@ -284,12 +299,12 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
float pd_r;
float len_l;
float len_r;
// osc1 vars
float o1l_f;
float o1r_f;
float o1l_p = m_osc1l_phase + o1lpo; // we add phase offset here so we don't have to do it every frame
float o1r_p = m_osc1r_phase + o1rpo; // then substract it again after loop...
float o1r_p = m_osc1r_phase + o1rpo; // then substract it again after loop...
float o1_pw;
// osc2 vars
@@ -327,18 +342,27 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
// calc and mod frequencies
o1l_f = o1lfb;
o1r_f = o1rfb;
modulatefreq( o1l_f, o1f )
modulatefreq( o1r_f, o1f )
if( o1f_mod )
{
modulatefreq( o1l_f, o1f )
modulatefreq( o1r_f, o1f )
}
// calc and modulate pulse
o1_pw = pw;
modulateabs( o1_pw, o1pw )
if( o1pw_mod )
{
modulateabs( o1_pw, o1pw )
o1_pw = qBound( PW_MIN, o1_pw, PW_MAX );
}
// calc and modulate phase
leftph = o1l_p;
rightph = o1r_p;
modulatephs( leftph, o1p )
modulatephs( rightph, o1p )
rightph = o1r_p;
if( o1p_mod )
{
modulatephs( leftph, o1p )
modulatephs( rightph, o1p )
}
// pulse wave osc
sample_t O1L = ( absFraction( leftph ) < o1_pw ) ? 1.0f : -1.0f;
@@ -395,7 +419,7 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
{
if( O1L < m_osc1l_last ) { m_invert3l = !m_invert3l; m_counter3l = m_counterMax; }
if( O1R < m_osc1r_last ) { m_invert3r = !m_invert3r; m_counter3r = m_counterMax; }
}
}
}
// update last before signal is touched
@@ -412,8 +436,11 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
// modulate volume
O1L *= o1lv;
O1R *= o1rv;
modulatevol( O1L, o1v )
modulatevol( O1R, o1v )
if( o1v_mod )
{
modulatevol( O1L, o1v )
modulatevol( O1R, o1v )
}
// update osc1 phase working variable
o1l_p += 1.0f / ( static_cast<float>( m_samplerate ) / o1l_f );
@@ -428,14 +455,20 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
// calc and mod frequencies
o2l_f = o2lfb;
o2r_f = o2rfb;
modulatefreq( o2l_f, o2f )
modulatefreq( o2r_f, o2f )
if( o2f_mod )
{
modulatefreq( o2l_f, o2f )
modulatefreq( o2r_f, o2f )
}
// calc and modulate phase
leftph = o2l_p;
rightph = o2r_p;
modulatephs( leftph, o2p )
modulatephs( rightph, o2p )
rightph = o2r_p;
if( o2p_mod )
{
modulatephs( leftph, o2p )
modulatephs( rightph, o2p )
}
leftph = absFraction( leftph );
rightph = absFraction( rightph );
@@ -456,8 +489,11 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
// modulate volume
O2L *= o2lv;
O2R *= o2rv;
modulatevol( O2L, o2v )
modulatevol( O2R, o2v )
if( o2v_mod )
{
modulatevol( O2L, o2v )
modulatevol( O2R, o2v )
}
// reverse sync - invert waveforms when needed
if( m_invert2l ) O2L *= -1.0;
@@ -478,26 +514,25 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
// calc and mod frequencies
o3l_f = o3fb;
o3r_f = o3fb;
modulatefreq( o3l_f, o3f )
modulatefreq( o3r_f, o3f )
// o2 modulation?
if( omod == MOD_FM )
if( o3f_mod )
{
o3l_f = qBound( MIN_FREQ, o3l_f * powf( 2.0f, O2L ), MAX_FREQ );
o3r_f = qBound( MIN_FREQ, o3r_f * powf( 2.0f, O2R ), MAX_FREQ );
modulatefreq( o3l_f, o3f )
modulatefreq( o3r_f, o3f )
}
// calc and modulate phase
leftph = o3l_p;
rightph = o3r_p;
modulatephs( leftph, o3p )
modulatephs( rightph, o3p )
rightph = o3r_p;
if( o3p_mod )
{
modulatephs( leftph, o3p )
modulatephs( rightph, o3p )
}
// o2 modulation?
if( omod == MOD_PM )
{
leftph += O2L/2;
rightph += O2R/2;
leftph += O2L * 0.5f;
rightph += O2R * 0.5f;
}
leftph = absFraction( leftph );
rightph = absFraction( rightph );
@@ -523,7 +558,11 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
// calc and modulate sub
sub = o3sub;
modulateabs( sub, o3s )
if( o3s_mod )
{
modulateabs( sub, o3s )
sub = qBound( 0.0f, sub, 1.0f );
}
sample_t O3L = linearInterpolate( O3AL, O3BL, sub );
sample_t O3R = linearInterpolate( O3AR, O3BR, sub );
@@ -531,8 +570,11 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
// modulate volume
O3L *= o3lv;
O3R *= o3rv;
modulatevol( O3L, o3v )
modulatevol( O3R, o3v )
if( o3v_mod )
{
modulatevol( O3L, o3v )
modulatevol( O3R, o3v )
}
// o2 modulation?
if( omod == MOD_AM )
{
@@ -547,8 +589,16 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
// update osc3 phases
m_ph3l_last = leftph;
m_ph3r_last = rightph;
o3l_p += 1.0f / ( static_cast<float>( m_samplerate ) / o3l_f );
o3r_p += 1.0f / ( static_cast<float>( m_samplerate ) / o3r_f );
len_l = 1.0f / ( static_cast<float>( m_samplerate ) / o3l_f );
len_r = 1.0f / ( static_cast<float>( m_samplerate ) / o3r_f );
// handle FM as PM
if( omod == MOD_FM )
{
len_l += O2L * m_fmCorrection;
len_r += O2R * m_fmCorrection;
}
o3l_p += len_l;
o3r_p += len_r;
// integrator - very simple filter
sample_t L = O1L + O3L + ( omod == MOD_MIX ? O2L : 0.0f );
@@ -560,7 +610,7 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
m_l_last = L;
m_r_last = R;
}
// update phases
m_osc1l_phase = absFraction( o1l_p - o1lpo );
m_osc1r_phase = absFraction( o1r_p - o1rpo );
@@ -568,7 +618,7 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
m_osc2r_phase = absFraction( o2r_p - o2rpo );
m_osc3l_phase = absFraction( o3l_p - o3lpo );
m_osc3r_phase = absFraction( o3r_p - o3rpo );
}
@@ -712,7 +762,7 @@ void MonstroSynth::renderModulators( fpp_t _frames )
const f_cnt_t tm = t % static_cast<int>( lfo1_r );
const float p = static_cast<float>( tm ) / lfo1_r;
if( tm == 0 )
{
{
m_lfo1_last = m_lfo1_s;
m_lfo1_s = Oscillator::noiseSample( 0.0f );
}
@@ -845,7 +895,7 @@ void MonstroSynth::renderModulators( fpp_t _frames )
const f_cnt_t tm = t % static_cast<int>( lfo2_r );
const float p = static_cast<float>( tm ) / lfo2_r;
if( tm == 0 )
{
{
m_lfo2_last = m_lfo2_s;
m_lfo2_s = Oscillator::noiseSample( 0.0f );
}
@@ -998,7 +1048,7 @@ MonstroInstrument::MonstroInstrument( InstrumentTrack * _instrument_track ) :
m_osc1Ftl( 0.0, -100.0, 100.0, 1.0, this, tr( "Osc 1 Fine detune left" ) ),
m_osc1Ftr( 0.0, -100.0, 100.0, 1.0, this, tr( "Osc 1 Fine detune right" ) ),
m_osc1Spo( 0.0, -180.0, 180.0, 0.1, this, tr( "Osc 1 Stereo phase offset" ) ),
m_osc1Pw( 50.0, 0.0, 100.0, 0.01, this, tr( "Osc 1 Pulse width" ) ),
m_osc1Pw( 50.0, PW_MIN, PW_MAX, 0.01, this, tr( "Osc 1 Pulse width" ) ),
m_osc1SSR( false, this, tr( "Osc 1 Sync send on rise" ) ),
m_osc1SSF( false, this, tr( "Osc 1 Sync send on fall" ) ),
@@ -1161,7 +1211,7 @@ MonstroInstrument::MonstroInstrument( InstrumentTrack * _instrument_track ) :
connect( &m_env2Dec, SIGNAL( dataChanged() ), this, SLOT( updateEnvelope2() ) );
connect( &m_env2Rel, SIGNAL( dataChanged() ), this, SLOT( updateEnvelope2() ) );
connect( &m_env2Slope, SIGNAL( dataChanged() ), this, SLOT( updateSlope2() ) );
// updateLFOAtts
connect( &m_lfo1Att, SIGNAL( dataChanged() ), this, SLOT( updateLFOAtts() ) );
@@ -1183,6 +1233,8 @@ MonstroInstrument::MonstroInstrument( InstrumentTrack * _instrument_track ) :
updatePO1();
updatePO2();
updatePO3();
updateSlope1();
updateSlope2();
}
@@ -1206,7 +1258,7 @@ void MonstroInstrument::playNote( NotePlayHandle * _n,
ms->renderOutput( frames, _working_buffer );
applyRelease( _working_buffer, _n );
//applyRelease( _working_buffer, _n ); // we have our own release
instrumentTrack()->processAudioBuffer( _working_buffer, frames, _n );
}
@@ -1461,7 +1513,7 @@ QString MonstroInstrument::nodeName() const
f_cnt_t MonstroInstrument::desiredReleaseFrames() const
{
return 64;
return qMax( 64, qMax( m_env1_relF, m_env2_relF ) );
}
@@ -1590,14 +1642,14 @@ void MonstroInstrument::updateSamplerate()
void MonstroInstrument::updateSlope1()
{
const float slope = m_env1Slope.value();
m_slope1 = powf( 10.0f, slope * -1.0f );
m_slope1 = powf( 10.0f, slope * -1.0f );
}
void MonstroInstrument::updateSlope2()
{
const float slope = m_env2Slope.value();
m_slope2 = powf( 10.0f, slope * -1.0f );
m_slope2 = powf( 10.0f, slope * -1.0f );
}
@@ -1842,7 +1894,7 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent )
maketinyled( m_osc3SyncHButton, 212, O3ROW - 3, "Hard sync oscillator 3" )
maketinyled( m_osc3SyncRButton, 191, O3ROW - 3, "Reverse sync oscillator 3" )
m_lfo1WaveBox = new comboBox( view );
m_lfo1WaveBox -> setGeometry( 2, LFOROW + 7, 42, 22 );
m_lfo1WaveBox->setFont( pointSize<8>( m_lfo1WaveBox->font() ) );

View File

@@ -178,6 +178,11 @@ const float MAX_FREQ = 48000.0f;
const float INTEGRATOR = 3.0f / 7.0f;
const float FM_AMOUNT = 0.25f;
const float PW_MIN = 0.25f;
const float PW_MAX = 100.0f - PW_MIN;
class MonstroInstrument;
class MonstroView;
@@ -338,6 +343,9 @@ private:
int m_counter3l;
int m_counter3r;
int m_counterMax;
float m_minfreq_pd;
float m_fmCorrection;
};
class MonstroInstrument : public Instrument