Merge branch 'master' into ed_refac

Conflicts:
	include/AutomationEditor.h
	include/SongEditor.h
	plugins/delay/delaycontrols.cpp
	plugins/delay/delaycontrolsdialog.cpp
	src/gui/editors/AutomationEditor.cpp
	src/gui/editors/BBEditor.cpp
	src/gui/editors/PianoRoll.cpp
This commit is contained in:
Lukas W
2015-01-06 23:05:13 +01:00
124 changed files with 3809 additions and 694 deletions

View File

@@ -35,13 +35,15 @@
class EffectChain;
class FloatModel;
class BoolModel;
class AudioPort : public ThreadableJob
{
MM_OPERATORS
public:
AudioPort( const QString & _name, bool _has_effect_chain = true,
FloatModel * volumeModel = NULL, FloatModel * panningModel = NULL );
AudioPort( const QString & _name, bool _has_effect_chain = true,
FloatModel * volumeModel = NULL, FloatModel * panningModel = NULL,
BoolModel * mutedModel = NULL );
virtual ~AudioPort();
inline sampleFrame * buffer()
@@ -117,14 +119,15 @@ private:
fx_ch_t m_nextFxChannel;
QString m_name;
EffectChain * m_effects;
PlayHandleList m_playHandles;
QMutex m_playHandleLock;
FloatModel * m_volumeModel;
FloatModel * m_panningModel;
BoolModel * m_mutedModel;
friend class Mixer;
friend class MixerWorkerThread;

View File

@@ -131,6 +131,9 @@ protected slots:
void setEditMode(AutomationEditor::EditModes mode);
void setEditMode(int mode);
void flipYButtonPressed();
void flipXButtonPressed();
void setProgressionType(AutomationPattern::ProgressionTypes type);
void setProgressionType(int type);
void setTension();
@@ -176,6 +179,8 @@ private:
static QPixmap * s_toolErase;
static QPixmap * s_toolSelect;
static QPixmap * s_toolMove;
static QPixmap * s_toolYFlip;
static QPixmap * s_toolXFlip;
ComboBoxModel m_zoomingXModel;
ComboBoxModel m_zoomingYModel;
@@ -281,6 +286,9 @@ private:
QAction* m_linearAction;
QAction* m_cubicHermiteAction;
ToolButton * m_flipYButton;
ToolButton * m_flipXButton;
Knob * m_tensionKnob;
ComboBox * m_zoomingXComboBox;

View File

@@ -158,6 +158,8 @@ public:
public slots:
void clear();
void objectDestroyed( jo_id_t );
void flipY( int min, int max );
void flipX( int length = -1 );
private:
void cleanObjects();

View File

@@ -51,6 +51,8 @@ protected slots:
void changeName();
void disconnectObject( QAction * _a );
void toggleRecording();
void flipY();
void flipX();
protected:
virtual void constructContextMenu( QMenu * );

View File

@@ -57,6 +57,9 @@ public slots:
void play();
void stop();
protected:
virtual void closeEvent( QCloseEvent * _ce );
private:
BBTrackContainerView* m_trackContainerView;
ComboBox * m_bbComboBox;

View File

@@ -26,6 +26,7 @@
#define CONTROLLER_RACK_VIEW_H
#include <QWidget>
#include <QCloseEvent>
#include "SerializingObject.h"
#include "lmms_basics.h"
@@ -56,6 +57,8 @@ public:
public slots:
void deleteController( ControllerView * _view );
protected:
virtual void closeEvent( QCloseEvent * _ce );
private slots:
virtual void update();

363
include/Delay.h Normal file
View File

@@ -0,0 +1,363 @@
/*
* Delay.h - Delay effect objects to use as building blocks in DSP
*
* 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 DELAY_H
#define DELAY_H
#include "lmms_basics.h"
#include "lmms_math.h"
#include "interpolation.h"
#include "MemoryManager.h"
// brief usage
// Classes:
// CombFeedback: a feedback comb filter - basically a simple delay line, makes a comb shape in the freq response
// CombFeedfwd: a feed-forward comb filter - an "inverted" comb filter, can be combined with CombFeedback to create a net allpass if negative gain is used
// CombFeedbackDualtap: same as CombFeedback but takes two delay values
// AllpassDelay: an allpass delay - combines feedback and feed-forward - has flat frequency response
// all classes are templated with channel count, any arbitrary channel count can be used for each fx
// Methods (for all classes):
// setDelay sets delay amount in frames. It's up to you to make this samplerate-agnostic.
// Fractions are allowed - linear interpolation is used to deal with them
// CombFeedbackDualTap is a special case: it requires 2 delay times
// setMaxDelay (re)sets the maximum allowed delay, in frames
// NOTE: for performance reasons, there's no bounds checking at setDelay, so make sure you set maxDelay >= delay!
// clearHistory clears the delay buffer
// setGain sets the feedback/feed-forward gain, in linear amplitude, negative values are allowed
// 1.0 is full feedback/feed-forward, -1.0 is full negative feedback/feed-forward
// update runs the fx for one frame - takes as arguments input and number of channel to run, returns output
template<ch_cnt_t CHANNELS>
class CombFeedback
{
public:
typedef double frame[CHANNELS];
CombFeedback( int maxDelay ) :
m_size( maxDelay ),
m_position( 0 ),
m_feedBack( 0.0 ),
m_delay( 0 ),
m_fraction( 0.0 )
{
m_buffer = MM_ALLOC( frame, maxDelay );
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
virtual ~CombFeedback()
{
MM_FREE( m_buffer );
}
inline void setMaxDelay( int maxDelay )
{
if( maxDelay > m_size )
{
MM_FREE( m_buffer );
m_buffer = MM_ALLOC( frame, maxDelay );
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
m_size = maxDelay;
m_position %= m_size;
}
inline void clearHistory()
{
memset( m_buffer, 0, sizeof( frame ) * m_size );
}
inline void setDelay( double delay )
{
m_delay = static_cast<int>( ceil( delay ) );
m_fraction = 1.0 - ( delay - floor( delay ) );
}
inline void setGain( double gain )
{
m_gain = gain;
}
inline double update( double in, ch_cnt_t ch )
{
int readPos = m_position - m_delay;
if( readPos < 0 ) { readPos += m_size; }
const double y = linearInterpolate( m_buffer[readPos][ch], m_buffer[( readPos + 1 ) % m_size][ch], m_fraction );
++m_position %= m_size;
m_buffer[m_position][ch] = in + m_gain * y;
return y;
}
private:
frame * m_buffer;
int m_size;
int m_position;
double m_gain;
int m_delay;
double m_fraction;
};
template<ch_cnt_t CHANNELS>
class CombFeedfwd
{
typedef double frame[CHANNELS];
CombFeedfwd( int maxDelay ) :
m_size( maxDelay ),
m_position( 0 ),
m_feedBack( 0.0 ),
m_delay( 0 ),
m_fraction( 0.0 )
{
m_buffer = MM_ALLOC( frame, maxDelay );
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
virtual ~CombFeedfwd()
{
MM_FREE( m_buffer );
}
inline void setMaxDelay( int maxDelay )
{
if( maxDelay > m_size )
{
MM_FREE( m_buffer );
m_buffer = MM_ALLOC( frame, maxDelay );
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
m_size = maxDelay;
m_position %= m_size;
}
inline void clearHistory()
{
memset( m_buffer, 0, sizeof( frame ) * m_size );
}
inline void setDelay( double delay )
{
m_delay = static_cast<int>( ceil( delay ) );
m_fraction = 1.0 - ( delay - floor( delay ) );
}
inline void setGain( double gain )
{
m_gain = gain;
}
inline double update( double in, ch_cnt_t ch )
{
int readPos = m_position - m_delay;
if( readPos < 0 ) { readPos += m_size; }
const double y = linearInterpolate( m_buffer[readPos][ch], m_buffer[( readPos + 1 ) % m_size][ch], m_fraction ) + in * m_gain;
++m_position %= m_size;
m_buffer[m_position][ch] = in;
return y;
}
private:
frame * m_buffer;
int m_size;
int m_position;
double m_gain;
int m_delay;
double m_fraction;
};
template<ch_cnt_t CHANNELS>
class CombFeedbackDualtap
{
typedef double frame[CHANNELS];
CombFeedbackDualtap( int maxDelay ) :
m_size( maxDelay ),
m_position( 0 ),
m_feedBack( 0.0 ),
m_delay( 0 ),
m_fraction( 0.0 )
{
m_buffer = MM_ALLOC( frame, maxDelay );
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
virtual ~CombFeedbackDualtap()
{
MM_FREE( m_buffer );
}
inline void setMaxDelay( int maxDelay )
{
if( maxDelay > m_size )
{
MM_FREE( m_buffer );
m_buffer = MM_ALLOC( frame, maxDelay );
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
m_size = maxDelay;
m_position %= m_size;
}
inline void clearHistory()
{
memset( m_buffer, 0, sizeof( frame ) * m_size );
}
inline void setDelays( double delay1, double delay2 )
{
m_delay1 = static_cast<int>( ceil( delay1 ) );
m_fraction1 = 1.0 - ( delay1 - floor( delay1 ) );
m_delay2 = static_cast<int>( ceil( delay2 ) );
m_fraction2 = 1.0 - ( delay2 - floor( delay2 ) );
}
inline void setGain( double gain )
{
m_gain = gain;
}
inline double update( double in, ch_cnt_t ch )
{
int readPos1 = m_position - m_delay1;
if( readPos1 < 0 ) { readPos1 += m_size; }
int readPos2 = m_position - m_delay2;
if( readPos2 < 0 ) { readPos2 += m_size; }
const double y = linearInterpolate( m_buffer[readPos1][ch], m_buffer[( readPos1 + 1 ) % m_size][ch], m_fraction1 ) +
linearInterpolate( m_buffer[readPos2][ch], m_buffer[( readPos2 + 1 ) % m_size][ch], m_fraction2 );
++m_position %= m_size;
m_buffer[m_position][ch] = in + m_gain * y;
return y;
}
private:
frame * m_buffer;
int m_size;
int m_position;
double m_gain;
int m_delay1;
int m_delay2;
double m_fraction1;
double m_fraction2;
};
template<ch_cnt_t CHANNELS>
class AllpassDelay
{
public:
typedef double frame[CHANNELS];
AllpassDelay( int maxDelay ) :
m_size( maxDelay ),
m_position( 0 ),
m_feedBack( 0.0 ),
m_delay( 0 ),
m_fraction( 0.0 )
{
m_buffer = MM_ALLOC( frame, maxDelay );
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
virtual ~AllpassDelay()
{
MM_FREE( m_buffer );
}
inline void setMaxDelay( int maxDelay )
{
if( maxDelay > m_size )
{
MM_FREE( m_buffer );
m_buffer = MM_ALLOC( frame, maxDelay );
memset( m_buffer, 0, sizeof( frame ) * maxDelay );
}
m_size = maxDelay;
m_position %= m_size;
}
inline void clearHistory()
{
memset( m_buffer, 0, sizeof( frame ) * m_size );
}
inline void setDelay( double delay )
{
m_delay = static_cast<int>( ceil( delay ) );
m_fraction = 1.0 - ( delay - floor( delay ) );
}
inline void setGain( double gain )
{
m_gain = gain;
}
inline double update( double in, ch_cnt_t ch )
{
int readPos = m_position - m_delay;
if( readPos < 0 ) { readPos += m_size; }
const double y = linearInterpolate( m_buffer[readPos][ch], m_buffer[( readPos + 1 ) % m_size][ch], m_fraction ) + in * -m_gain;
const double x = in + m_gain * y;
++m_position %= m_size;
m_buffer[m_position][ch] = x;
return y;
}
private:
frame * m_buffer;
int m_size;
int m_position;
double m_gain;
int m_delay;
double m_fraction;
};
// convenience typedefs for stereo effects
typedef CombFeedback<2> StereoCombFeedback;
typedef CombFeedfwd<2> StereoCombFeedfwd;
typedef CombFeedbackDualtap<2> StereoCombFeedbackDualtap;
typedef AllpassDelay<2> StereoAllpassDelay;
#endif

View File

@@ -73,6 +73,7 @@ private:
private slots:
void renameChannel();
void removeChannel();
void removeUnusedChannels();
void moveChannelLeft();
void moveChannelRight();
void displayHelp();

View File

@@ -92,6 +92,9 @@ public:
// notify the view that an fx channel was deleted
void deleteChannel(int index);
// delete all unused channels
void deleteUnusedChannels();
// move the channel to the left or right
void moveChannelLeft(int index);
void moveChannelRight(int index);
@@ -99,6 +102,9 @@ public:
// make sure the display syncs up with the fx mixer.
// useful for loading projects
void refreshDisplay();
protected:
virtual void closeEvent( QCloseEvent * _ce );
private slots:
void updateFaders();

View File

@@ -38,6 +38,7 @@
#include "Track.h"
class QLineEdit;
template<class T> class QQueue;
class InstrumentFunctionArpeggioView;
@@ -202,10 +203,10 @@ public:
return &m_effectChannelModel;
}
void setIndicator( FadeButton *fb );
signals:
void instrumentChanged();
void newNote();
void midiNoteOn( const Note& );
void midiNoteOff( const Note& );
void nameChanged();
@@ -250,6 +251,8 @@ private:
IntModel m_pitchRangeModel;
IntModel m_effectChannelModel;
FadeButton *m_fb;
Instrument * m_instrument;
InstrumentSoundShaping m_soundShaping;

View File

@@ -27,6 +27,7 @@
#define PROJECT_NOTES_H
#include <QMainWindow>
#include <QCloseEvent>
#include "JournallingObject.h"
@@ -56,6 +57,7 @@ public:
protected:
virtual void closeEvent( QCloseEvent * _ce );
void setupActions();

View File

@@ -38,7 +38,7 @@ public:
}
virtual ~RmsHelper()
{
if( m_buffer ) delete m_buffer;
if( m_buffer ) delete[] m_buffer;
}
inline void setSize( int size )

View File

@@ -148,9 +148,11 @@ public:
private:
FloatModel m_volumeModel;
FloatModel m_panningModel;
AudioPort m_audioPort;
friend class SampleTrackView;
} ;
@@ -181,6 +183,7 @@ private:
EffectRackView * m_effectRack;
QWidget * m_effWindow;
Knob * m_volumeKnob;
Knob * m_panningKnob;
} ;

View File

@@ -34,6 +34,7 @@
#include "MeterModel.h"
#include "VstSyncController.h"
class AutomationTrack;
class Pattern;
class TimeLineWidget;
@@ -169,18 +170,11 @@ public:
return m_recording;
}
inline bool isExportDone() const
bool isExportDone() const;
inline void setRenderBetweenMarkers( bool renderBetweenMarkers )
{
if ( m_exportLoop )
{
return m_exporting == true &&
m_playPos[Mode_PlaySong].getTicks() >= length() * ticksPerTact();
}
else
{
return m_exporting == true &&
m_playPos[Mode_PlaySong].getTicks() >= ( length() + 1 ) * ticksPerTact();
}
m_renderBetweenMarkers = renderBetweenMarkers;
}
inline PlayModes playMode() const
@@ -344,6 +338,7 @@ private:
volatile bool m_recording;
volatile bool m_exporting;
volatile bool m_exportLoop;
volatile bool m_renderBetweenMarkers;
volatile bool m_playing;
volatile bool m_paused;

View File

@@ -73,6 +73,8 @@ public slots:
void setEditModeDraw();
void setEditModeSelect();
protected:
virtual void closeEvent( QCloseEvent * _ce );
private slots:
void setHighQuality( bool );

View File

@@ -67,7 +67,7 @@ const int TRACK_OP_WIDTH_COMPACT = 60;
* Tracks can be resized by shift-dragging anywhere inside the track
* display. This sets the minimum size in pixels for a track.
*/
const int MINIMAL_TRACK_HEIGHT = 8;
const int MINIMAL_TRACK_HEIGHT = 32;
const int DEFAULT_TRACK_HEIGHT = 32;
const int TCO_BORDER_WIDTH = 2;
@@ -120,7 +120,7 @@ public:
{
return m_length;
}
virtual void movePosition( const MidiTime & _pos );
virtual void changeLength( const MidiTime & _length );
@@ -539,7 +539,9 @@ private:
QString m_name;
int m_height;
protected:
BoolModel m_mutedModel;
private:
BoolModel m_soloModel;
bool m_mutedBeforeSolo;

View File

@@ -51,7 +51,7 @@ public:
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
virtual void loadSettings( const QDomElement & _this );
QWidget * contentWidget()
QScrollArea * contentWidget()
{
return( m_scrollArea );
}

View File

@@ -71,9 +71,9 @@ inline float cubicInterpolate( float v0, float v1, float v2, float v3, float x )
float frcu = frsq*v0;
float t1 = v3 + 3*v1;
return( v1 + 0.5f * frcu + x * ( v2 - frcu * ( 1.0f/6.0f ) -
t1 * ( 1.0f/6.0f ) - v0 / 3.0f ) + frsq * x * ( t1 *
( 1.0f/6.0f ) - 0.5f * v2 ) + frsq * ( 0.5f * v2 - v1 ) );
return( v1 + fastFmaf( 0.5f, frcu, x ) * ( v2 - frcu * ( 1.0f/6.0f ) -
fastFmaf( t1, ( 1.0f/6.0f ), -v0 ) * ( 1.0f/3.0f ) ) + frsq * x * ( t1 *
( 1.0f/6.0f ) - 0.5f * v2 ) + frsq * fastFmaf( 0.5f, v2, -v1 ) );
}
@@ -102,7 +102,7 @@ inline float optimalInterpolate( float v0, float v1, float x )
const float c2 = even * -0.004541102062639801;
const float c3 = odd * -1.57015627178718420;
return ( ( c3*z + c2 ) * z + c1 ) * z + c0;
return fastFmaf( fastFmaf( fastFmaf( c3, z, c2 ), z, c1 ), z, c0 );
}
@@ -119,7 +119,7 @@ inline float optimal4pInterpolate( float v0, float v1, float v2, float v3, float
const float c2 = even1 * -0.246185007019907091 + even2 * 0.24614027139700284;
const float c3 = odd1 * -0.36030925263849456 + odd2 * 0.10174985775982505;
return ( ( c3*z + c2 ) * z + c1 ) * z + c0;
return fastFmaf( fastFmaf( fastFmaf( c3, z, c2 ), z, c1 ), z, c0 );
}
@@ -130,7 +130,7 @@ inline float lagrangeInterpolate( float v0, float v1, float v2, float v3, float
const float c1 = v2 - v0 * ( 1.0f / 3.0f ) - v1 * 0.5f - v3 * ( 1.0f / 6.0f );
const float c2 = 0.5f * (v0 + v2) - v1;
const float c3 = ( 1.0f/6.0f ) * ( v3 - v0 ) + 0.5f * ( v1 - v2 );
return ( ( c3*x + c2 ) * x + c1 ) * x + c0;
return fastFmaf( fastFmaf( fastFmaf( c3, x, c2 ), x, c1 ), x, c0 );
}

