diff --git a/ChangeLog b/ChangeLog index 975b9c23b..41013d2a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,18 @@ - Fix incorrect replacement for drumsynth/misc - Replace r&b,r_b with r_n_b + * src/core/main.cpp: + Make "could not set realtime priority" sound less like an error + + * plugins/lb302/lb302.cpp: + * plugins/lb302/lb302.h: + * src/core/mmp.cpp: + * data/themes/default/round_square_wave_inactive.png: + * data/themes/default/round_square_wave_active.png: + - Remove useless inverted-saw waveform + - Add Sine, Noise, and Exponential waveforms + - Use buttons instead of a knob + 2008-09-20 Paul Giblock * plugins/sf2_player/sf2_player.cpp: diff --git a/data/themes/default/round_square_wave_active.png b/data/themes/default/round_square_wave_active.png new file mode 100644 index 000000000..b2d794d39 Binary files /dev/null and b/data/themes/default/round_square_wave_active.png differ diff --git a/data/themes/default/round_square_wave_inactive.png b/data/themes/default/round_square_wave_inactive.png new file mode 100644 index 000000000..3e1f9c0b0 Binary files /dev/null and b/data/themes/default/round_square_wave_inactive.png differ diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index 18c6e3599..e4ddcaf20 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -32,13 +32,17 @@ #include #include "lb302.h" +#include "audio_port.h" +#include "automatable_button.h" #include "engine.h" #include "instrument_play_handle.h" #include "instrument_track.h" #include "knob.h" #include "note_play_handle.h" +#include "oscillator.h" +#include "pixmap_button.h" #include "templates.h" -#include "audio_port.h" +#include "tooltip.h" #undef SINGLE_SOURCE_COMPILE #include "embed.cpp" @@ -276,7 +280,7 @@ lb302Synth::lb302Synth( instrumentTrack * _instrumentTrack ) : vcf_mod_knob( 0.1f, 0.0f, 1.0f, 0.005f, this, tr( "VCF Envelope Mod" ) ), vcf_dec_knob( 0.1f, 0.0f, 1.0f, 0.005f, this, tr( "VCF Envelope Decay" ) ), dist_knob( 0.0f, 0.0f, 1.0f, 0.01f, this, tr( "Distortion" ) ), - wave_knob( 0.0f, 0.0f, 5.0f, 1.0f, this, tr( "Waveform" ) ), + wave_shape( 0.0f, 0.0f, 6.0f, this, tr( "Waveform" ) ), slide_dec_knob( 0.6f, 0.0f, 1.0f, 0.005f, this, tr( "Slide Decay" ) ), slideToggle( FALSE, this, tr( "Slide" ) ), accentToggle( FALSE, this, tr( "Accent" ) ), @@ -375,7 +379,7 @@ void lb302Synth::saveSettings( QDomDocument & _doc, vcf_mod_knob.saveSettings( _doc, _this, "vcf_mod" ); vcf_dec_knob.saveSettings( _doc, _this, "vcf_dec" ); - wave_knob.saveSettings( _doc, _this, "shape"); + wave_shape.saveSettings( _doc, _this, "shape"); dist_knob.saveSettings( _doc, _this, "dist"); slide_dec_knob.saveSettings( _doc, _this, "slide_dec"); @@ -393,9 +397,8 @@ void lb302Synth::loadSettings( const QDomElement & _this ) vcf_dec_knob.loadSettings( _this, "vcf_dec" ); dist_knob.loadSettings( _this, "dist"); - wave_knob.loadSettings( _this, "shape"); slide_dec_knob.loadSettings( _this, "slide_dec"); - + wave_shape.loadSettings( _this, "shape"); slideToggle.loadSettings( _this, "slide"); deadToggle.loadSettings( _this, "dead"); db24Toggle.loadSettings( _this, "db24"); @@ -537,13 +540,15 @@ int lb302Synth::process(sampleFrame *outbuf, const Uint32 size) } }*/ - switch(int(rint(wave_knob.value()))) { + switch(int(rint(wave_shape.value()))) { case 0: vco_shape = SAWTOOTH; break; - case 1: vco_shape = INVERTED_SAWTOOTH; break; - case 2: vco_shape = TRIANGLE; break; - case 3: vco_shape = SQUARE; break; - case 4: vco_shape = ROUND_SQUARE; break; - case 5: vco_shape = MOOG; break; + case 1: vco_shape = TRIANGLE; break; + case 2: vco_shape = SQUARE; break; + case 3: vco_shape = ROUND_SQUARE; break; + case 4: vco_shape = MOOG; break; + case 5: vco_shape = SINE; break; + case 6: vco_shape = EXPONENTIAL; break; + case 7: vco_shape = WHITE_NOISE; break; default: vco_shape = SAWTOOTH; break; } @@ -554,10 +559,6 @@ int lb302Synth::process(sampleFrame *outbuf, const Uint32 size) vco_k = vco_c; // Is this sawtooth backwards? break; - case INVERTED_SAWTOOTH: // p0: curviness of line - vco_k = -vco_c; // Is this sawtooth backwards? - break; - case TRIANGLE: // p0: duty rev.saw<->triangle<->saw p1: curviness vco_k = (vco_c*2.0)+0.5; if (vco_k>0.5) @@ -584,6 +585,19 @@ int lb302Synth::process(sampleFrame *outbuf, const Uint32 size) } vco_k *= 2.0; // MOOG wave gets filtered away break; + + case SINE: + // [-0.5, 0.5] : [-pi, pi] + vco_k = 0.5f * oscillator::sinSample( vco_c ); + break; + + case EXPONENTIAL: + vco_k = 0.5 * oscillator::expSample( vco_c ); + break; + + case WHITE_NOISE: + vco_k = 0.5 * oscillator::noiseSample( vco_c ); + break; } //vca_a = 0.5; @@ -841,11 +855,97 @@ lb302SynthView::lb302SynthView( instrument * _instrument, QWidget * _parent ) : m_distKnob->setLabel( tr( "DIST")); - m_waveKnob = new knob( knobBright_26, this ); - m_waveKnob->move( 120, 75 ); - m_waveKnob->setHintText( tr( "WAVE:" ) + " ", "" ); - m_waveKnob->setLabel( tr( "WAVE")); + // Shapes + // move to 120,75 + const int waveBtnX = 10; + const int waveBtnY = 96; + pixmapButton * sawWaveBtn = new pixmapButton( this, tr( "Saw wave" ) ); + sawWaveBtn->move( waveBtnX, waveBtnY ); + sawWaveBtn->setActiveGraphic( embed::getIconPixmap( + "saw_wave_active" ) ); + sawWaveBtn->setInactiveGraphic( embed::getIconPixmap( + "saw_wave_inactive" ) ); + toolTip::add( sawWaveBtn, + tr( "Click here for a saw-wave." ) ); + pixmapButton * triangleWaveBtn = + new pixmapButton( this, tr( "Triangle wave" ) ); + triangleWaveBtn->move( waveBtnX+(16*1), waveBtnY ); + triangleWaveBtn->setActiveGraphic( + embed::getIconPixmap( "triangle_wave_active" ) ); + triangleWaveBtn->setInactiveGraphic( + embed::getIconPixmap( "triangle_wave_inactive" ) ); + toolTip::add( triangleWaveBtn, + tr( "Click here for a triangle-wave." ) ); + + pixmapButton * sqrWaveBtn = new pixmapButton( this, tr( "Square wave" ) ); + sqrWaveBtn->move( waveBtnX+(16*2), waveBtnY ); + sqrWaveBtn->setActiveGraphic( embed::getIconPixmap( + "square_wave_active" ) ); + sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap( + "square_wave_inactive" ) ); + toolTip::add( sqrWaveBtn, + tr( "Click here for a square-wave." ) ); + + pixmapButton * roundSqrWaveBtn = + new pixmapButton( this, tr( "Rounded square wave" ) ); + roundSqrWaveBtn->move( waveBtnX+(16*3), waveBtnY ); + roundSqrWaveBtn->setActiveGraphic( embed::getIconPixmap( + "round_square_wave_active" ) ); + roundSqrWaveBtn->setInactiveGraphic( embed::getIconPixmap( + "round_square_wave_inactive" ) ); + toolTip::add( roundSqrWaveBtn, + tr( "Click here for a square-wave with a rounded end." ) ); + + pixmapButton * moogWaveBtn = + new pixmapButton( this, tr( "Moog wave" ) ); + moogWaveBtn->move( waveBtnX+(16*4), waveBtnY ); + moogWaveBtn->setActiveGraphic( + embed::getIconPixmap( "moog_saw_wave_active" ) ); + moogWaveBtn->setInactiveGraphic( + embed::getIconPixmap( "moog_saw_wave_inactive" ) ); + toolTip::add( moogWaveBtn, + tr( "Click here for a moog-like wave." ) ); + + pixmapButton * sinWaveBtn = new pixmapButton( this, tr( "Sine wave" ) ); + sinWaveBtn->move( waveBtnX+(16*5), waveBtnY ); + sinWaveBtn->setActiveGraphic( embed::getIconPixmap( + "sin_wave_active" ) ); + sinWaveBtn->setInactiveGraphic( embed::getIconPixmap( + "sin_wave_inactive" ) ); + toolTip::add( sinWaveBtn, + tr( "Click for a sine-wave." ) ); + + pixmapButton * exponentialWaveBtn = + new pixmapButton( this, tr( "White noise wave" ) ); + exponentialWaveBtn->move( waveBtnX+(16*6), waveBtnY ); + exponentialWaveBtn->setActiveGraphic( + embed::getIconPixmap( "exp_wave_active" ) ); + exponentialWaveBtn->setInactiveGraphic( + embed::getIconPixmap( "exp_wave_inactive" ) ); + toolTip::add( exponentialWaveBtn, + tr( "Click here for an exponential wave." ) ); + + + pixmapButton * whiteNoiseWaveBtn = + new pixmapButton( this, tr( "White noise wave" ) ); + whiteNoiseWaveBtn->move( waveBtnX+(16*7), waveBtnY ); + whiteNoiseWaveBtn->setActiveGraphic( + embed::getIconPixmap( "white_noise_wave_active" ) ); + whiteNoiseWaveBtn->setInactiveGraphic( + embed::getIconPixmap( "white_noise_wave_inactive" ) ); + toolTip::add( whiteNoiseWaveBtn, + tr( "Click here for white-noise." ) ); + + m_waveBtnGrp = new automatableButtonGroup( this ); + m_waveBtnGrp->addButton( sawWaveBtn ); + m_waveBtnGrp->addButton( triangleWaveBtn ); + m_waveBtnGrp->addButton( sqrWaveBtn ); + m_waveBtnGrp->addButton( roundSqrWaveBtn ); + m_waveBtnGrp->addButton( moogWaveBtn ); + m_waveBtnGrp->addButton( sinWaveBtn ); + m_waveBtnGrp->addButton( exponentialWaveBtn ); + m_waveBtnGrp->addButton( whiteNoiseWaveBtn ); setAutoFillBackground( TRUE ); QPalette pal; @@ -871,7 +971,7 @@ void lb302SynthView::modelChanged( void ) m_slideDecKnob->setModel( &syn->slide_dec_knob ); m_distKnob->setModel( &syn->dist_knob ); - m_waveKnob->setModel( &syn->wave_knob ); + m_waveBtnGrp->setModel( &syn->wave_shape ); m_slideToggle->setModel( &syn->slideToggle ); m_accentToggle->setModel( &syn->accentToggle ); diff --git a/plugins/lb302/lb302.h b/plugins/lb302/lb302.h index f17377392..38429039f 100644 --- a/plugins/lb302/lb302.h +++ b/plugins/lb302/lb302.h @@ -177,7 +177,7 @@ private: knobModel vco_fine_detune_knob; knobModel dist_knob; - knobModel wave_knob; + intModel wave_shape; knobModel slide_dec_knob; boolModel slideToggle; @@ -202,7 +202,7 @@ private: float vco_detune; - enum vco_shape_t { SAWTOOTH, INVERTED_SAWTOOTH, SQUARE, TRIANGLE, MOOG, ROUND_SQUARE }; + enum vco_shape_t { SAWTOOTH, SQUARE, TRIANGLE, MOOG, ROUND_SQUARE, SINE, EXPONENTIAL, WHITE_NOISE }; vco_shape_t vco_shape; // User settings @@ -263,8 +263,8 @@ private: knob * m_vcoFineDetuneKnob; knob * m_distKnob; - knob * m_waveKnob; knob * m_slideDecKnob; + automatableButtonGroup * m_waveBtnGrp; ledCheckBox * m_slideToggle; ledCheckBox * m_accentToggle; diff --git a/src/core/mmp.cpp b/src/core/mmp.cpp index df539ba51..6170fb0ed 100644 --- a/src/core/mmp.cpp +++ b/src/core/mmp.cpp @@ -704,6 +704,18 @@ void multimediaProject::upgrade( void ) s.replace( "drumsynth/r_b", "drumsynth/r_n_b" ); el.setAttribute( "src", s ); } + list = elementsByTagName( "lb302" ); + for( int i = 0; !list.item( i ).isNull(); ++i ) + { + QDomElement el = list.item( i ).toElement(); + int s = el.attribute( "shape" ).toInt(); + if( s >= 1 ) + { + s--; + } + el.setAttribute( "shape", QString("%1").arg(s) ); + } + } // Time-signature