Monstro: tweak the constants a bit

This commit is contained in:
Vesa
2014-04-06 22:14:54 +03:00
parent a21928fe39
commit 445a31e54a
2 changed files with 21 additions and 11 deletions

View File

@@ -98,8 +98,8 @@ MonstroSynth::MonstroSynth( MonstroInstrument * _i, NotePlayHandle * _nph,
m_r_last = 0.0f;
// constants for very simple antialias/bandlimiting by amp delta capping
m_adcap3 = ( 44100 * 0.3 ) / m_samplerate;
m_adcap4 = ( 44100 * 0.25 ) / m_samplerate;
m_adcap1 = ADCAP1 / m_samplerate;
m_adcap2 = ADCAP2 / m_samplerate;
}
@@ -404,8 +404,8 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
sample_t O2R = oscillate( o2w, o2r_p );
// do simple alias reduction filtering before volume is touched, by capping amplitude delta
O2L = qBound( m_osc2l_last - m_adcap3, O2L, m_osc2l_last + m_adcap3 );
O2R = qBound( m_osc2r_last - m_adcap3, O2R, m_osc2r_last + m_adcap3 );
O2L = qBound( m_osc2l_last - m_adcap1, O2L, m_osc2l_last + m_adcap1 );
O2R = qBound( m_osc2r_last - m_adcap1, O2R, m_osc2r_last + m_adcap1 );
m_osc2l_last = O2L;
m_osc2r_last = O2R;
@@ -469,8 +469,8 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
sample_t O3R = linearInterpolate( O3AR, O3BR, sub );
// do very simple bandlimit filtering by amp delta capping, before volume is touched
O3L = qBound( m_osc3l_last - m_adcap3, O3L, m_osc3l_last + m_adcap3 );
O3R = qBound( m_osc3r_last - m_adcap3, O3R, m_osc3r_last + m_adcap3 );
O3L = qBound( m_osc3l_last - m_adcap1, O3L, m_osc3l_last + m_adcap1 );
O3R = qBound( m_osc3r_last - m_adcap1, O3R, m_osc3r_last + m_adcap1 );
m_osc3l_last = O3L;
m_osc3r_last = O3R;
@@ -494,8 +494,8 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
sample_t L = O1L + O3L + ( omod == MOD_MIX ? O2L : 0.0f );
sample_t R = O1R + O3R + ( omod == MOD_MIX ? O2R : 0.0f );
L = qBound( m_l_last - m_adcap4, L, m_l_last + m_adcap4 );
R = qBound( m_r_last - m_adcap4, R, m_r_last + m_adcap4 );
L = qBound( m_l_last - m_adcap2, L, m_l_last + m_adcap2 );
R = qBound( m_r_last - m_adcap2, R, m_r_last + m_adcap2 );
_buf[f][0] = L;
_buf[f][1] = R;

View File

@@ -38,6 +38,9 @@
#include "Oscillator.h"
#include "lmms_math.h"
//
// UI Macros
//
#define makeknob( name, x, y, hint, unit, oname ) \
name = new knob( knobStyled, view ); \
@@ -85,7 +88,7 @@
name .addItem( tr( "Exponential wave" ), static_cast<PixmapLoader*>( new PluginPixmapLoader( "exp" ) ) ); \
name .addItem( tr( "Random" ), static_cast<PixmapLoader*>( new PluginPixmapLoader( "rand" ) ) );
// UI constants
const int O1ROW = 22;
const int O2ROW = 22 + 39;
const int O3ROW = 22 + 39 * 2;
@@ -127,6 +130,7 @@ const int MATROW6 = 22 + 39*5;
const int OPVIEW = 0;
const int MATVIEW = 1;
// waveform enumerators
const int WAVE_SINE = 0;
const int WAVE_TRI = 1;
const int WAVE_SAW = 2;
@@ -139,6 +143,7 @@ const int WAVE_EXP = 8;
const int WAVE_NOISE = 9;
const int NUM_WAVES = 10;
// modulation enumerators
const int MOD_MIX = 0;
const int MOD_AM = 1;
const int MOD_FM = 2;
@@ -150,6 +155,11 @@ const float MODCLIP = 2.0;
const float MIN_FREQ = 18.0f;
const float MAX_FREQ = 48000.0f;
// constants for amp delta capping - these will be divided by samplerate by the synth
const float ADCAP1 = 44100 / 4;
const float ADCAP2 = 44100 / 4.5;
class MonstroInstrument;
class MonstroView;
@@ -269,8 +279,8 @@ private:
sample_t m_l_last;
sample_t m_r_last;
float m_adcap3;
float m_adcap4;
float m_adcap1;
float m_adcap2;
};
class MonstroInstrument : public Instrument