From 6c50693d70d37ad09ec6fa189b8891852b003af5 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 16 Mar 2008 14:13:12 +0000 Subject: [PATCH] removed obsolete and broken auto-limit-feature git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@798 0778d3d1-df1d-0410-868b-ea421aaaa00d --- data/themes/default/auto_limit.png | Bin 1034 -> 0 bytes include/mixer.h | 17 ++-- src/core/mixer.cpp | 146 +++-------------------------- src/core/song_editor.cpp | 11 --- 4 files changed, 20 insertions(+), 154 deletions(-) delete mode 100644 data/themes/default/auto_limit.png diff --git a/data/themes/default/auto_limit.png b/data/themes/default/auto_limit.png deleted file mode 100644 index 0cb62760155a33b04b07a9a461b3a7279758b114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1034 zcmV+l1oiugP)8aJfcMYI3_1D8oe zK~zY`)sbjF;hfh zq4vY)Kid6qBE9F!jIKI*b^>?}cnAnC7lQm=%NyDH$`1gR726$-RaLxre|5CDyfTCp zT^sg87V^U-Rt$(dahTY~2LOuIY+PUnFu({1L;!$NpaO{cpu85yOD(OYsrgZclm!q~ z_MpTN2;pB;Y2oLf*-vr?$lm2f06MRN`lpWa{LU(xA1nc=Rd#%fMpG6RAfa-@=1|e5 z`ljOM)>dHk5|I#j6^N1=_Ov}tu-Kx$#GrQj!Tnpdw>5-90b|1|lj$(5iIo|4-QH-* zcBf|Podz;Zoj>x|rL&BlI8rzV5AS=Imd14$K@-D(XP-Op^nn+i+_81rCLw|b(g4?l zL$AJG+1|2uz26JD$gan5M#t|i@qYu_TN?=n4TP_;>)fT&Sx14^|NN7bFg`XWPrmug z5nvK@JZJ%9P7MBJb4?H^|<-n@eh8wF%?&ihvUJF3%72=TW`GF4J7Gfo4?+3* z762B?3ZeofV1>X6E m_audioPorts; fpp_t m_framesPerPeriod; @@ -359,11 +358,9 @@ private: Uint8 m_analBuffer; Uint8 m_poolDepth; - bool m_scaleClip; surroundSampleFrame m_maxClip; surroundSampleFrame m_previousSample; fpp_t m_halfStart[SURROUND_CHANNELS]; - bool m_clipped[SURROUND_CHANNELS]; bool m_oldBuffer[SURROUND_CHANNELS]; bool m_newBuffer[SURROUND_CHANNELS]; diff --git a/src/core/mixer.cpp b/src/core/mixer.cpp index b98a4fb82..b324bcdd8 100644 --- a/src/core/mixer.cpp +++ b/src/core/mixer.cpp @@ -175,9 +175,8 @@ private: bool me = a->processEffects(); if( a->m_bufferUsage != audioPort::NoUsage || me ) { - m_mixer->processBuffer( - a->firstBuffer(), - a->nextFxChannel() ); + engine::getFxMixer()->mixToChannel( a->firstBuffer(), + a->nextFxChannel() ); a->nextPeriod(); } } @@ -260,7 +259,10 @@ mixer::mixer( void ) : } } - setClipScaling( FALSE ); + m_poolDepth = 2; + m_readBuffer = 0; + m_writeBuffer = 1; + m_analBuffer = 1; } @@ -329,49 +331,6 @@ bool mixer::criticalXRuns( void ) const -void mixer::setClipScaling( bool _state ) -{ - lock(); - - m_scaleClip = _state; - - if( _state ) - { - m_poolDepth = 3; - m_readBuffer = 0; - m_analBuffer = m_readBuffer + 1; - m_writeBuffer = m_poolDepth - 1; - - for( ch_cnt_t chnl=0; chnl < m_audioDev->channels(); ++chnl ) - { - m_clipped[chnl] = FALSE; - m_halfStart[chnl] = m_framesPerPeriod; - m_maxClip[chnl] = 1.0f; - m_previousSample[chnl] = 0.0; - m_newBuffer[chnl] = FALSE; - } - // FIXME: why assign buffer-ptr to m_readBuf just for calling - // another method? - // clearAudioBuffer(m_bufferPool[i],...) would do as well - for( Uint8 i = 0; i < 3; i++ ) - { - m_readBuf = m_bufferPool[i]; - clearAudioBuffer( m_readBuf, m_framesPerPeriod ); - } - } - else - { - m_poolDepth = 2; - m_readBuffer = 0; - m_writeBuffer = 1; - m_analBuffer = 1; - } - - unlock(); -} - - - #define FILL_JOB_QUEUE(_jq,_vec_type,_vec,_job_type,_condition) \ int id = 0; \ for( _vec_type::iterator it = _vec.begin(); \ @@ -594,15 +553,18 @@ if( COND_NPH ) else { bool more_effects = FALSE; - for( QVector::iterator it = m_audioPorts.begin(); + for( QVector::iterator it = + m_audioPorts.begin(); it != m_audioPorts.end(); ++it ) { more_effects = ( *it )->processEffects(); - if( ( *it )->m_bufferUsage != audioPort::NoUsage || + if( ( *it )->m_bufferUsage != + audioPort::NoUsage || more_effects ) { - processBuffer( ( *it )->firstBuffer(), - ( *it )->nextFxChannel() ); + engine::getFxMixer()->mixToChannel( + ( *it )->firstBuffer(), + ( *it )->nextFxChannel() ); ( *it )->nextPeriod(); } } @@ -1005,88 +967,6 @@ midiClient * mixer::tryMIDIClients( void ) -void mixer::processBuffer( const surroundSampleFrame * _buf, fx_ch_t _fx_chnl ) -{ - // TODO: process according effect-channel - -/* if( m_scaleClip ) - { - for( ch_cnt_t chnl=0; - chnl < m_audioDev->channels(); - ++chnl ) - { - m_newBuffer[chnl] = TRUE; - } - }*/ - engine::getFxMixer()->mixToChannel( _buf, _fx_chnl ); -} - - - - -void FASTCALL mixer::scaleClip( fpp_t _frame, ch_cnt_t _chnl ) -{ - // Check for zero crossing - if( ( m_writeBuf[_frame][_chnl] >=0 && - m_previousSample[_chnl] < 0 ) || - ( m_writeBuf[_frame][_chnl] <=0 && - m_previousSample[_chnl] > 0 ) ) - { - // if a clip occurred between the zero - // crossings, scale the half-wave - if( m_clipped[_chnl] ) - { - if( m_newBuffer[_chnl] ) - { - for( fpp_t i = m_halfStart[_chnl]; - i < m_framesPerPeriod; - i++ ) - { - m_bufferPool[m_analBuffer][i][_chnl] /= - m_maxClip[_chnl]; - } - - for( fpp_t i = 0; - i < _frame; - i++ ) - { - m_writeBuf[i][_chnl] /= - m_maxClip[_chnl]; - } - } - else - { - for( fpp_t i = m_halfStart[_chnl]; - i < _frame; - i++ ) - { - m_writeBuf[i][_chnl] /= m_maxClip[_chnl]; - } - } - } - m_halfStart[_chnl] = _frame; - m_clipped[_chnl] = FALSE; - m_newBuffer[_chnl] = FALSE; - m_maxClip[_chnl] = 1.0; - } - - // check for clip - if( fabsf( m_writeBuf[_frame][_chnl] ) > 1.0f ) - { - m_clipped[_chnl] = TRUE; - if( fabs( m_writeBuf[_frame][_chnl] ) > - m_maxClip[_chnl] ) - { - m_maxClip[_chnl] = fabs( - m_writeBuf[_frame][_chnl] ); - } - } - - m_previousSample[_chnl] = m_writeBuf[_frame][_chnl]; -} - - - diff --git a/src/core/song_editor.cpp b/src/core/song_editor.cpp index f9960ea98..02c7bc9ba 100644 --- a/src/core/song_editor.cpp +++ b/src/core/song_editor.cpp @@ -136,17 +136,6 @@ songEditor::songEditor( song * _song ) : engine::getMainWindow()->addWidgetToToolBar( hq_btn, 1, col ); - toolButton * cp_btn = new toolButton( - embed::getIconPixmap( "auto_limit" ), - tr( "Auto limiter" ), - NULL, NULL, tb ); - cp_btn->setCheckable( TRUE ); - connect( cp_btn, SIGNAL( toggled( bool ) ), engine::getMixer(), - SLOT( setClipScaling( bool ) ) ); - cp_btn->setFixedWidth( 30 ); - engine::getMainWindow()->addWidgetToToolBar( cp_btn, 1, col + 1 ); - - engine::getMainWindow()->addSpacingToToolBar( 10 ); connect( engine::getMixer(), SIGNAL( sampleRateChanged() ), this,