Waveshaper: added bg image for graph, made graph larger

Graph widget: added new functionality - ability to draw straight lines with shift-click
This commit is contained in:
Vesa
2014-02-12 13:21:55 +02:00
parent 2405a6a25e
commit 201fa1d89a
6 changed files with 111 additions and 41 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -96,7 +96,7 @@ bool waveShaperEffect::processAudioBuffer( sampleFrame * _buf,
for ( i=0; i <= 1; ++i )
{
lookup = fabsf( s[i] ) * 100.0f;
lookup = fabsf( s[i] ) * 200.0f;
posneg = s[i] < 0 ? -1.0f : 1.0f;
if ( lookup < 1 )
@@ -105,7 +105,7 @@ bool waveShaperEffect::processAudioBuffer( sampleFrame * _buf,
s[i] = frac * m_wsControls.m_wavegraphModel.samples()[0] * posneg;
}
else
if ( lookup < 100 )
if ( lookup < 200 )
{
frac = lookup - truncf(lookup);
s[i] =
@@ -115,7 +115,7 @@ bool waveShaperEffect::processAudioBuffer( sampleFrame * _buf,
}
else
{
s[i] *= m_wsControls.m_wavegraphModel.samples()[99];
s[i] *= m_wsControls.m_wavegraphModel.samples()[199];
}
}

View File

@@ -42,17 +42,32 @@ waveShaperControlDialog::waveShaperControlDialog(
pal.setBrush( backgroundRole(),
PLUGIN_NAME::getIconPixmap( "artwork" ) );
setPalette( pal );
setFixedSize( 120, 200 );
setFixedSize( 222, 300 );
QVBoxLayout * tl = new QVBoxLayout( this );
tl->addSpacing( 30 );
tl->addStrut( 204 );
graph * waveGraph = new graph( this, graph::LinearStyle );
graph * waveGraph = new graph( this, graph::NearestStyle, 204, 204 );
waveGraph -> setModel( &_controls -> m_wavegraphModel );
waveGraph -> setAutoFillBackground( true );
tl -> addWidget( waveGraph );
pal = QPalette();
pal.setBrush( backgroundRole(),
PLUGIN_NAME::getIconPixmap("wavegraph") );
waveGraph->setPalette( pal );
waveGraph->setGraphColor( QColor( 170, 255, 255 ) );
// waveGraph -> setMinimumSize( 204, 204);
// waveGraph -> resize( 204, 204);
waveGraph -> setMaximumSize( 204, 204 );
tl -> setSizeConstraint( QLayout::SetNoConstraint );
tl -> addWidget( waveGraph );
QHBoxLayout * l = new QHBoxLayout;
knob * inputKnob = new knob( knobBright_26, this);

View File

@@ -37,7 +37,7 @@ waveShaperControls::waveShaperControls( waveShaperEffect * _eff ) :
m_effect( _eff ),
m_inputModel( 1.0f, 0.0f, 2.0f, 0.01f, this, tr( "Input gain" ) ),
m_outputModel( 1.0f, 0.0f, 2.0f, 0.01f, this, tr( "Output gain" ) ),
m_wavegraphModel( 0.0f, 1.0f, 100, this )
m_wavegraphModel( 0.0f, 1.0f, 200, this )
{
connect( &m_inputModel, SIGNAL( dataChanged() ),
this, SLOT( changeInput() ) );
@@ -115,13 +115,13 @@ void waveShaperControls::saveSettings( QDomDocument & _doc,
void waveShaperControls::setDefaultShape()
{
float shp [100] = { };
for ( int i = 0; i<100; i++)
float shp [200] = { };
for ( int i = 0; i<200; i++)
{
shp[i] = ((float)i + 1.0f) / 100.0f;
shp[i] = ((float)i + 1.0f) / 200.0f;
}
m_wavegraphModel.setLength( 100 );
m_wavegraphModel.setLength( 200 );
m_wavegraphModel.setSamples( (float*)&shp );
}