Merge pull request #8 from LMMS/master

merge from master
This commit is contained in:
Dave
2014-12-17 01:17:15 +00:00
33 changed files with 967 additions and 85 deletions

View File

@@ -15,7 +15,7 @@ INCLUDE(FindPkgConfig)
SET(VERSION_MAJOR "1")
SET(VERSION_MINOR "0")
SET(VERSION_PATCH "99")
SET(VERSION_PATCH "100")
#SET(VERSION_SUFFIX "")
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
IF(VERSION_SUFFIX)

View File

@@ -1,20 +1,20 @@
<?xml version="1.0"?>
<!DOCTYPE lmms-project>
<lmms-project version="1.0" creator="LMMS" creatorversion="1.0.98" type="instrumenttracksettings">
<lmms-project version="1.0" creator="LMMS" creatorversion="1.0.99" type="instrumenttracksettings">
<head/>
<instrumenttracksettings muted="0" type="0" name="Kick power" solo="0">
<instrumenttrack pan="0" fxch="0" scale_type="linear" pitchrange="1" pitch="0" basenote="57" vol="100">
<instrumenttrack pan="0" fxch="0" pitchrange="1" pitch="0" basenote="57" vol="100">
<instrument name="kicker">
<kicker decay_numerator="4" decay_denominator="4" distend="0.8" click="0.25" endnote="0" version="1" decay="594" syncmode="0" noise="0" slope="0.33" dist="1.2" env="0.163" scale_type="linear" startnote="0" startfreq="130" endfreq="5" gain="1"/>
<kicker decay_numerator="4" decay_denominator="4" distend="0.8" click="0.25" endnote="0" version="1" decay="360" syncmode="0" noise="0.2" slope="0.372" dist="1.2" env="0.163" startnote="0" startfreq="145" endfreq="30" gain="1"/>
</instrument>
<eldata scale_type="linear" fres="0.5" ftype="0" fcut="14000" fwet="0">
<elvol lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" syncmode="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4" scale_type="linear"/>
<elcut lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" syncmode="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4" scale_type="linear"/>
<elres lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" syncmode="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4" scale_type="linear"/>
<eldata fres="0.5" ftype="0" fcut="14000" fwet="0">
<elvol lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" syncmode="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4"/>
<elcut lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" syncmode="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4"/>
<elres lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" syncmode="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4"/>
</eldata>
<chordcreator chord="0" scale_type="linear" chordrange="1" chord-enabled="0"/>
<arpeggiator arptime="100" arprange="1" arptime_denominator="4" syncmode="0" arpmode="0" scale_type="linear" arp-enabled="0" arp="0" arptime_numerator="4" arpdir="0" arpgate="100"/>
<midiport inputcontroller="0" fixedoutputvelocity="-1" inputchannel="0" scale_type="linear" outputcontroller="0" writable="0" outputchannel="1" fixedinputvelocity="-1" fixedoutputnote="-1" outputprogram="1" basevelocity="63" readable="0"/>
<chordcreator chord="0" chordrange="1" chord-enabled="0"/>
<arpeggiator arptime="100" arprange="1" arptime_denominator="4" syncmode="0" arpmode="0" arp-enabled="0" arp="0" arptime_numerator="4" arpdir="0" arpgate="100"/>
<midiport inputcontroller="0" fixedoutputvelocity="-1" inputchannel="0" outputcontroller="0" writable="0" outputchannel="1" fixedinputvelocity="-1" fixedoutputnote="-1" outputprogram="1" basevelocity="63" readable="0"/>
<fxchain numofeffects="0" enabled="0"/>
</instrumenttrack>
</instrumenttracksettings>

View File

