Skip to content

Commit b7c0997

Browse files
committed
MSVC: Fix Monstro instrument
1 parent 57c85f4 commit b7c0997

3 files changed

Lines changed: 28 additions & 24 deletions

File tree

plugins/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ ENDIF("${PLUGIN_LIST}" STREQUAL "")
9191
IF(MSVC)
9292
SET(MSVC_INCOMPATIBLE_PLUGINS
9393
LadspaEffect
94-
monstro
9594
sid
9695
#VstEffect
9796
Xpressive

plugins/monstro/Monstro.cpp

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ MonstroSynth::MonstroSynth( MonstroInstrument * _i, NotePlayHandle * _nph ) :
100100
m_counter2r = 0;
101101
m_counter3l = 0;
102102
m_counter3r = 0;
103+
104+
m_lfo[0].resize( m_parent->m_fpp );
105+
m_lfo[1].resize( m_parent->m_fpp );
106+
m_env[0].resize( m_parent->m_fpp );
107+
m_env[1].resize( m_parent->m_fpp );
103108
}
104109

105110

@@ -114,31 +119,31 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
114119
// macros for modulating with env/lfos
115120
#define modulatefreq( car, mod ) \
116121
modtmp = 0.0f; \
117-
if( mod##_e1 != 0.0f ) modtmp += env[0][f] * mod##_e1; \
118-
if( mod##_e2 != 0.0f ) modtmp += env[1][f] * mod##_e2; \
119-
if( mod##_l1 != 0.0f ) modtmp += lfo[0][f] * mod##_l1; \
120-
if( mod##_l2 != 0.0f ) modtmp += lfo[1][f] * mod##_l2; \
122+
if( mod##_e1 != 0.0f ) modtmp += m_env[0][f] * mod##_e1; \
123+
if( mod##_e2 != 0.0f ) modtmp += m_env[1][f] * mod##_e2; \
124+
if( mod##_l1 != 0.0f ) modtmp += m_lfo[0][f] * mod##_l1; \
125+
if( mod##_l2 != 0.0f ) modtmp += m_lfo[1][f] * mod##_l2; \
121126
car = qBound( MIN_FREQ, car * powf( 2.0f, modtmp ), MAX_FREQ );
122127

123128
#define modulateabs( car, mod ) \
124-
if( mod##_e1 != 0.0f ) car += env[0][f] * mod##_e1; \
125-
if( mod##_e2 != 0.0f ) car += env[1][f] * mod##_e2; \
126-
if( mod##_l1 != 0.0f ) car += lfo[0][f] * mod##_l1; \
127-
if( mod##_l2 != 0.0f ) car += lfo[1][f] * mod##_l2;
129+
if( mod##_e1 != 0.0f ) car += m_env[0][f] * mod##_e1; \
130+
if( mod##_e2 != 0.0f ) car += m_env[1][f] * mod##_e2; \
131+
if( mod##_l1 != 0.0f ) car += m_lfo[0][f] * mod##_l1; \
132+
if( mod##_l2 != 0.0f ) car += m_lfo[1][f] * mod##_l2;
128133

129134
#define modulatephs( car, mod ) \
130-
if( mod##_e1 != 0.0f ) car += env[0][f] * mod##_e1; \
131-
if( mod##_e2 != 0.0f ) car += env[1][f] * mod##_e2; \
132-
if( mod##_l1 != 0.0f ) car += lfo[0][f] * mod##_l1; \
133-
if( mod##_l2 != 0.0f ) car += lfo[1][f] * mod##_l2;
135+
if( mod##_e1 != 0.0f ) car += m_env[0][f] * mod##_e1; \
136+
if( mod##_e2 != 0.0f ) car += m_env[1][f] * mod##_e2; \
137+
if( mod##_l1 != 0.0f ) car += m_lfo[0][f] * mod##_l1; \
138+
if( mod##_l2 != 0.0f ) car += m_lfo[1][f] * mod##_l2;
134139

135140
#define modulatevol( car, mod ) \
136-
if( mod##_e1 > 0.0f ) car *= ( 1.0f - mod##_e1 + mod##_e1 * env[0][f] ); \
137-
if( mod##_e1 < 0.0f ) car *= ( 1.0f + mod##_e1 * env[0][f] ); \
138-
if( mod##_e2 > 0.0f ) car *= ( 1.0f - mod##_e2 + mod##_e2 * env[1][f] ); \
139-
if( mod##_e2 < 0.0f ) car *= ( 1.0f + mod##_e2 * env[1][f] ); \
140-
if( mod##_l1 != 0.0f ) car *= ( 1.0f + mod##_l1 * lfo[0][f] ); \
141-
if( mod##_l2 != 0.0f ) car *= ( 1.0f + mod##_l2 * lfo[1][f] ); \
141+
if( mod##_e1 > 0.0f ) car *= ( 1.0f - mod##_e1 + mod##_e1 * m_env[0][f] ); \
142+
if( mod##_e1 < 0.0f ) car *= ( 1.0f + mod##_e1 * m_env[0][f] ); \
143+
if( mod##_e2 > 0.0f ) car *= ( 1.0f - mod##_e2 + mod##_e2 * m_env[1][f] ); \
144+
if( mod##_e2 < 0.0f ) car *= ( 1.0f + mod##_e2 * m_env[1][f] ); \
145+
if( mod##_l1 != 0.0f ) car *= ( 1.0f + mod##_l1 * m_lfo[0][f] ); \
146+
if( mod##_l2 != 0.0f ) car *= ( 1.0f + mod##_l2 * m_lfo[1][f] ); \
142147
car = qBound( -MODCLIP, car, MODCLIP );
143148

144149

@@ -340,12 +345,8 @@ void MonstroSynth::renderOutput( fpp_t _frames, sampleFrame * _buf )
340345
float o3r_p = m_osc3r_phase + o3rpo;
341346
float sub;
342347

343-
// modulators
344-
float lfo[2][ m_parent->m_fpp ];
345-
float env[2][ m_parent->m_fpp ];
346-
347348
// render modulators: envelopes, lfos
348-
updateModulators( &env[0][0], &env[1][0], &lfo[0][0], &lfo[1][0], _frames );
349+
updateModulators( m_env[0].data(), m_env[1].data(), m_lfo[0].data(), m_lfo[1].data(), _frames );
349350

350351
// begin for loop
351352
for( f_cnt_t f = 0; f < _frames; ++f )

plugins/monstro/Monstro.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#ifndef MONSTRO_H
2727
#define MONSTRO_H
2828

29+
#include <vector>
2930

3031
#include "Instrument.h"
3132
#include "InstrumentView.h"
@@ -299,6 +300,9 @@ class MonstroSynth
299300
int m_counter2r;
300301
int m_counter3l;
301302
int m_counter3r;
303+
304+
std::vector<float> m_lfo[2];
305+
std::vector<float> m_env[2];
302306
};
303307

304308
class MonstroInstrument : public Instrument

0 commit comments

Comments
 (0)