diff --git a/ChangeLog b/ChangeLog index bb19360fb..b2ce08d05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2007-04-25 Javier Serrano Polo + + * include/basic_filters.h: + * plugins/flp_import/flp_import.cpp: + * src/core/envelope_tab_widget.cpp: + simplified filtering + + * plugins/vst_base/lvsl_server.c: + clear output buffers before processing + + * plugins/vestige/vestige.cpp: + * plugins/vst_base/lvsl_client.cpp: + * plugins/vst_base/lvsl_client.h: + fixed sample rate change + + * data/locale/ca.ts: + updated translation + 2007-04-24 Javier Serrano Polo * include/buffer_allocator.h: diff --git a/configure.in b/configure.in index 967515220..20ba08801 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) -AC_INIT(lmms, 0.2.1-svn20070424, lmms-devel/at/lists/dot/sf/dot/net) -AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20070424) +AC_INIT(lmms, 0.2.1-svn20070425, lmms-devel/at/lists/dot/sf/dot/net) +AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20070425) AM_CONFIG_HEADER(config.h) diff --git a/data/locale/ca.qm b/data/locale/ca.qm index d1aee0395..fdc616c85 100644 Binary files a/data/locale/ca.qm and b/data/locale/ca.qm differ diff --git a/data/locale/ca.ts b/data/locale/ca.ts index 3beea0a7d..b35e49709 100644 --- a/data/locale/ca.ts +++ b/data/locale/ca.ts @@ -4236,11 +4236,11 @@ clic dret = apaga totes les altres pistes (solo) use frequency modulation for modulating oscillator 2 with oscillator 1 - usa modulació de freqüència per a modular l'oscil·lador 2 amb l'oscil·lador 1 + modula la freqüència de l'oscil·lador 1 amb l'oscil·lador 2 use amplitude modulation for modulating oscillator 2 with oscillator 1 - usa modulació d'amplitud per a modular l'oscil·lador 2 amb l'oscil·lador 1 + modula l'amplitud de l'oscil·lador 1 amb l'oscil·lador 2 mix output of oscillator 1 & 2 @@ -4252,11 +4252,11 @@ clic dret = apaga totes les altres pistes (solo) use frequency modulation for modulating oscillator 3 with oscillator 2 - usa modulació de freqüència per a modular l'oscil·lador 3 amb l'oscil·lador 2 + modula la freqüència de l'oscil·lador 2 amb l'oscil·lador 3 use amplitude modulation for modulating oscillator 3 with oscillator 2 - usa modulació d'amplitud per a modular l'oscil·lador 3 amb l'oscil·lador 2 + modula l'amplitud de l'oscil·lador 2 amb l'oscil·lador 3 mix output of oscillator 2 & 3 @@ -4356,11 +4356,11 @@ clic dret = apaga totes les altres pistes (solo) use phase modulation for modulating oscillator 2 with oscillator 1 - usa modulació de fase per a modular l'oscil·lador 2 amb l'oscil·lador 1 + modula la fase de l'oscil·lador 1 amb l'oscil·lador 2 use phase modulation for modulating oscillator 3 with oscillator 2 - usa modulació de fase per a modular l'oscil·lador 3 amb l'oscil·lador 2 + modula la fase de l'oscil·lador 2 amb l'oscil·lador 3 Modulation type 1 diff --git a/include/basic_filters.h b/include/basic_filters.h index 53bca10b9..1f4856446 100644 --- a/include/basic_filters.h +++ b/include/basic_filters.h @@ -46,7 +46,6 @@ template class basicFilters { public: - enum filterTypes { LOWPASS, @@ -56,9 +55,7 @@ public: NOTCH, ALLPASS, MOOG, - SIMPLE_FLT_CNT, - DOUBLE_LOWPASS = 16+LOWPASS, - DOUBLE_MOOG = 16+MOOG + SIMPLE_FLT_CNT } ; static inline float minQ( void ) @@ -66,14 +63,23 @@ public: return( 0.01f ); } - static inline filterTypes getFilterType( const int _idx ) + inline void setFilterType( const int _idx ) { - if( _idx < SIMPLE_FLT_CNT ) + m_double_filter = _idx >= SIMPLE_FLT_CNT; + if( !m_double_filter ) { - return( static_cast( _idx ) ); + m_type = static_cast( _idx ); + return; } - return( static_cast( DOUBLE_LOWPASS + _idx - - SIMPLE_FLT_CNT ) ); + m_type = static_cast( LOWPASS + _idx - + SIMPLE_FLT_CNT ); + if( m_subFilter == NULL ) + { + m_subFilter = new basicFilters( + static_cast( + m_sampleRate ) ); + } + m_subFilter->m_type = m_type; } inline basicFilters( const sample_rate_t _sample_rate ) : @@ -82,6 +88,7 @@ public: m_b2a0( 0.0f ), m_a1a0( 0.0f ), m_a2a0( 0.0f ), + m_double_filter( FALSE ), m_sampleRate( _sample_rate ), m_subFilter( NULL ) { @@ -109,27 +116,26 @@ public: switch( m_type ) { case MOOG: - case DOUBLE_MOOG: { sample_t x = _in0 - m_r*m_y4[_chnl]; // four cascaded onepole filters // (bilinear transform) m_y1[_chnl] = tLimit( - x*m_p + m_oldx[_chnl]*m_p - - m_k*m_y1[_chnl], + ( x + m_oldx[_chnl] ) * m_p + - m_k * m_y1[_chnl], -10.0f, 10.0f ); m_y2[_chnl] = tLimit( - m_y1[_chnl]*m_p+m_oldy1[_chnl]* - m_p - m_k*m_y2[_chnl], + ( m_y1[_chnl] + m_oldy1[_chnl] ) * m_p + - m_k * m_y2[_chnl], -10.0f, 10.0f ); m_y3[_chnl] = tLimit( - m_y2[_chnl]*m_p+m_oldy2[_chnl]* - m_p - m_k*m_y3[_chnl], + ( m_y2[_chnl] + m_oldy2[_chnl] ) * m_p + - m_k * m_y3[_chnl], -10.0f, 10.0f ); m_y4[_chnl] = tLimit( - m_y3[_chnl]*m_p+m_oldy3[_chnl]* - m_p - m_k*m_y4[_chnl], + ( m_y3[_chnl] + m_oldy3[_chnl] ) * m_p + - m_k * m_y4[_chnl], -10.0f, 10.0f ); m_oldx[_chnl] = x; @@ -222,7 +228,7 @@ public: break; } - if( m_subFilter != NULL ) + if( m_double_filter ) { return( m_subFilter->update( out, _chnl ) ); } @@ -232,12 +238,6 @@ public: } - void setType( const filterTypes _type ) - { - m_type = _type; - } - - inline void calcFilterCoeffs( float _freq, float _q /*, const bool _q_is_bandwidth = FALSE*/ ) { @@ -246,30 +246,22 @@ public: // bad noise out of the filter... _q = tMax( _q, minQ() ); - switch( m_type ) + if( m_type == MOOG ) { - case DOUBLE_MOOG: - { - if( m_subFilter == NULL ) - { - m_subFilter = - new basicFilters( - static_cast( m_sampleRate ) ); - m_subFilter->setType( MOOG ); - } - m_subFilter->calcFilterCoeffs( _freq, _q ); - } + // [ 0 - 0.5 ] + const float f = _freq / m_sampleRate; + // (Empirical tunning) + m_p = ( 3.6f - 3.2f * f ) * f; + m_k = 2.0f * m_p - 1; + m_r = _q * powf( M_E, ( 1 - m_p ) * 1.386249f ); - case MOOG: + if( m_double_filter ) { - // [ 0 - 1 ] - const float f = 2 * _freq / m_sampleRate; - // (Empirical tunning) - m_k = 3.6f * f - 1.6f * f * f - 1; - m_p = ( m_k + 1 ) * 0.5f; - m_r = _q * powf( M_E, ( 1 - m_p ) * 1.386249f ); - return; + m_subFilter->m_r = m_r; + m_subFilter->m_p = m_p; + m_subFilter->m_k = m_k; } + return; /* case DOUBLE_MOOG2: { @@ -297,9 +289,6 @@ public: m_r = 4 * _q * kacr; break; }*/ - - default: - break; } // other filters @@ -316,62 +305,53 @@ public: const float a0 = 1.0f / ( 1.0f + alpha ); + m_a1a0 = -2.0f * tcos * a0; + m_a2a0 = ( 1.0f - alpha ) * a0; + switch( m_type ) { case LOWPASS: - case DOUBLE_LOWPASS: - m_b0a0 = ( 1.0f - tcos ) * 0.5f * a0; m_b1a0 = ( 1.0f - tcos ) * a0; + m_b0a0 = m_b1a0 * 0.5f; m_b2a0 = m_b0a0;//((1.0f-tcos)/2.0f)*a0; - m_a1a0 = -2.0f * tcos * a0; - if( m_type == DOUBLE_LOWPASS ) - { - if( m_subFilter == NULL ) - { - m_subFilter = - new basicFilters( static_cast( - m_sampleRate ) ); - m_subFilter->setType( LOWPASS ); - } - m_subFilter->calcFilterCoeffs( _freq, - _q ); - } break; case HIPASS: - m_b0a0 = ( 1.0f + tcos ) * 0.5f * a0; m_b1a0 = ( -1.0f - tcos ) * a0; + m_b0a0 = m_b1a0 * -0.5f; m_b2a0 = m_b0a0;//((1.0f+tcos)/2.0f)*a0; - m_a1a0 = -2.0f * tcos * a0; break; case BANDPASS_CSG: - m_b0a0 = tsin * 0.5f * a0; m_b1a0 = 0.0f; - m_b2a0 = -tsin * 0.5f * a0; - m_a1a0 = -2.0f * tcos * a0; + m_b0a0 = tsin * 0.5f * a0; + m_b2a0 = -m_b0a0; break; case BANDPASS_CZPG: - m_b0a0 = alpha * a0; m_b1a0 = 0.0f; - m_b2a0 = -alpha * a0; - m_a1a0 = -2.0f * tcos * a0; + m_b0a0 = alpha * a0; + m_b2a0 = -m_b0a0; break; case NOTCH: + m_b1a0 = m_a1a0; m_b0a0 = a0; - m_b1a0 = -2.0f * tcos * a0; m_b2a0 = a0; - m_a1a0 = m_b1a0;//(-2.0f*tcos)*a0; break; case ALLPASS: - m_b0a0 = ( 1.0f - alpha ) * a0; - m_b1a0 = -2.0f * tcos * a0; + m_b1a0 = m_a1a0; + m_b0a0 = m_a2a0; m_b2a0 = 1.0f;//(1.0f+alpha)*a0; - m_a1a0 = m_b1a0;//(-2.0f*tcos)*a0; - //m_a2a0 = m_b0a0;//(1.0f-alpha)*a0; break; default: break; } - m_a2a0 = ( 1.0f - alpha ) * a0; + + if( m_double_filter ) + { + m_subFilter->m_b0a0 = m_b0a0; + m_subFilter->m_b1a0 = m_b1a0; + m_subFilter->m_b2a0 = m_b2a0; + m_subFilter->m_a1a0 = m_a1a0; + m_subFilter->m_a2a0 = m_a2a0; + } } @@ -391,9 +371,11 @@ private: frame m_y1, m_y2, m_y3, m_y4, m_oldx, m_oldy1, m_oldy2, m_oldy3; filterTypes m_type; + bool m_double_filter; float m_sampleRate; basicFilters * m_subFilter; + } ; diff --git a/plugins/flp_import/flp_import.cpp b/plugins/flp_import/flp_import.cpp index f0be546ea..b4791c59c 100644 --- a/plugins/flp_import/flp_import.cpp +++ b/plugins/flp_import/flp_import.cpp @@ -700,6 +700,8 @@ bool flpImport::tryImport( trackContainer * _tc ) case FLP_FilterParams: { + // TODO: Dirty hack! + // SIMPLE_FLT_CNT equals to old DOUBLE_LOWPASS const basicFilters<>::filterTypes mappedFilter[] = { @@ -708,9 +710,9 @@ bool flpImport::tryImport( trackContainer * _tc ) basicFilters<>::BANDPASS_CSG, basicFilters<>::HIPASS, basicFilters<>::NOTCH, - basicFilters<>::DOUBLE_LOWPASS, + basicFilters<>::SIMPLE_FLT_CNT, basicFilters<>::LOWPASS, - basicFilters<>::DOUBLE_LOWPASS + basicFilters<>::SIMPLE_FLT_CNT } ; Uint32 * p = (Uint32 *) text; envelopeTabWidget * etw = it->m_envWidget; diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index 7c107807d..964f78973 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -262,8 +262,10 @@ void vestigeInstrument::setParameter( const QString & _param, m_plugin->showEditor(); connect( engine::getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ), - m_plugin, SLOT( setTempo( bpm_t ) ) ); + m_plugin, SLOT( setTempo( bpm_t ) ) ); m_plugin->setTempo( engine::getSongEditor()->getTempo() ); + connect( engine::getMixer(), SIGNAL( sampleRateChanged() ), + m_plugin, SLOT( updateSampleRate() ) ); if( set_ch_name == TRUE ) { getInstrumentTrack()->setName( m_plugin->name() ); diff --git a/plugins/vst_base/lvsl_client.cpp b/plugins/vst_base/lvsl_client.cpp index cbc91462a..68accffcb 100644 --- a/plugins/vst_base/lvsl_client.cpp +++ b/plugins/vst_base/lvsl_client.cpp @@ -453,6 +453,17 @@ void remoteVSTPlugin::setTempo( bpm_t _bpm ) +void remoteVSTPlugin::updateSampleRate( void ) +{ + lock(); + writeValueS( VST_SAMPLE_RATE ); + writeValueS( engine::getMixer()->sampleRate() ); + unlock(); +} + + + + const QMap & remoteVSTPlugin::parameterDump( void ) { writeValueS( VST_GET_PARAMETER_DUMP ); diff --git a/plugins/vst_base/lvsl_client.h b/plugins/vst_base/lvsl_client.h index d3bda2581..d3c0f8f97 100644 --- a/plugins/vst_base/lvsl_client.h +++ b/plugins/vst_base/lvsl_client.h @@ -127,6 +127,7 @@ public: public slots: void setTempo( bpm_t _bpm ); + void updateSampleRate( void ); private: diff --git a/plugins/vst_base/lvsl_server.c b/plugins/vst_base/lvsl_server.c index 5693ce78d..ed0a9f587 100644 --- a/plugins/vst_base/lvsl_server.c +++ b/plugins/vst_base/lvsl_server.c @@ -1,7 +1,7 @@ /* * lvsl_server.cpp - LMMS VST Support Layer Server * - * Copyright (c) 2005-2006 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -466,6 +466,7 @@ void VSTPlugin::process( void ) for( ch_cnt_t i = 0; i < outputCount(); ++i ) { m_outputs[i] = &m_shm[( i + inputCount() ) * m_blockSize]; + memset( m_outputs[i], 0, m_blockSize * sizeof( float ) ); } #ifdef OLD_VST_SDK diff --git a/src/core/envelope_tab_widget.cpp b/src/core/envelope_tab_widget.cpp index 63afa3e1e..72051d119 100644 --- a/src/core/envelope_tab_widget.cpp +++ b/src/core/envelope_tab_widget.cpp @@ -280,8 +280,7 @@ void envelopeTabWidget::processAudioBuffer( sampleFrame * _ab, _n->m_filter = new basicFilters<>( engine::getMixer()->sampleRate() ); } - _n->m_filter->setType( basicFilters<>::getFilterType( - m_filterComboBox->value() ) ); + _n->m_filter->setFilterType( m_filterComboBox->value() ); float * cut_buf = NULL; float * res_buf = NULL;