@@ -0,0 +1,161 @@
<?xml version="1.0"?>
<!DOCTYPE lmms-project>
<lmms-project version="1.0" creator="LMMS" creatorversion="1.0.99" type="instrumenttracksettings">
<head/>
<instrumenttracksettings muted="0" type="0" name="Snare March" solo="0">
<instrumenttrack pan="0" fxch="0" pitchrange="1" pitch="0" basenote="57" vol="100">
<instrument name="kicker">
<kicker decay_numerator="4" decay_denominator="4" distend="0" click="1" endnote="0" version="1" decay="240" syncmode="0" noise="0.85" slope="1" dist="0" env="0.644" startnote="0" startfreq="229" endfreq="195" gain="1"/>
</instrument>
<eldata fres="0.56" ftype="3" fcut="929" fwet="1">
<elvol lspd_denominator="4" sustain="0.294" pdel="0" userwavefile="" dec="0.453" lamt="0" syncmode="0" latt="0" rel="0.1" amt="1" x100="0" att="0" lpdel="0" hold="0" lshp="2" lspd="0.0997" ctlenvamt="0" lspd_numerator="4"/>
<elcut lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" syncmode="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lshp="2" lspd="0.001" ctlenvamt="0" lspd_numerator="4"/>
<elres lspd_denominator="4" sustain="0.5" pdel="0" userwavefile="" dec="0.5" lamt="0" syncmode="0" latt="0" rel="0.1" amt="0" x100="0" att="0" lpdel="0" hold="0.5" lshp="0" lspd="0.1" ctlenvamt="0" lspd_numerator="4"/>
</eldata>
<chordcreator chord="0" chordrange="1" chord-enabled="0"/>
<arpeggiator arptime="100" arprange="1" arptime_denominator="4" syncmode="0" arpmode="0" arp-enabled="0" arp="0" arptime_numerator="4" arpdir="0" arpgate="100"/>
<midiport inputcontroller="0" fixedoutputvelocity="-1" inputchannel="0" outputcontroller="0" writable="0" outputchannel="1" fixedinputvelocity="-1" fixedoutputnote="-1" outputprogram="1" basevelocity="63" readable="0"/>
<fxchain numofeffects="6" enabled="1">
<effect autoquit_numerator="4" autoquit_denominator="4" syncmode="0" autoquit="1" gate="0" name="ladspaeffect" wet="1" on="1">
<ladspacontrols ports="10">
<port02 data="0"/>
<port03 data="0"/>
<port04 data="2.07"/>
<port05 data="3.51"/>
<port06 data="-47.97"/>
<port07 data="-12.69"/>
<port08 data="-47.97"/>
<port09 data="-47.34"/>
<port010 data="-47.97"/>
<port011 data="9.99"/>
</ladspacontrols>
<key>
<attribute value="caps" name="file"/>
<attribute value="Eq2x2" name="plugin"/>
</key>
</effect>
<effect autoquit_numerator="4" autoquit_denominator="4" syncmode="0" autoquit="1" gate="0" name="ladspaeffect" wet="0.5" on="0">
<ladspacontrols ports="4">
<port02 data="0.370265"/>
<port03 data="0"/>
<port04 data="0.9995"/>
<port05 data="0.10875"/>
</ladspacontrols>
<key>
<attribute value="caps" name="file"/>
<attribute value="Plate2x2" name="plugin"/>
</key>
</effect>
<effect autoquit_numerator="4" autoquit_denominator="4" syncmode="0" autoquit="1" gate="0" name="ladspaeffect" wet="1" on="1">
<ladspacontrols ports="9">
<port07>
<data scale_type="log" value="0.4" id="6315252"/>
</port07>
<port08>
<data scale_type="log" value="2000.25" id="2498139"/>
</port08>
<port09 data="0"/>
<port010 data="1"/>
<port011 data="0.5"/>
<port012 data="1"/>
<port013 data="0"/>
<port014>
<data scale_type="log" value="659.34" id="5231681"/>
</port014>
<port015>
<data scale_type="log" value="4862.63" id="1579810"/>
</port015>
</ladspacontrols>
<key>
<attribute value="calf" name="file"/>
<attribute value="Reverb" name="plugin"/>
</key>
</effect>
<effect autoquit_numerator="4" autoquit_denominator="4" syncmode="0" autoquit="1" gate="0" name="ladspaeffect" wet="0.18" on="1">
<ladspacontrols ports="13">
<port04 data="0"/>
<port05 data="1.02375"/>
<port06 data="0.96"/>
<port07 data="0.50125"/>
<port012 data="5.049"/>
<port013 data="10"/>
<port015>
<data scale_type="log" value="20000" id="8103466"/>
</port015>
<port016>
<data scale_type="log" value="10" id="4889780"/>
</port016>
<port017>
<data scale_type="log" value="20000" id="6261168"/>
</port017>
<port018>
<data scale_type="log" value="10" id="4037431"/>
</port018>
<port019>
<data scale_type="log" value="215.82" id="6293968"/>
</port019>
<port020 data="15.9973"/>
<port021>
<data scale_type="log" value="0.9999" id="2846145"/>
</port021>
</ladspacontrols>
<key>
<attribute value="calf" name="file"/>
<attribute value="Saturator" name="plugin"/>
</key>
</effect>
<effect autoquit_numerator="4" autoquit_denominator="4" syncmode="0" autoquit="1" gate="0" name="ladspaeffect" wet="1" on="1">
<ladspacontrols ports="13">
<port04 data="0"/>
<port05 data="1.02375"/>
<port06 data="0.96"/>
<port07 data="1"/>
<port012 data="5.049"/>
<port013 data="10"/>
<port015>
<data scale_type="log" value="20000" id="7709628"/>
</port015>
<port016>
<data scale_type="log" value="10" id="7480205"/>
</port016>
<port017>
<data scale_type="log" value="20000" id="4036038"/>
</port017>
<port018>
<data scale_type="log" value="10" id="1042561"/>
</port018>
<port019>
<data scale_type="log" value="721.71" id="92193"/>
</port019>
<port020 data="1.31484"/>
<port021>
<data scale_type="log" value="0.100237" id="7520542"/>
</port021>
</ladspacontrols>
<key>
<attribute value="calf" name="file"/>
<attribute value="Saturator" name="plugin"/>
</key>
</effect>
<effect autoquit_numerator="4" autoquit_denominator="4" syncmode="0" autoquit="1" gate="0" name="ladspaeffect" wet="1" on="1">
<ladspacontrols ports="10">
<port02 data="-47.97"/>
<port03 data="-10.8"/>
<port04 data="0"/>
<port05 data="0"/>
<port06 data="0"/>
<port07 data="0"/>
<port08 data="0"/>
<port09 data="0"/>
<port010 data="0.72"/>
<port011 data="2.52"/>
</ladspacontrols>
<key>
<attribute value="caps" name="file"/>
<attribute value="Eq2x2" name="plugin"/>
</key>
</effect>
</fxchain>
</instrumenttrack>
</instrumenttracksettings>
</lmms-project>

View File

