diff --git a/data/themes/default/style.css b/data/themes/default/style.css index b9c3e94b1..52a97aaa9 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -523,13 +523,24 @@ TripleOscillatorView knob { } -kickerInstrumentView knob { - color: rgb(240, 147, 14); - qproperty-outerColor: rgb(30, 35, 37); - qproperty-innerRadius: 4; - qproperty-outerRadius: 11.2; - qproperty-centerPointX: 18.5; - qproperty-centerPointY: 13.5; +kickerInstrumentView knob#smallKnob { + color: #595959; + qproperty-outerColor: black; + qproperty-innerRadius: 3; + qproperty-outerRadius: 11.0; + qproperty-centerPointX: 14.5; + qproperty-centerPointY: 14.5; + qproperty-lineWidth: 2; +} + + +kickerInstrumentView knob#largeKnob { + color: #0c3b89; + qproperty-outerColor: #519fff; + qproperty-innerRadius: 12.0; + qproperty-outerRadius: 14.5; + qproperty-centerPointX: 17.0; + qproperty-centerPointY: 17.0; qproperty-lineWidth: 3; } diff --git a/plugins/kicker/KickerOsc.h b/plugins/kicker/KickerOsc.h index 6fdabdb1d..bd168cb23 100644 --- a/plugins/kicker/KickerOsc.h +++ b/plugins/kicker/KickerOsc.h @@ -30,19 +30,24 @@ #include "Oscillator.h" #include "lmms_math.h" +#include "interpolation.h" template class KickerOsc { public: - KickerOsc( const FX & fx, const float start, const float end, const float noise, const float offset, const float slope, const float env, const float length ) : + KickerOsc( const FX & fx, const float start, const float end, const float noise, const float offset, + const float slope, const float env, const float diststart, const float distend, const float length ) : m_phase( offset ), m_startFreq( start ), m_endFreq( end ), m_noise( noise ), m_slope( slope ), m_env( env ), + m_distStart( diststart ), + m_distEnd( distend ), + m_hasDistEnv( diststart != distend ), m_length( length ), m_FX( fx ), m_counter( 0 ), @@ -62,6 +67,15 @@ public: const sample_t s = ( Oscillator::sinSample( m_phase ) * ( 1 - m_noise ) ) + ( Oscillator::noiseSample( 0 ) * gain * gain * m_noise ); buf[frame][0] = s * gain; buf[frame][1] = s * gain; + + // update distortion envelope if necessary + if( m_hasDistEnv && m_counter < m_length ) + { + float thres = linearInterpolate( m_distStart, m_distEnd, m_counter / m_length ); + m_FX.leftFX().setThreshold( thres ); + m_FX.rightFX().setThreshold( thres ); + } + m_FX.nextSample( buf[frame][0], buf[frame][1] ); m_phase += m_freq / sampleRate; @@ -79,6 +93,9 @@ private: const float m_noise; const float m_slope; const float m_env; + const float m_distStart; + const float m_distEnd; + const bool m_hasDistEnv; const float m_length; FX m_FX; diff --git a/plugins/kicker/artwork.png b/plugins/kicker/artwork.png index 59c0e1941..f6a58948c 100644 Binary files a/plugins/kicker/artwork.png and b/plugins/kicker/artwork.png differ diff --git a/plugins/kicker/kicker.cpp b/plugins/kicker/kicker.cpp index e694d3cf9..5fe9c6716 100644 --- a/plugins/kicker/kicker.cpp +++ b/plugins/kicker/kicker.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 2006-2009 Tobias Doerffel * Copyright (c) 2014 Hannu Haahti - * + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -61,14 +61,15 @@ kickerInstrument::kickerInstrument( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &kicker_plugin_descriptor ), m_startFreqModel( 150.0f, 5.0f, 1000.0f, 1.0f, this, tr( "Start frequency" ) ), m_endFreqModel( 40.0f, 5.0f, 1000.0f, 1.0f, this, tr( "End frequency" ) ), - m_decayModel( 440.0f, 5.0f, 2000.0f, 1.0f, this, tr( "Length" ) ), - m_distModel( 0.8f, 0.0f, 100.0f, 0.1f, this, tr( "Distortion" ) ), + m_decayModel( 440.0f, 5.0f, 5000.0f, 1.0f, 5000.0f, this, tr( "Length" ) ), + m_distModel( 0.8f, 0.0f, 100.0f, 0.1f, this, tr( "Distortion Start" ) ), + m_distEndModel( 0.8f, 0.0f, 100.0f, 0.1f, this, tr( "Distortion End" ) ), m_gainModel( 1.0f, 0.1f, 5.0f, 0.05f, this, tr( "Gain" ) ), - m_envModel( 0.163f, 0.01f, 1.0f, 0.001f, this, tr( "Env" ) ), + m_envModel( 0.163f, 0.01f, 1.0f, 0.001f, this, tr( "Envelope Slope" ) ), m_noiseModel( 0.0f, 0.0f, 1.0f, 0.01f, this, tr( "Noise" ) ), m_clickModel( 0.4f, 0.0f, 1.0f, 0.05f, this, tr( "Click" ) ), - m_slopeModel( 0.06f, 0.001f, 1.0f, 0.001f, this, tr( "Slope" ) ), - m_startNoteModel( false, this, tr( "Start from note" ) ), + m_slopeModel( 0.06f, 0.001f, 1.0f, 0.001f, this, tr( "Frequency Slope" ) ), + m_startNoteModel( true, this, tr( "Start from note" ) ), m_endNoteModel( false, this, tr( "End to note" ) ), m_versionModel( 0, 0, KICKER_PRESET_VERSION, this, "" ) { @@ -91,6 +92,7 @@ void kickerInstrument::saveSettings( QDomDocument & _doc, m_endFreqModel.saveSettings( _doc, _this, "endfreq" ); m_decayModel.saveSettings( _doc, _this, "decay" ); m_distModel.saveSettings( _doc, _this, "dist" ); + m_distEndModel.saveSettings( _doc, _this, "distend" ); m_gainModel.saveSettings( _doc, _this, "gain" ); m_envModel.saveSettings( _doc, _this, "env" ); m_noiseModel.saveSettings( _doc, _this, "noise" ); @@ -110,6 +112,14 @@ void kickerInstrument::loadSettings( const QDomElement & _this ) m_endFreqModel.loadSettings( _this, "endfreq" ); m_decayModel.loadSettings( _this, "decay" ); m_distModel.loadSettings( _this, "dist" ); + if( _this.hasAttribute( "distend" ) ) + { + m_distEndModel.loadSettings( _this, "distend" ); + } + else + { + m_distEndModel.setValue( m_distModel.value() ); + } m_gainModel.loadSettings( _this, "gain" ); m_envModel.loadSettings( _this, "env" ); m_noiseModel.loadSettings( _this, "noise" ); @@ -148,7 +158,7 @@ void kickerInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { const float decfr = m_decayModel.value() * - engine::mixer()->processingSampleRate() / 1000.0f; + engine::mixer()->processingSampleRate() / 1000.0f; const f_cnt_t tfp = _n->totalFramesPlayed(); if ( tfp == 0 ) @@ -162,6 +172,8 @@ void kickerInstrument::playNote( NotePlayHandle * _n, m_clickModel.value() * 0.25f, m_slopeModel.value(), m_envModel.value(), + m_distModel.value(), + m_distEndModel.value(), decfr ); } else if( tfp > decfr && !_n->isReleased() ) @@ -214,7 +226,32 @@ public: kickerKnob( QWidget * _parent ) : knob( knobStyled, _parent ) { - setFixedSize( 35, 45 ); + setFixedSize( 29, 29 ); + setObjectName( "smallKnob" ); + } +}; + + +class kickerEnvKnob : public TempoSyncKnob +{ +public: + kickerEnvKnob( QWidget * _parent ) : + TempoSyncKnob( knobStyled, _parent ) + { + setFixedSize( 29, 29 ); + setObjectName( "smallKnob" ); + } +}; + + +class kickerLargeKnob : public knob +{ +public: + kickerLargeKnob( QWidget * _parent ) : + knob( knobStyled, _parent ) + { + setFixedSize( 34, 34 ); + setObjectName( "largeKnob" ); } }; @@ -225,52 +262,66 @@ kickerInstrumentView::kickerInstrumentView( Instrument * _instrument, QWidget * _parent ) : InstrumentView( _instrument, _parent ) { - m_startFreqKnob = new kickerKnob( this ); + const int ROW1 = 14; + const int ROW2 = ROW1 + 56; + const int ROW3 = ROW2 + 56; + const int LED_ROW = 63; + const int COL1 = 14; + const int COL2 = COL1 + 56; + const int COL3 = COL2 + 56; + const int COL4 = COL3 + 41; + const int COL5 = COL4 + 41; + const int END_COL = COL1 + 48; + + m_startFreqKnob = new kickerLargeKnob( this ); m_startFreqKnob->setHintText( tr( "Start frequency:" ) + " ", "Hz" ); - m_startFreqKnob->move( 15, 100 ); + m_startFreqKnob->move( COL1, ROW1 ); - m_endFreqKnob = new kickerKnob( this ); + m_endFreqKnob = new kickerLargeKnob( this ); m_endFreqKnob->setHintText( tr( "End frequency:" ) + " ", "Hz" ); - m_endFreqKnob->move( 60, 100 ); + m_endFreqKnob->move( END_COL, ROW1 ); m_slopeKnob = new kickerKnob( this ); - m_slopeKnob->setHintText( tr( "Slope:" ) + " ", "" ); - m_slopeKnob->move( 105, 100 ); + m_slopeKnob->setHintText( tr( "Frequency Slope:" ) + " ", "" ); + m_slopeKnob->move( COL3, ROW1 ); m_gainKnob = new kickerKnob( this ); m_gainKnob->setHintText( tr( "Gain:" ) + " ", "" ); - m_gainKnob->move( 15, 155 ); + m_gainKnob->move( COL1, ROW3 ); - m_decayKnob = new kickerKnob( this ); - m_decayKnob->setHintText( tr( "Length:" ) + " ", "ms" ); - m_decayKnob->move( 60, 155 ); + m_decayKnob = new kickerEnvKnob( this ); + m_decayKnob->setHintText( tr( "Envelope Length:" ) + " ", "ms" ); + m_decayKnob->move( COL2, ROW3 ); m_envKnob = new kickerKnob( this ); - m_envKnob->setHintText( tr( "Env:" ) + " ", "" ); - m_envKnob->move( 105, 155 ); + m_envKnob->setHintText( tr( "Envelope Slope:" ) + " ", "" ); + m_envKnob->move( COL3, ROW3 ); m_clickKnob = new kickerKnob( this ); m_clickKnob->setHintText( tr( "Click:" ) + " ", "" ); - m_clickKnob->move( 200, 45 ); + m_clickKnob->move( COL5, ROW1 ); m_noiseKnob = new kickerKnob( this ); m_noiseKnob->setHintText( tr( "Noise:" ) + " ", "" ); - m_noiseKnob->move( 200, 100 ); + m_noiseKnob->move( COL5, ROW3 ); m_distKnob = new kickerKnob( this ); - m_distKnob->setHintText( tr( "Dist:" ) + " ", "" ); - m_distKnob->move( 200, 155 ); + m_distKnob->setHintText( tr( "Distortion Start:" ) + " ", "" ); + m_distKnob->move( COL4, ROW2 ); - m_startNoteToggle = new ledCheckBox( "", this ); - m_startNoteToggle->move( 24, 79 ); + m_distEndKnob = new kickerKnob( this ); + m_distEndKnob->setHintText( tr( "Distortion End:" ) + " ", "" ); + m_distEndKnob->move( COL5, ROW2 ); - m_endNoteToggle = new ledCheckBox( "", this ); - m_endNoteToggle->move( 69, 79 ); + m_startNoteToggle = new ledCheckBox( "", this, "", ledCheckBox::Green ); + m_startNoteToggle->move( COL1 + 8, LED_ROW ); + + m_endNoteToggle = new ledCheckBox( "", this, "", ledCheckBox::Green ); + m_endNoteToggle->move( END_COL + 8, LED_ROW ); setAutoFillBackground( true ); QPalette pal; - pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( - "artwork" ) ); + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); } @@ -291,6 +342,7 @@ void kickerInstrumentView::modelChanged() m_endFreqKnob->setModel( &k->m_endFreqModel ); m_decayKnob->setModel( &k->m_decayModel ); m_distKnob->setModel( &k->m_distModel ); + m_distEndKnob->setModel( &k->m_distEndModel ); m_gainKnob->setModel( &k->m_gainModel ); m_envKnob->setModel( &k->m_envModel ); m_noiseKnob->setModel( &k->m_noiseModel ); diff --git a/plugins/kicker/kicker.h b/plugins/kicker/kicker.h index 8e58a42e0..0119db331 100644 --- a/plugins/kicker/kicker.h +++ b/plugins/kicker/kicker.h @@ -3,7 +3,7 @@ * Copyright (c) 2014 Hannu Haahti * * Copyright (c) 2006-2008 Tobias Doerffel - * + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -24,14 +24,15 @@ */ -#ifndef _KICKER_H -#define _KICKER_H +#ifndef KICKER_H +#define KICKER_H #include #include "Instrument.h" #include "InstrumentView.h" #include "knob.h" #include "led_checkbox.h" +#include "TempoSyncKnob.h" #define KICKER_PRESET_VERSION 1 @@ -72,8 +73,9 @@ public: private: FloatModel m_startFreqModel; FloatModel m_endFreqModel; - FloatModel m_decayModel; + TempoSyncKnobModel m_decayModel; FloatModel m_distModel; + FloatModel m_distEndModel; FloatModel m_gainModel; FloatModel m_envModel; FloatModel m_noiseModel; @@ -105,6 +107,7 @@ private: knob * m_endFreqKnob; knob * m_decayKnob; knob * m_distKnob; + knob * m_distEndKnob; knob * m_gainKnob; knob * m_envKnob; knob * m_noiseKnob;