corrected ladspa sample rate dependent control handling

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@299 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Danny McRae
2006-08-10 16:37:05 +00:00
parent 4cb0d266a3
commit 2000733293
4 changed files with 38 additions and 15 deletions

View File

@@ -1,3 +1,15 @@
2006-08-10 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
* include/effect.h:
* src/core/effect.cpp:
* src/widgets/ladspa_control.cpp:
corrected an error in setting the values for sample rate
dependent ports
the crackling in the sample tracks is due to rounding errors
in the calculation of _start_frame in sampleTrack::play that
cause it to occasionally skip a sample. Don't know what to
do about it--just thought it should be noted somewhere.
2006-08-09 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
* Makefile.am:
* include/effect_label.h:

View File

@@ -68,6 +68,7 @@ typedef struct portDescription
Uint16 control_id;
buffer_rate_t rate;
buffer_data_t data_type;
bool is_scaled;
LADSPA_Data max;
LADSPA_Data min;
LADSPA_Data def;

View File

@@ -134,13 +134,13 @@ effect::effect( const ladspa_key_t & _key, engine * _engine ) :
}
// Get the range and default values.
p->is_scaled = m_ladspa->areHintsSampleRateDependent( _key, port );
p->max = m_ladspa->getUpperBound( _key, port );
if( p->max == NOHINT )
{
p->max = 999999.0f;
}
else if( m_ladspa->areHintsSampleRateDependent( _key, port ) )
else if( p->is_scaled )
{
p->max *= eng()->getMixer()->sampleRate();
}
@@ -150,7 +150,7 @@ effect::effect( const ladspa_key_t & _key, engine * _engine ) :
{
p->min = -999999.0f;
}
else if( m_ladspa->areHintsSampleRateDependent( _key, port ) )
else if( p->is_scaled )
{
p->min *= eng()->getMixer()->sampleRate();
}

View File

@@ -54,8 +54,8 @@ ladspaControl::ladspaControl( QWidget * _parent, port_desc_t * _port, engine * _
case INTEGER:
m_knob = new knob( knobBright_26, this, m_port->name, eng(), m_track);
m_knob->setLabel( m_port->name );
m_knob->setRange( m_port->max, m_port->min, 1 + static_cast<int>( m_port->max - m_port->min ) / 500 );
m_knob->setInitValue( m_port->def );
m_knob->setRange( static_cast<int>( m_port->max ), static_cast<int>( m_port->min ), 1 + static_cast<int>( m_port->max - m_port->min ) / 200 );
m_knob->setInitValue( static_cast<int>( m_port->def ) );
setFixedSize( m_knob->width(), m_knob->height() );
m_knob->setHintText( tr( "Value:" ) + " ", "" );
#ifdef QT4
@@ -68,14 +68,7 @@ ladspaControl::ladspaControl( QWidget * _parent, port_desc_t * _port, engine * _
case FLOAT:
m_knob = new knob( knobBright_26, this, m_port->name, eng(), m_track);
m_knob->setLabel( m_port->name );
if( ( m_port->max - m_port->min ) < 500.0f )
{
m_knob->setRange( m_port->min, m_port->max, 0.01 );
}
else
{
m_knob->setRange( m_port->min, m_port->max, ( m_port->max - m_port->min ) / 500.0f );
}
m_knob->setRange( m_port->min, m_port->max, ( m_port->max - m_port->min ) / 200.0f );
m_knob->setInitValue( m_port->def );
m_knob->setHintText( tr( "Value:" ) + " ", "" );
#ifdef QT4
@@ -103,13 +96,30 @@ ladspaControl::~ladspaControl()
LADSPA_Data ladspaControl::getValue( void )
{
LADSPA_Data value = 0.0f;
switch( m_port->data_type )
{
case TOGGLED:
return( static_cast<LADSPA_Data>( m_toggle->isChecked() ) );
value = static_cast<LADSPA_Data>( m_toggle->isChecked() );
break;
case INTEGER:
value = static_cast<LADSPA_Data>( m_knob->value() );
break;
case FLOAT:
value = static_cast<LADSPA_Data>( m_knob->value() );
break;
default:
return( static_cast<LADSPA_Data>( m_knob->value() ) );
printf( "ladspaControl::getValue BAD BAD BAD\n" );
break;
}
if( m_port->is_scaled )
{
value /= eng()->getMixer()->sampleRate();
}
return( value );
}