@@ -75,68 +75,69 @@ public:
inline void setCoeffs( float freq )
{
// wc
const float wc = F_2PI * freq;
const float wc2 = wc * wc;
const float wc3 = wc2 * wc;
const double wc = D_2PI * freq;
const double wc2 = wc * wc;
const double wc3 = wc2 * wc;
m_wc4 = wc2 * wc2;
// k
const float k = wc / tanf( F_PI * freq / m_sampleRate );
const float k2 = k * k;
const float k3 = k2 * k;
const double k = wc / tan( D_PI * freq / m_sampleRate );
const double k2 = k * k;
const double k3 = k2 * k;
m_k4 = k2 * k2;
// a
static const float sqrt2 = sqrtf( 2.0f );
const float sq_tmp1 = sqrt2 * wc3 * k;
const float sq_tmp2 = sqrt2 * wc * k3;
m_a = 4.0f * wc2 * k2 + 2.0f * sq_tmp1 + m_k4 + 2.0f * sq_tmp2 + m_wc4;
static const double sqrt2 = sqrt( 2.0 );
const double sq_tmp1 = sqrt2 * wc3 * k;
const double sq_tmp2 = sqrt2 * wc * k3;
m_a = 1.0 / ( 4.0 * wc2 * k2 + 2.0 * sq_tmp1 + m_k4 + 2.0 * sq_tmp2 + m_wc4 );
// b
m_b1 = ( 4.0f * ( m_wc4 + sq_tmp1 - m_k4 - sq_tmp2 ) ) / m_a;
m_b2 = ( 6.0f * m_wc4 - 8.0f * wc2 * k2 + 6.0f * m_k4 ) / m_a;
m_b3 = ( 4.0f * ( m_wc4 - sq_tmp1 + sq_tmp2 - m_k4 ) ) / m_a;
m_b4 = ( m_k4 - 2.0f * sq_tmp1 + m_wc4 - 2.0f * sq_tmp2 + 4.0f * wc2 * k2 ) / m_a;
m_b1 = ( 4.0 * ( m_wc4 + sq_tmp1 - m_k4 - sq_tmp2 ) ) * m_a;
m_b2 = ( 6.0 * m_wc4 - 8.0 * wc2 * k2 + 6.0 * m_k4 ) * m_a;
m_b3 = ( 4.0 * ( m_wc4 - sq_tmp1 + sq_tmp2 - m_k4 ) ) * m_a;
m_b4 = ( m_k4 - 2.0 * sq_tmp1 + m_wc4 - 2.0 * sq_tmp2 + 4.0 * wc2 * k2 ) * m_a;
}
inline void setLowpass( float freq )
{
setCoeffs( freq );
m_a0 = m_wc4 / m_a;
m_a1 = 4.0f * m_a0;
m_a2 = 6.0f * m_a0;
m_a0 = m_wc4 * m_a;
m_a1 = 4.0 * m_a0;
m_a2 = 6.0 * m_a0;
}
inline void setHighpass( float freq )
{
setCoeffs( freq );
m_a0 = m_k4 / m_a;
m_a1 = 4.0f * m_a0;
m_a2 = 6.0f * m_a0;
m_a0 = m_k4 * m_a;
m_a1 = -4.0 * m_a0;
m_a2 = 6.0 * m_a0;
}
inline float update( float in, ch_cnt_t ch )
{
const float a0in = m_a0 * in;
const float a1in = m_a1 * in;
const float out = m_z1[ch] + a0in;
const double x = in - ( m_z1[ch] * m_b1 ) - ( m_z2[ch] * m_b2 ) -
( m_z3[ch] * m_b3 ) - ( m_z4[ch] * m_b4 );
const double y = ( m_a0 * x ) + ( m_z1[ch] * m_a1 ) + ( m_z2[ch] * m_a2 ) +
( m_z3[ch] * m_a1 ) + ( m_z4[ch] * m_a0 );
m_z4[ch] = m_z3[ch];
m_z3[ch] = m_z2[ch];
m_z2[ch] = m_z1[ch];
m_z1[ch] = x;
m_z1[ch] = a1in + m_z2[ch] - ( m_b1 * out );
m_z2[ch] = ( m_a2 * in ) + m_z3[ch] - ( m_b2 * out );
m_z3[ch] = a1in + m_z4[ch] - ( m_b3 * out );
m_z4[ch] = a0in - ( m_b4 * out );
return out;
return y;
}
private:
float m_sampleRate;
float m_wc4;
float m_k4;
float m_a, m_a0, m_a1, m_a2;
float m_b1, m_b2, m_b3, m_b4;
double m_wc4;
double m_k4;
double m_a, m_a0, m_a1, m_a2;
double m_b1, m_b2, m_b3, m_b4;
typedef float frame[CHANNELS];
typedef double frame[CHANNELS];
frame m_z1, m_z2, m_z3, m_z4;
};
typedef LinkwitzRiley<2> StereoLinkwitzRiley;

View File

@@ -103,7 +103,7 @@ private:
float fRange = m_model->maxValue() - m_model->minValue();
float realVal = m_model->value() - m_model->minValue();
return height() - ( ( height() - ( *s_knob ).height() ) * ( realVal / fRange ) );
return height() - ( ( height() - m_knob->height() ) * ( realVal / fRange ) );
}
FloatModel * m_model;

View File

@@ -25,15 +25,28 @@
#ifndef LMMS_CONSTANTS_H
#define LMMS_CONSTANTS_H
const double D_PI = 3.14159265358979323846;
const double D_2PI = D_PI * 2.0;
const double D_PI_2 = D_PI * 0.5;
const double D_E = 2.71828182845904523536;
const long double LD_PI = 3.14159265358979323846264338327950288419716939937510;
const long double LD_2PI = LD_PI * 2.0;
const long double LD_PI_2 = LD_PI * 0.5;
const long double LD_PI_R = 1.0 / LD_PI;
const long double LD_PI_SQR = LD_PI * LD_PI;
const long double LD_E = 2.71828182845904523536028747135266249775724709369995;
const long double LD_E_R = 1.0 / LD_E;
const float F_PI = (float) D_PI;
const float F_2PI = (float) D_2PI;
const float F_PI_2 = (float) D_PI_2;
const float F_E = (float) D_E;
const double D_PI = (double) LD_PI;
const double D_2PI = (double) LD_2PI;
const double D_PI_2 = (double) LD_PI_2;
const double D_PI_R = (double) LD_PI_R;
const double D_PI_SQR = (double) LD_PI_SQR;
const double D_E = (double) LD_E;
const double D_E_R = (double) LD_E_R;
const float F_PI = (float) LD_PI;
const float F_2PI = (float) LD_2PI;
const float F_PI_2 = (float) LD_PI_2;
const float F_PI_R = (float) LD_PI_R;
const float F_PI_SQR = (float) LD_PI_SQR;
const float F_E = (float) LD_E;
const float F_E_R = (float) LD_E_R;
#endif

View File

@@ -289,4 +289,18 @@ static inline float fastSqrt( float n )
return u.f;
}
//! returns value furthest from zero
template<class T>
static inline T absMax( T a, T b )
{
return qAbs<T>(a) > qAbs<T>(b) ? a : b;
}
//! returns value nearest to zero
template<class T>
static inline T absMin( T a, T b )
{
return qAbs<T>(a) < qAbs<T>(b) ? a : b;
}
#endif

View File