View File

@@ -48,10 +48,10 @@ using namespace std;
#define _isinff(x) isinf(x)
#endif
#ifndef exp10
#define exp10(x) pow( 10, x )
#define exp10(x) pow( 10.0, x )
#endif
#ifndef exp10f
#define exp10f(x) powf( 10, x )
#define exp10f(x) powf( 10.0f, x )
#endif
#endif
@@ -239,10 +239,10 @@ static inline float linearToLogScale( float min, float max, float value )
//! @brief Converts linear amplitude (0-1.0) to dBV scale.
//! @brief Converts linear amplitude (0-1.0) to dBV scale. Handles zeroes as -inf.
//! @param amp Linear amplitude, where 1.0 = 0dBV.
//! @return Amplitude in dBV. -inf for 0 amplitude.
static inline float ampToDbv( float amp )
static inline float safeAmpToDbv( float amp )
{
return amp == 0.0f
? -INFINITY
@@ -250,10 +250,10 @@ static inline float ampToDbv( float amp )
}
//! @brief Converts dBV-scale to linear amplitude with 0dBV = 1.0
//! @brief Converts dBV-scale to linear amplitude with 0dBV = 1.0. Handles infinity as zero.
//! @param dbv The dBV value to convert: all infinites are treated as -inf and result in 0
//! @return Linear amplitude
static inline float dbvToAmp( float dbv )
static inline float safeDbvToAmp( float dbv )
{
return isinff( dbv )
? 0.0f
@@ -261,6 +261,24 @@ static inline float dbvToAmp( float dbv )
}
//! @brief Converts linear amplitude (>0-1.0) to dBV scale.
//! @param amp Linear amplitude, where 1.0 = 0dBV. ** Must be larger than zero! **
//! @return Amplitude in dBV.
static inline float ampToDbv( float amp )
{
return log10f( amp ) * 20.0f;
}
//! @brief Converts dBV-scale to linear amplitude with 0dBV = 1.0
//! @param dbv The dBV value to convert. ** Must be a real number - not inf/nan! **
//! @return Linear amplitude
static inline float dbvToAmp( float dbv )
{
return exp10f( dbv * 0.05f );
}
//! returns 1.0f if val >= 0.0f, -1.0 else
static inline float sign( float val )