Random wave first commit, pixmap button defect

This commit is contained in:
Oskar Wallgren
2014-05-22 07:17:55 +02:00
parent 31268a0b6b
commit 85c02cddfe
5 changed files with 33 additions and 1 deletions

View File

@@ -218,6 +218,14 @@ inline sample_t EnvelopeAndLfoParameters::lfoShapeSample( fpp_t _frame_offset )
case UserDefinedWave:
shape_sample = m_userWave.userWaveSample( phase );
break;
case RandomWave:
shape_sample = m_random;
if( frame == 0 )
{
updateRandomWave();
shape_sample = m_random;
}
break;
case SineWave:
default:
shape_sample = Oscillator::sinSample( phase );
@@ -242,6 +250,14 @@ void EnvelopeAndLfoParameters::updateLfoShapeData()
void EnvelopeAndLfoParameters::updateRandomWave()
{
m_random = Oscillator::noiseSample( 0.0f );
}
inline void EnvelopeAndLfoParameters::fillLfoLevel( float * _buf,
f_cnt_t _frame,
const fpp_t _frames )

View File

@@ -250,8 +250,17 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) :
sqr_lfo_btn->setWhatsThis(
tr( "Click here for a square-wave." ) );
pixmapButton * random_lfo_btn = new pixmapButton( this, NULL );
random_lfo_btn->move( LFO_SHAPES_X+60, LFO_SHAPES_Y );
random_lfo_btn->setActiveGraphic( embed::getIconPixmap(
"random_wave_active" ) );
random_lfo_btn->setInactiveGraphic( embed::getIconPixmap(
"random_wave_inactive" ) );
random_lfo_btn->setWhatsThis(
tr( "Click here for random wave." ) );
m_userLfoBtn = new pixmapButton( this, NULL );
m_userLfoBtn->move( LFO_SHAPES_X+60, LFO_SHAPES_Y );
m_userLfoBtn->move( LFO_SHAPES_X+75, LFO_SHAPES_Y );
m_userLfoBtn->setActiveGraphic( embed::getIconPixmap(
"usr_wave_active" ) );
m_userLfoBtn->setInactiveGraphic( embed::getIconPixmap(
@@ -269,6 +278,7 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) :
m_lfoWaveBtnGrp->addButton( triangle_lfo_btn );
m_lfoWaveBtnGrp->addButton( saw_lfo_btn );
m_lfoWaveBtnGrp->addButton( sqr_lfo_btn );
m_lfoWaveBtnGrp->addButton( random_lfo_btn );
m_lfoWaveBtnGrp->addButton( m_userLfoBtn );
@@ -525,6 +535,9 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * )
case EnvelopeAndLfoParameters::SquareWave:
val = Oscillator::squareSample( phase );
break;
case EnvelopeAndLfoParameters::RandomWave:
val = Oscillator::squareSample( phase );// <- dummy!
break;
case EnvelopeAndLfoParameters::UserDefinedWave:
val = m_params->m_userWave.
userWaveSample( phase );