@@ -30,6 +30,8 @@ const int OS_RATE = 5;
const float OS_RATIO = 1.0f / OS_RATE;
const float CUTOFF_RATIO = 0.353553391f;
const int SILENCEFRAMES = 10;
const float OS_RESAMPLE [5] = { 0.0001490062883964112, 0.1645978376763992, 0.6705063120704088,
0.1645978376763992, 0.0001490062883964112 };
extern "C"
{
@@ -78,7 +80,7 @@ void BitcrushEffect::sampleRateChanged()
{
m_sampleRate = Engine::mixer()->processingSampleRate();
m_filter.setSampleRate( m_sampleRate );
m_filter.setLowpass( m_sampleRate * CUTOFF_RATIO );
m_filter.setLowpass( m_sampleRate * ( CUTOFF_RATIO * OS_RATIO ) );
m_needsUpdate = true;
}
@@ -95,6 +97,11 @@ inline float BitcrushEffect::noise( float amt )
bool BitcrushEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
{
if( !isEnabled() || !isRunning () )
{
return( false );
}
// update values
if( m_needsUpdate || m_controls.m_rateEnabled.isValueChanged() )
{
@@ -219,8 +226,8 @@ bool BitcrushEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
float rsum = 0.0f;
for( int o = 0; o < OS_RATE; ++o )
{
lsum += m_buffer[f * OS_RATE + o][0] * OS_RATIO;
rsum += m_buffer[f * OS_RATE + o][1] * OS_RATIO;
lsum += m_buffer[f * OS_RATE + o][0] * OS_RESAMPLE[o];
rsum += m_buffer[f * OS_RATE + o][1] * OS_RESAMPLE[o];
}
buf[f][0] = d * buf[f][0] + w * qBound( -m_outClip, lsum, m_outClip ) * m_outGain;
buf[f][1] = d * buf[f][1] + w * qBound( -m_outClip, rsum, m_outClip ) * m_outGain;

View File

@@ -6,6 +6,7 @@ ADD_SUBDIRECTORY(Bitcrush)
ADD_SUBDIRECTORY(carlabase)
ADD_SUBDIRECTORY(carlapatchbay)
ADD_SUBDIRECTORY(carlarack)
ADD_SUBDIRECTORY(CrossoverEQ)
ADD_SUBDIRECTORY(delay)
ADD_SUBDIRECTORY(DualFilter)
ADD_SUBDIRECTORY(dynamics_processor)

View File

@@ -0,0 +1,3 @@
INCLUDE(BuildPlugin)
BUILD_PLUGIN(crossovereq CrossoverEQ.cpp CrossoverEQControls.cpp CrossoverEQControlDialog.cpp MOCFILES CrossoverEQControls.h CrossoverEQControlDialog.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")

View File

@@ -0,0 +1,219 @@
/*
* CrossoverEQ.cpp - A native 4-band Crossover Equalizer
* good for simulating tonestacks or simple peakless (flat-band) equalization
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "CrossoverEQ.h"
#include "lmms_math.h"
#include "embed.cpp"
extern "C"
{
Plugin::Descriptor PLUGIN_EXPORT crossovereq_plugin_descriptor =
{
STRINGIFY( PLUGIN_NAME ),
"Crossover Equalizer",
QT_TRANSLATE_NOOP( "pluginBrowser", "A 4-band Crossover Equalizer" ),
"Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>",
0x0100,
Plugin::Effect,
new PluginPixmapLoader( "logo" ),
NULL,
NULL
};
}
CrossoverEQEffect::CrossoverEQEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key ) :
Effect( &crossovereq_plugin_descriptor, parent, key ),
m_controls( this ),
m_sampleRate( Engine::mixer()->processingSampleRate() ),
m_lp1( m_sampleRate ),
m_lp2( m_sampleRate ),
m_lp3( m_sampleRate ),
m_hp2( m_sampleRate ),
m_hp3( m_sampleRate ),
m_hp4( m_sampleRate ),
m_needsUpdate( true )
{
m_tmp1 = MM_ALLOC( sampleFrame, Engine::mixer()->framesPerPeriod() );
m_tmp2 = MM_ALLOC( sampleFrame, Engine::mixer()->framesPerPeriod() );
m_work = MM_ALLOC( sampleFrame, Engine::mixer()->framesPerPeriod() );
}
CrossoverEQEffect::~CrossoverEQEffect()
{
MM_FREE( m_tmp1 );
MM_FREE( m_tmp2 );
MM_FREE( m_work );
}
void CrossoverEQEffect::sampleRateChanged()
{
m_sampleRate = Engine::mixer()->processingSampleRate();
m_lp1.setSampleRate( m_sampleRate );
m_lp2.setSampleRate( m_sampleRate );
m_lp3.setSampleRate( m_sampleRate );
m_hp2.setSampleRate( m_sampleRate );
m_hp3.setSampleRate( m_sampleRate );
m_hp4.setSampleRate( m_sampleRate );
m_needsUpdate = true;
}
bool CrossoverEQEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
{
if( !isEnabled() || !isRunning () )
{
return( false );
}
// filters update
if( m_needsUpdate || m_controls.m_xover12.isValueChanged() )
{
m_lp1.setLowpass( m_controls.m_xover12.value() );
m_lp1.clearHistory();
m_hp2.setHighpass( m_controls.m_xover12.value() );
m_hp2.clearHistory();
}
if( m_needsUpdate || m_controls.m_xover23.isValueChanged() )
{
m_lp2.setLowpass( m_controls.m_xover23.value() );
m_lp2.clearHistory();
m_hp3.setHighpass( m_controls.m_xover23.value() );
m_hp3.clearHistory();
}
if( m_needsUpdate || m_controls.m_xover34.isValueChanged() )
{
m_lp3.setLowpass( m_controls.m_xover34.value() );
m_lp3.clearHistory();
m_hp4.setHighpass( m_controls.m_xover34.value() );
m_hp4.clearHistory();
}
// gain values update
if( m_needsUpdate || m_controls.m_gain1.isValueChanged() )
{
m_gain1 = dbvToAmp( m_controls.m_gain1.value() );
}
if( m_needsUpdate || m_controls.m_gain2.isValueChanged() )
{
m_gain2 = dbvToAmp( m_controls.m_gain2.value() );
}
if( m_needsUpdate || m_controls.m_gain3.isValueChanged() )
{
m_gain3 = dbvToAmp( m_controls.m_gain3.value() );
}
if( m_needsUpdate || m_controls.m_gain4.isValueChanged() )
{
m_gain4 = dbvToAmp( m_controls.m_gain4.value() );
}
// mute values update
const bool mute1 = m_controls.m_mute1.value();
const bool mute2 = m_controls.m_mute2.value();
const bool mute3 = m_controls.m_mute3.value();
const bool mute4 = m_controls.m_mute4.value();
m_needsUpdate = false;
memset( m_work, 0, sizeof( sampleFrame ) * frames );
// run temp bands
for( int f = 0; f < frames; ++f )
{
m_tmp1[f][0] = m_lp2.update( buf[f][0], 0 );
m_tmp1[f][1] = m_lp2.update( buf[f][1], 1 );
m_tmp2[f][0] = m_hp3.update( buf[f][0], 0 );
m_tmp2[f][1] = m_hp3.update( buf[f][1], 1 );
}
// run band 1
if( ! mute1 )
{
for( int f = 0; f < frames; ++f )
{
m_work[f][0] += m_lp1.update( m_tmp1[f][0], 0 ) * m_gain1;
m_work[f][1] += m_lp1.update( m_tmp1[f][1], 1 ) * m_gain1;
}
}
// run band 2
if( ! mute2 )
{
for( int f = 0; f < frames; ++f )
{
m_work[f][0] += m_hp2.update( m_tmp1[f][0], 0 ) * m_gain2;
m_work[f][1] += m_hp2.update( m_tmp1[f][1], 1 ) * m_gain2;
}
}
// run band 3
if( ! mute3 )
{
for( int f = 0; f < frames; ++f )
{
m_work[f][0] += m_lp3.update( m_tmp2[f][0], 0 ) * m_gain3;
m_work[f][1] += m_lp3.update( m_tmp2[f][1], 1 ) * m_gain3;
}
}
// run band 4
if( ! mute4 )
{
for( int f = 0; f < frames; ++f )
{
m_work[f][0] += m_hp4.update( m_tmp2[f][0], 0 ) * m_gain4;
m_work[f][1] += m_hp4.update( m_tmp2[f][1], 1 ) * m_gain4;
}
}
const float d = dryLevel();
const float w = wetLevel();
double outSum = 0.0;
for( int f = 0; f < frames; ++f )
{
buf[f][0] = d * buf[f][0] + w * m_work[f][0];
buf[f][1] = d * buf[f][1] + w * m_work[f][1];
outSum = buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1];
}
checkGate( outSum );
return isRunning();
}
extern "C"
{
// necessary for getting instance out of shared lib
Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data )
{
return new CrossoverEQEffect( parent, static_cast<const Plugin::Descriptor::SubPluginFeatures::Key *>( data ) );
}
}

View File

@@ -0,0 +1,77 @@
/*
* CrossoverEQ.h - A native 4-band Crossover Equalizer
* good for simulating tonestacks or simple peakless (flat-band) equalization
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef CROSSOVEREQ_H
#define CROSSOVEREQ_H
#include "Effect.h"
#include "CrossoverEQControls.h"
#include "ValueBuffer.h"
#include "lmms_math.h"
#include "BasicFilters.h"
class CrossoverEQEffect : public Effect
{
public:
CrossoverEQEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key );
virtual ~CrossoverEQEffect();
virtual bool processAudioBuffer( sampleFrame* buf, const fpp_t frames );
virtual EffectControls* controls()
{
return &m_controls;
}
private:
CrossoverEQControls m_controls;
void sampleRateChanged();
float m_sampleRate;
float m_gain1;
float m_gain2;
float m_gain3;
float m_gain4;
StereoLinkwitzRiley m_lp1;
StereoLinkwitzRiley m_lp2;
StereoLinkwitzRiley m_lp3;
StereoLinkwitzRiley m_hp2;
StereoLinkwitzRiley m_hp3;
StereoLinkwitzRiley m_hp4;
sampleFrame * m_tmp1;
sampleFrame * m_tmp2;
sampleFrame * m_work;
bool m_needsUpdate;
friend class CrossoverEQControls;
};
#endif

View File

@@ -0,0 +1,115 @@
/*
* CrossoverEQControlDialog.cpp - A native 4-band Crossover Equalizer
* good for simulating tonestacks or simple peakless (flat-band) equalization
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include <QLayout>
#include <QLabel>
#include "CrossoverEQControlDialog.h"
#include "CrossoverEQControls.h"
#include "embed.h"
#include "ToolTip.h"
#include "LedCheckbox.h"
#include "Knob.h"
#include "Fader.h"
CrossoverEQControlDialog::CrossoverEQControlDialog( CrossoverEQControls * controls ) :
EffectControlDialog( controls )
{
setAutoFillBackground( true );
QPalette pal;
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) );
setPalette( pal );
setFixedSize( 167, 188 );
// knobs
Knob * xover12 = new Knob( knobBright_26, this );
xover12->move( 29, 15 );
xover12->setModel( & controls->m_xover12 );
xover12->setLabel( "1/2" );
xover12->setHintText( tr( "Band 1/2 Crossover:" ), " Hz" );
Knob * xover23 = new Knob( knobBright_26, this );
xover23->move( 69, 15 );
xover23->setModel( & controls->m_xover23 );
xover23->setLabel( "2/3" );
xover23->setHintText( tr( "Band 2/3 Crossover:" ), " Hz" );
Knob * xover34 = new Knob( knobBright_26, this );
xover34->move( 109, 15 );
xover34->setModel( & controls->m_xover34 );
xover34->setLabel( "3/4" );
xover34->setHintText( tr( "Band 3/4 Crossover:" ), " Hz" );
m_fader_bg = QPixmap( PLUGIN_NAME::getIconPixmap( "fader_bg" ) );
m_fader_empty = QPixmap( PLUGIN_NAME::getIconPixmap( "fader_empty" ) );
m_fader_knob = QPixmap( PLUGIN_NAME::getIconPixmap( "fader_knob2" ) );
// faders
Fader * gain1 = new Fader( &controls->m_gain1, "Band 1 Gain", this,
&m_fader_bg, &m_fader_empty, &m_fader_knob );
gain1->move( 7, 56 );
gain1->setDisplayConversion( false );
gain1->setHintText( tr( "Band 1 Gain:" ), " dBV" );
Fader * gain2 = new Fader( &controls->m_gain2, "Band 2 Gain", this,
&m_fader_bg, &m_fader_empty, &m_fader_knob );
gain2->move( 47, 56 );
gain2->setDisplayConversion( false );
gain2->setHintText( tr( "Band 2 Gain:" ), " dBV" );
Fader * gain3 = new Fader( &controls->m_gain3, "Band 3 Gain", this,
&m_fader_bg, &m_fader_empty, &m_fader_knob );
gain3->move( 87, 56 );
gain3->setDisplayConversion( false );
gain3->setHintText( tr( "Band 3 Gain:" ), " dBV" );
Fader * gain4 = new Fader( &controls->m_gain4, "Band 4 Gain", this,
&m_fader_bg, &m_fader_empty, &m_fader_knob );
gain4->move( 127, 56 );
gain4->setDisplayConversion( false );
gain4->setHintText( tr( "Band 4 Gain:" ), " dBV" );
// leds
LedCheckBox * mute1 = new LedCheckBox( "M", this, tr( "Band 1 Mute" ), LedCheckBox::Red );
mute1->move( 11, 158 );
mute1->setModel( & controls->m_mute1 );
ToolTip::add( mute1, tr( "Mute Band 1" ) );
LedCheckBox * mute2 = new LedCheckBox( "M", this, tr( "Band 2 Mute" ), LedCheckBox::Red );
mute2->move( 51, 158 );
mute2->setModel( & controls->m_mute2 );
ToolTip::add( mute2, tr( "Mute Band 2" ) );
LedCheckBox * mute3 = new LedCheckBox( "M", this, tr( "Band 3 Mute" ), LedCheckBox::Red );
mute3->move( 91, 158 );
mute3->setModel( & controls->m_mute3 );
ToolTip::add( mute3, tr( "Mute Band 3" ) );
LedCheckBox * mute4 = new LedCheckBox( "M", this, tr( "Band 4 Mute" ), LedCheckBox::Red );
mute4->move( 131, 158 );
mute4->setModel( & controls->m_mute4 );
ToolTip::add( mute4, tr( "Mute Band 4" ) );
}

View File

@@ -0,0 +1,50 @@
/*
* CrossoverEQControlDialog.h - A native 4-band Crossover Equalizer
* good for simulating tonestacks or simple peakless (flat-band) equalization
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef CROSSOVEREQ_CONTROL_DIALOG_H
#define CROSSOVEREQ_CONTROL_DIALOG_H
#include <QPixmap>
#include "EffectControlDialog.h"
class CrossoverEQControls;
class CrossoverEQControlDialog : public EffectControlDialog
{
Q_OBJECT
public:
CrossoverEQControlDialog( CrossoverEQControls * controls );
virtual ~CrossoverEQControlDialog()
{
}
private:
QPixmap m_fader_bg;
QPixmap m_fader_empty;
QPixmap m_fader_knob;
};
#endif

View File

@@ -0,0 +1,116 @@
/*
* CrossoverEQControls.cpp - A native 4-band Crossover Equalizer
* good for simulating tonestacks or simple peakless (flat-band) equalization
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "CrossoverEQControls.h"
#include "CrossoverEQ.h"
CrossoverEQControls::CrossoverEQControls( CrossoverEQEffect * eff ) :
EffectControls( eff ),
m_effect( eff ),
m_xover12( 125.f, 50.f, 10000.f, 1.0f, this, "Band 1/2 Crossover" ),
m_xover23( 1250.f, 50.f, 20000.f, 1.0f, this, "Band 2/3 Crossover" ),
m_xover34( 5000.f, 50.f, 20000.f, 1.0f, this, "Band 3/4 Crossover" ),
m_gain1( 0.f, -60.f, 30.f, 0.1f, this, "Band 1 Gain" ),
m_gain2( 0.f, -60.f, 30.f, 0.1f, this, "Band 2 Gain" ),
m_gain3( 0.f, -60.f, 30.f, 0.1f, this, "Band 3 Gain" ),
m_gain4( 0.f, -60.f, 30.f, 0.1f, this, "Band 4 Gain" ),
m_mute1( false, this, "Mute Band 1" ),
m_mute2( false, this, "Mute Band 2" ),
m_mute3( false, this, "Mute Band 3" ),
m_mute4( false, this, "Mute Band 4" )
{
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
connect( &m_xover12, SIGNAL( dataChanged() ), this, SLOT( xover12Changed() ) );
connect( &m_xover23, SIGNAL( dataChanged() ), this, SLOT( xover23Changed() ) );
connect( &m_xover34, SIGNAL( dataChanged() ), this, SLOT( xover34Changed() ) );
m_xover12.setScaleLogarithmic( true );
m_xover23.setScaleLogarithmic( true );
m_xover34.setScaleLogarithmic( true );
}
void CrossoverEQControls::saveSettings( QDomDocument & doc, QDomElement & elem )
{
m_xover12.saveSettings( doc, elem, "xover12" );
m_xover23.saveSettings( doc, elem, "xover23" );
m_xover34.saveSettings( doc, elem, "xover34" );
m_gain1.saveSettings( doc, elem, "gain1" );
m_gain2.saveSettings( doc, elem, "gain2" );
m_gain3.saveSettings( doc, elem, "gain3" );
m_gain4.saveSettings( doc, elem, "gain4" );
m_mute1.saveSettings( doc, elem, "mute1" );
m_mute2.saveSettings( doc, elem, "mute2" );
m_mute3.saveSettings( doc, elem, "mute3" );
m_mute4.saveSettings( doc, elem, "mute4" );
}
void CrossoverEQControls::loadSettings( const QDomElement & elem )
{
m_xover12.loadSettings( elem, "xover12" );
m_xover23.loadSettings( elem, "xover23" );
m_xover34.loadSettings( elem, "xover34" );
m_gain1.loadSettings( elem, "gain1" );
m_gain2.loadSettings( elem, "gain2" );
m_gain3.loadSettings( elem, "gain3" );
m_gain4.loadSettings( elem, "gain4" );
m_mute1.loadSettings( elem, "mute1" );
m_mute2.loadSettings( elem, "mute2" );
m_mute3.loadSettings( elem, "mute3" );
m_mute4.loadSettings( elem, "mute4" );
m_effect->m_needsUpdate = true;
}
void CrossoverEQControls::xover12Changed()
{
float v = m_xover12.value();
if( m_xover23.value() < v ) { m_xover23.setValue( v ); }
if( m_xover34.value() < v ) { m_xover34.setValue( v ); }
}
void CrossoverEQControls::xover23Changed()
{
float v = m_xover23.value();
if( m_xover12.value() > v ) { m_xover12.setValue( v ); }
if( m_xover34.value() < v ) { m_xover34.setValue( v ); }
}
void CrossoverEQControls::xover34Changed()
{
float v = m_xover34.value();
if( m_xover12.value() > v ) { m_xover12.setValue( v ); }
if( m_xover23.value() > v ) { m_xover23.setValue( v ); }
}
void CrossoverEQControls::sampleRateChanged()
{
m_effect->sampleRateChanged();
}

View File

@@ -0,0 +1,86 @@
/*
* CrossoverEQControls.h - A native 4-band Crossover Equalizer
* good for simulating tonestacks or simple peakless (flat-band) equalization
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef CROSSOVEREQ_CONTROLS_H
#define CROSSOVEREQ_CONTROLS_H
#include "EffectControls.h"
#include "CrossoverEQControlDialog.h"
class CrossoverEQEffect;
class CrossoverEQControls : public EffectControls
{
Q_OBJECT
public:
CrossoverEQControls( CrossoverEQEffect * eff );
virtual ~CrossoverEQControls() {}
virtual void saveSettings( QDomDocument & doc, QDomElement & elem );
virtual void loadSettings( const QDomElement & elem );
inline virtual QString nodeName() const
{
return( "crossoevereqcontrols" );
}
virtual int controlCount()
{
return( 11 );
}
virtual EffectControlDialog * createView()
{
return( new CrossoverEQControlDialog( this ) );
}
private slots:
void xover12Changed();
void xover23Changed();
void xover34Changed();
void sampleRateChanged();
private:
CrossoverEQEffect * m_effect;
FloatModel m_xover12;
FloatModel m_xover23;
FloatModel m_xover34;
FloatModel m_gain1;
FloatModel m_gain2;
FloatModel m_gain3;
FloatModel m_gain4;
BoolModel m_mute1;
BoolModel m_mute2;
BoolModel m_mute3;
BoolModel m_mute4;
friend class CrossoverEQControlDialog;
friend class CrossoverEQEffect;
};
#endif

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

View File

@@ -39,7 +39,7 @@ DualFilterControls::DualFilterControls( DualFilterEffect* effect ) :
m_enabled1Model( true, this, tr( "Filter 1 enabled" ) ),
m_filter1Model( this, tr( "Filter 1 type" ) ),
m_cut1Model( 7000.0f, 1.0f, 14000.0f, 1.0f, this, tr( "Cutoff 1 frequency" ) ),
m_cut1Model( 7000.0f, 1.0f, 20000.0f, 1.0f, this, tr( "Cutoff 1 frequency" ) ),
m_res1Model( 0.5, BasicFilters<0>::minQ(), 10.0, 0.01, this, tr( "Q/Resonance 1" ) ),
m_gain1Model( 100.0f, 0.0f, 200.0f, 0.1f, this, tr( "Gain 1" ) ),
@@ -47,7 +47,7 @@ DualFilterControls::DualFilterControls( DualFilterEffect* effect ) :
m_enabled2Model( true, this, tr( "Filter 2 enabled" ) ),
m_filter2Model( this, tr( "Filter 2 type" ) ),
m_cut2Model( 7000.0f, 1.0f, 14000.0f, 1.0f, this, tr( "Cutoff 2 frequency" ) ),
m_cut2Model( 7000.0f, 1.0f, 20000.0f, 1.0f, this, tr( "Cutoff 2 frequency" ) ),
m_res2Model( 0.5, BasicFilters<0>::minQ(), 10.0, 0.01, this, tr( "Q/Resonance 2" ) ),
m_gain2Model( 100.0f, 0.0f, 200.0f, 0.1f, this, tr( "Gain 2" ) )
{

View File

@@ -251,16 +251,16 @@ intptr_t CarlaInstrument::handleDispatcher(const NativeHostDispatcherOpcode opco
switch (opcode)
{
case HOST_OPCODE_NULL:
case NATIVE_HOST_OPCODE_NULL:
break;
case HOST_OPCODE_UPDATE_PARAMETER:
case HOST_OPCODE_UPDATE_MIDI_PROGRAM:
case HOST_OPCODE_RELOAD_PARAMETERS:
case HOST_OPCODE_RELOAD_MIDI_PROGRAMS:
case HOST_OPCODE_RELOAD_ALL:
case NATIVE_HOST_OPCODE_UPDATE_PARAMETER:
case NATIVE_HOST_OPCODE_UPDATE_MIDI_PROGRAM:
case NATIVE_HOST_OPCODE_RELOAD_PARAMETERS:
case NATIVE_HOST_OPCODE_RELOAD_MIDI_PROGRAMS:
case NATIVE_HOST_OPCODE_RELOAD_ALL:
// nothing
break;
case HOST_OPCODE_UI_UNAVAILABLE:
case NATIVE_HOST_OPCODE_UI_UNAVAILABLE:
handleUiClosed();
break;
}
@@ -459,7 +459,7 @@ PluginView* CarlaInstrument::instantiateView(QWidget* parent)
void CarlaInstrument::sampleRateChanged()
{
fDescriptor->dispatcher(fHandle, PLUGIN_OPCODE_SAMPLE_RATE_CHANGED, 0, 0, nullptr, handleGetSampleRate());
fDescriptor->dispatcher(fHandle, NATIVE_PLUGIN_OPCODE_SAMPLE_RATE_CHANGED, 0, 0, nullptr, handleGetSampleRate());
}
// -------------------------------------------------------------------

View File

@@ -788,16 +788,18 @@ void lb302Synth::processNote( NotePlayHandle * _n )
void lb302Synth::play( sampleFrame * _working_buffer )
{
m_notesMutex.lock();
while( ! m_notes.isEmpty() )
{
processNote( m_notes.takeFirst() );
};
m_notesMutex.unlock();
const fpp_t frames = Engine::mixer()->framesPerPeriod();
process( _working_buffer, frames );
instrumentTrack()->processAudioBuffer( _working_buffer, frames, NULL );
release_frame = 0;
// release_frame = 0; //removed for issue # 1432
}

View File

@@ -497,7 +497,7 @@ void opl2instrument::loadPatch(unsigned char inst[14]) {
void opl2instrument::tuneEqual(int center, float Hz) {
float tmp;
for(int n=0; n<128; ++n) {
tmp = Hz*pow( 2, ( n - center ) / 12.0 + pitchbend / 1200.0 );
tmp = Hz*pow( 2.0, ( n - center ) * ( 1.0 / 12.0 ) + pitchbend * ( 1.0 / 1200.0 ) );
fnums[n] = Hz2fnum( tmp );
}
}
@@ -505,7 +505,7 @@ void opl2instrument::tuneEqual(int center, float Hz) {
// Find suitable F number in lowest possible block
int opl2instrument::Hz2fnum(float Hz) {
for(int block=0; block<8; ++block) {
unsigned int fnum = Hz * pow(2, 20-block) / 49716;
unsigned int fnum = Hz * pow( 2.0, 20.0 - (double)block ) * ( 1.0 / 49716.0 );
if(fnum<1023) {
return fnum + (block << 10);
}

View File

@@ -361,11 +361,11 @@ void papuInstrument::playNote( NotePlayHandle * _n,
//PRNG Frequency = (1048576 Hz / (ratio + 1)) / 2 ^ (shiftclockfreq + 1)
char sopt=0;
char ropt=1;
float fopt = 524288.0 / ( ropt * pow( 2, sopt+1 ) );
float fopt = 524288.0 / ( ropt * pow( 2.0, sopt + 1.0 ) );
float f;
for ( char s=0; s<16; s++ )
for ( char r=0; r<8; r++ ) {
f = 524288.0 / ( r * pow( 2, s+1 ) );
f = 524288.0 / ( r * pow( 2.0, s + 1.0 ) );
if( fabs( freq-fopt ) > fabs( freq-f ) ) {
fopt = f;
ropt = r;

View File

@@ -290,7 +290,13 @@ void ConfigManager::loadConfigFile()
node = node.nextSibling();
}
if( value( "paths", "artwork" ) != "" )
// don't use dated theme folders as they break the UI (i.e. 0.4 != 1.0, etc)
bool use_artwork_path =
root.attribute( "version" ).startsWith(
QString::number( LMMS_VERSION_MAJOR ) + "." +
QString::number( LMMS_VERSION_MINOR ) );
if( use_artwork_path && value( "paths", "artwork" ) != "" )
{
m_artworkDir = value( "paths", "artwork" );
if( !QDir( m_artworkDir ).exists() )

View File

@@ -100,7 +100,7 @@ inline void FxChannel::processed()
void FxChannel::incrementDeps()
{
m_dependenciesMet.ref();
if( m_dependenciesMet >= m_receives.size() )
if( m_dependenciesMet >= m_receives.size() && ! m_queued )
{
m_queued = true;
MixerWorkerThread::addJob( this );

View File

@@ -957,6 +957,7 @@ void SampleBuffer::visualize( QPainter & _p, const QRect & _dr,
_p.drawPolyline( l, nb_frames / fpp );
_p.drawPolyline( r, nb_frames / fpp );
delete[] l;
delete[] r;
}

View File

@@ -194,12 +194,13 @@ void FxMixerView::refreshDisplay()
for( int i = 1; i<m_fxChannelViews.size(); ++i )
{
chLayout->removeWidget(m_fxChannelViews[i]->m_fxLine);
m_racksLayout->removeWidget( m_fxChannelViews[i]->m_rackView );
delete m_fxChannelViews[i]->m_fader;
delete m_fxChannelViews[i]->m_muteBtn;
delete m_fxChannelViews[i]->m_soloBtn;
delete m_fxChannelViews[i]->m_fxLine;
delete m_fxChannelViews[i]->m_rackView;
delete m_fxChannelViews[i];
m_racksLayout->removeWidget( m_fxChannelViews[i]->m_rackView );
}
m_channelAreaWidget->adjustSize();
@@ -363,16 +364,15 @@ void FxMixerView::deleteChannel(int index)
// delete the view
chLayout->removeWidget(m_fxChannelViews[index]->m_fxLine);
m_racksLayout->removeWidget( m_fxChannelViews[index]->m_rackView );
delete m_fxChannelViews[index]->m_fader;
delete m_fxChannelViews[index]->m_muteBtn;
delete m_fxChannelViews[index]->m_soloBtn;
delete m_fxChannelViews[index]->m_fxLine;
delete m_fxChannelViews[index]->m_rackView;
delete m_fxChannelViews[index];
m_channelAreaWidget->adjustSize();
// delete the fx rack
m_racksLayout->removeWidget( m_fxChannelViews[index]->m_rackView );
// make sure every channel knows what index it is
for(int i=0; i<m_fxChannelViews.size(); ++i)
{

View File

@@ -70,6 +70,11 @@
#include "TextFloat.h"
#if QT_VERSION < 0x040800
#define MiddleButton MidButton
#endif
typedef AutomationPattern::timeMap timeMap;

View File

@@ -29,6 +29,8 @@
#include <QScrollArea>
#include "PluginBrowser.h"
#include <algorithm> // for std::sort
#include "embed.h"
#include "debug.h"
#include "templates.h"

View File

@@ -170,7 +170,7 @@ void Fader::mouseMoveEvent( QMouseEvent *mouseEvent )
{
int dy = m_moveStartPoint - mouseEvent->globalY();
float delta = dy * ( m_model->maxValue() - m_model->minValue() ) / (float) ( height() - ( *s_knob ).height() );
float delta = dy * ( m_model->maxValue() - m_model->minValue() ) / (float) ( height() - ( *m_knob ).height() );
model()->setValue( m_startValue + delta );
@@ -186,7 +186,7 @@ void Fader::mousePressEvent( QMouseEvent* mouseEvent )
if( mouseEvent->button() == Qt::LeftButton &&
! ( mouseEvent->modifiers() & Qt::ControlModifier ) )
{
if( mouseEvent->y() >= knobPosY() - ( *s_knob ).height() && mouseEvent->y() < knobPosY() )
if( mouseEvent->y() >= knobPosY() - ( *m_knob ).height() && mouseEvent->y() < knobPosY() )
{
updateTextFloat();
s_textFloat->show();
@@ -346,13 +346,16 @@ void Fader::paintEvent( QPaintEvent * ev)
// background
painter.drawPixmap( ev->rect(), *m_back, ev->rect() );
// peak leds
//float fRange = abs( m_fMaxPeak ) + abs( m_fMinPeak );
int height = m_back->height();
int width = m_back->width() / 2;
int center = m_back->width() - width;
int peak_L = calculateDisplayPeak( m_fPeakValue_L - m_fMinPeak );
int persistentPeak_L = qMax<int>( 3, calculateDisplayPeak( m_persistentPeak_L - m_fMinPeak ) );
painter.drawPixmap( QRect( 0, peak_L, 11, 116 - peak_L ), *m_leds, QRect( 0, peak_L, 11, 116 - peak_L ) );
painter.drawPixmap( QRect( 0, peak_L, width, height - peak_L ), *m_leds, QRect( 0, peak_L, width, height - peak_L ) );
if( m_persistentPeak_L > 0.05 )
{
@@ -363,7 +366,7 @@ void Fader::paintEvent( QPaintEvent * ev)
int peak_R = calculateDisplayPeak( m_fPeakValue_R - m_fMinPeak );
int persistentPeak_R = qMax<int>( 3, calculateDisplayPeak( m_persistentPeak_R - m_fMinPeak ) );
painter.drawPixmap( QRect( 11, peak_R, 11, 116 - peak_R ), *m_leds, QRect( 11, peak_R, 11, 116 - peak_R ) );
painter.drawPixmap( QRect( center, peak_R, width, height - peak_R ), *m_leds, QRect( center, peak_R, width, height - peak_R ) );
if( m_persistentPeak_R > 0.05 )
{
@@ -373,7 +376,7 @@ void Fader::paintEvent( QPaintEvent * ev)
}
// knob
painter.drawPixmap( 0, knobPosY() - ( *m_knob ).height(), *s_knob );
painter.drawPixmap( 0, knobPosY() - m_knob->height(), *m_knob );
}

View File

@@ -87,7 +87,7 @@ const char * volume_help = QT_TRANSLATE_NOOP( "InstrumentTrack",
const int INSTRUMENT_WIDTH = 254;
const int INSTRUMENT_HEIGHT = INSTRUMENT_WIDTH;
const int PIANO_HEIGHT = 84;
const int PIANO_HEIGHT = 82;
const int INSTRUMENT_WINDOW_CACHE_SIZE = 8;