Merge branch 'master' into arpDownUp

This commit is contained in:
Oskar Wallgren
2014-04-08 01:38:32 +02:00
101 changed files with 3431 additions and 396 deletions

View File

@@ -33,11 +33,15 @@ class AutomationPattern;
class AutomationPatternView : public trackContentObjectView
{
Q_OBJECT
// theming qproperties
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
public:
AutomationPatternView( AutomationPattern * _pat, trackView * _parent );
virtual ~AutomationPatternView();
public slots:
virtual void update();
@@ -67,7 +71,6 @@ private:
bool m_needsUpdate;
void scaleTimemapToFit( float oldMin, float oldMax );
} ;

View File

@@ -46,6 +46,11 @@ class EXPORT SampleBuffer : public QObject, public sharedObject
{
Q_OBJECT
public:
enum LoopMode {
LoopOff = 0,
LoopOn,
LoopPingPong
};
class EXPORT handleState
{
public:
@@ -62,11 +67,21 @@ public:
m_frameIndex = _index;
}
inline bool isBackwards() const
{
return m_isBackwards;
}
inline void setBackwards( bool _backwards )
{
m_isBackwards = _backwards;
}
private:
f_cnt_t m_frameIndex;
const bool m_varyingPitch;
bool m_isBackwards;
SRC_STATE * m_resamplingData;
friend class SampleBuffer;
@@ -86,7 +101,7 @@ public:
bool play( sampleFrame * _ab, handleState * _state,
const fpp_t _frames,
const float _freq,
const bool _looped = false );
const LoopMode _loopmode = LoopOff );
void visualize( QPainter & _p, const QRect & _dr, const QRect & _clip, f_cnt_t _from_frame = 0, f_cnt_t _to_frame = 0 );
inline void visualize( QPainter & _p, const QRect & _dr, f_cnt_t _from_frame = 0, f_cnt_t _to_frame = 0 )
@@ -108,7 +123,7 @@ public:
{
return m_endFrame;
}
inline f_cnt_t loopStartFrame() const
{
return m_loopStartFrame;
@@ -133,6 +148,16 @@ public:
m_varLock.unlock();
}
void setAllPointFrames( f_cnt_t _start, f_cnt_t _end, f_cnt_t _loopstart, f_cnt_t _loopend )
{
m_varLock.lock();
m_startFrame = _start;
m_endFrame = _end;
m_loopStartFrame = _loopstart;
m_loopEndFrame = _loopend;
m_varLock.unlock();
}
inline f_cnt_t frames() const
{
return m_frames;
@@ -207,23 +232,13 @@ public:
inline sample_t userWaveSample( const float _sample ) const
{
// Precise implementation
// const float frame = fraction( _sample ) * m_frames;
// const f_cnt_t f1 = static_cast<f_cnt_t>( frame );
// const f_cnt_t f2 = ( f1 + 1 ) % m_frames;
// sample_t waveSample = linearInterpolate( m_data[f1][0],
// m_data[f2][0],
// fraction( frame ) );
// return waveSample;
// Fast implementation
const float frame = _sample * m_frames;
f_cnt_t f1 = static_cast<f_cnt_t>( frame ) % m_frames;
if( f1 < 0 )
{
f1 += m_frames;
}
return m_data[f1][0];
return linearInterpolate( m_data[f1][0], m_data[ (f1 + 1) % m_frames ][0], fraction( frame ) );
}
static QString tryToMakeRelative( const QString & _file );
@@ -245,7 +260,7 @@ private:
void convertIntToFloat ( int_sample_t * & _ibuf, f_cnt_t _frames, int _channels);
void directFloatWrite ( sample_t * & _fbuf, f_cnt_t _frames, int _channels);
f_cnt_t decodeSampleSF( const char * _f, int_sample_t * & _buf,
f_cnt_t decodeSampleSF( const char * _f, sample_t * & _buf,
ch_cnt_t & _channels,
sample_rate_t & _sample_rate );
#ifdef LMMS_HAVE_OGGVORBIS
@@ -272,10 +287,13 @@ private:
float m_frequency;
sample_rate_t m_sampleRate;
sampleFrame * getSampleFragment( f_cnt_t _start, f_cnt_t _frames,
bool _looped,
sampleFrame * * _tmp ) const;
f_cnt_t getLoopedIndex( f_cnt_t _index ) const;
sampleFrame * getSampleFragment( f_cnt_t _index, f_cnt_t _frames,
LoopMode _loopmode,
sampleFrame * * _tmp,
bool * _backwards, f_cnt_t _loopstart, f_cnt_t _loopend,
f_cnt_t _end ) const;
f_cnt_t getLoopedIndex( f_cnt_t _index, f_cnt_t _startf, f_cnt_t _endf ) const;
f_cnt_t getPingPongIndex( f_cnt_t _index, f_cnt_t _startf, f_cnt_t _endf ) const;
signals:

View File

@@ -88,6 +88,11 @@ signals:
class SampleTCOView : public trackContentObjectView
{
Q_OBJECT
// theming qproperties
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
public:
SampleTCOView( SampleTCO * _tco, trackView * _tv );
virtual ~SampleTCOView();
@@ -108,7 +113,6 @@ protected:
private:
SampleTCO * m_tco;
} ;

View File

@@ -113,16 +113,24 @@ const int effGetVstVersion = 58; // currently unused
const int kEffectMagic = CCONST( 'V', 's', 't', 'P' );
const int kVstLangEnglish = 1;
const int kVstMidiType = 1;
const int kVstParameterUsesFloatStep = 1 << 2;
const int kVstPpqPosValid = 1 << 9;
const int kVstTempoValid = 1 << 10;
const int kVstBarsValid = 1 << 11;
const int kVstCyclePosValid = 1 << 12;
const int kVstTimeSigValid = 1 << 13;
const int kVstTransportPlaying = 1 << 1;
const int kVstTransportCycleActive = 1 << 2;
const int kVstTransportChanged = 1;
/* validity flags for a VstTimeInfo structure, this info comes from the web */
const int kVstNanosValid (1 << 8);
const int kVstPpqPosValid (1 << 9);
const int kVstTempoValid (1 << 10);
const int kVstBarsValid (1 << 11);
const int kVstCyclePosValid (1 << 12);
const int kVstTimeSigValid (1 << 13);
const int kVstSmpteValid (1 << 14);
const int kVstClockValid (1 << 15);
class RemoteVstPlugin;
@@ -180,43 +188,50 @@ public:
} ;
// Not finished, neither really used
class VstParameterProperties
/* constants from http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=3740&sid=183f74631fee71a493316735e2b9f28b */
enum Vestige2StringConstants
{
public:
/* float stepFloat;
char label[64];
int flags;
int minInteger;
int maxInteger;
int stepInteger;
char shortLabel[8];
int category;
char categoryLabel[24];
char empty[128];*/
float stepFloat;
float smallStepFloat;
float largeStepFloat;
char label[64];
unsigned int flags;
unsigned int minInteger;
unsigned int maxInteger;
unsigned int stepInteger;
unsigned int largeStepInteger;
char shortLabel[8];
unsigned short displayIndex;
unsigned short category;
unsigned short numParametersInCategory;
unsigned short reserved;
char categoryLabel[24];
char future[16];
} ;
VestigeMaxNameLen = 64,
VestigeMaxLabelLen = 64,
VestigeMaxShortLabelLen = 8,
VestigeMaxCategLabelLen = 24,
VestigeMaxFileNameLen = 100
};
/* this struct taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
struct VstParameterProperties
{
float stepFloat; /* float step */
float smallStepFloat; /* small float step */
float largeStepFloat; /* large float step */
char label[VestigeMaxLabelLen]; /* parameter label */
int32_t flags; /* @see VstParameterFlags */
int32_t minInteger; /* integer minimum */
int32_t maxInteger; /* integer maximum */
int32_t stepInteger; /* integer step */
int32_t largeStepInteger; /* large integer step */
char shortLabel[VestigeMaxShortLabelLen]; /* short label, recommended: 6 + delimiter */
int16_t displayIndex; /* index where this parameter should be displayed (starting with 0) */
int16_t category; /* 0: no category, else group index + 1 */
int16_t numParametersInCategory; /* number of parameters in category */
int16_t reserved; /* zero */
char categoryLabel[VestigeMaxCategLabelLen]; /* category label, e.g. "Osc 1" */
char future[16]; /* reserved for future use */
};
/* this enum taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
enum VstParameterFlags
{
kVstParameterIsSwitch = 1 << 0, /* parameter is a switch (on/off) */
kVstParameterUsesIntegerMinMax = 1 << 1, /* minInteger, maxInteger valid */
kVstParameterUsesFloatStep = 1 << 2, /* stepFloat, smallStepFloat, largeStepFloat valid */
kVstParameterUsesIntStep = 1 << 3, /* stepInteger, largeStepInteger valid */
kVstParameterSupportsDisplayIndex = 1 << 4, /* displayIndex valid */
kVstParameterSupportsDisplayCategory = 1 << 5, /* category, etc. valid */
kVstParameterCanRamp = 1 << 6 /* set if parameter value can ramp up/down */
};
class AEffect
@@ -274,7 +289,7 @@ public:
// 08
double sampleRate;
// unconfirmed 10
char empty1[8];
double nanoSeconds;
// 18
double ppqPos;
// 20?
@@ -286,13 +301,15 @@ public:
// 38?
double cycleEndPos;
// 40?
int timeSigNumerator;
int32_t timeSigNumerator;
// 44?
int timeSigDenominator;
// unconfirmed 48 4c 50
char empty3[4 + 4 + 4];
int32_t timeSigDenominator;
int32_t smpteOffset;
int32_t smpteFrameRate;
int32_t samplesToNextClock;
// 54
int flags;
int32_t flags;
} ;

View File

@@ -23,8 +23,8 @@
*/
#ifndef _INTERPOLATION_H
#define _INTERPOLATION_H
#ifndef INTERPOLATION_H
#define INTERPOLATION_H
#ifndef __USE_XOPEN
#define __USE_XOPEN
@@ -80,14 +80,21 @@ inline float cubicInterpolate( float v0, float v1, float v2, float v3, float x )
inline float cosinusInterpolate( float v0, float v1, float x )
{
float f = cosf( x * ( F_PI_2 ) );
return( v0*f + v1*( 1.0f-f ) );
return( v1 - f * (v1-v0) );
// return( v0*f + v1*( 1.0f-f ) );
}
inline float linearInterpolate( float v0, float v1, float x )
{
return( v0*( 1.0f-x ) + v1*x );
// take advantage of fma function if present in hardware
#ifdef FP_FAST_FMAF
return fmaf( x, v1-v0, v0 );
#else
return x * (v1-v0) + v0;
#endif
}

View File

@@ -26,6 +26,7 @@
#ifndef _LMMS_MATH_H
#define _LMMS_MATH_H
#include <stdint.h>
#ifdef __INTEL_COMPILER
@@ -106,5 +107,18 @@ static inline int fast_rand()
// source: http://martin.ankerl.com/2007/10/04/optimized-pow-approximation-for-java-and-c-c/
static inline double fastPow( double a, double b )
{
union
{
double d;
int32_t x[2];
} u = { a };
u.x[1] = static_cast<int32_t>( b * ( u.x[1] - 1072632447 ) + 1072632447 );
u.x[0] = 0;
return u.d;
}
#endif

View File

@@ -147,6 +147,10 @@ private:
class patternView : public trackContentObjectView
{
Q_OBJECT
// theming qproperties
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
public:
patternView( pattern * _pattern, trackView * _parent );
virtual ~patternView();
@@ -185,7 +189,6 @@ private:
pattern * m_pat;
QPixmap m_paintPixmap;
bool m_needsUpdate;
} ;

View File

@@ -149,7 +149,8 @@ protected:
private:
static QPixmap * s_timeLinePixmap;
static QPixmap * s_posMarkerPixmap;
static QPixmap * s_loopPointPixmap;
static QPixmap * s_loopPointBeginPixmap;
static QPixmap * s_loopPointEndPixmap;
static QPixmap * s_loopPointDisabledPixmap;
AutoScrollStates m_autoScroll;

View File

@@ -29,6 +29,7 @@
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QtGui/QWidget>
#include <QColor>
#include "lmms_basics.h"
#include "MidiTime.h"
@@ -162,6 +163,11 @@ private:
class trackContentObjectView : public selectableObject, public ModelView
{
Q_OBJECT
// theming qproperties
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
public:
trackContentObjectView( trackContentObject * _tco, trackView * _tv );
virtual ~trackContentObjectView();
@@ -172,7 +178,11 @@ public:
{
return m_tco;
}
// qproperty access func
QColor fgColor() const;
QColor textColor() const;
void setFgColor( const QColor & _c );
void setTextColor( const QColor & _c );
public slots:
virtual bool close();
@@ -227,6 +237,9 @@ private:
MidiTime m_oldTime;// used for undo/redo while mouse-button is pressed
// qproperty fields
QColor * m_fgColor;
QColor * m_textColor;
} ;
@@ -236,6 +249,18 @@ private:
class trackContentWidget : public QWidget, public JournallingObject
{
Q_OBJECT
// qproperties for track background gradients
Q_PROPERTY( QColor darkerColor1 READ darkerColor1 WRITE setDarkerColor1 )
Q_PROPERTY( QColor darkerColor2 READ darkerColor2 WRITE setDarkerColor2 )
Q_PROPERTY( QColor darkerColor3 READ darkerColor3 WRITE setDarkerColor3 )
Q_PROPERTY( QColor lighterColor1 READ lighterColor1 WRITE setLighterColor1 )
Q_PROPERTY( QColor lighterColor2 READ lighterColor2 WRITE setLighterColor2 )
Q_PROPERTY( QColor lighterColor3 READ lighterColor3 WRITE setLighterColor3 )
Q_PROPERTY( float gradMidPoint READ gradMidPoint WRITE setGradMidPoint )
public:
trackContentWidget( trackView * _parent );
virtual ~trackContentWidget();
@@ -255,6 +280,28 @@ public:
MidiTime endPosition( const MidiTime & _pos_start );
// qproperty access methods
QColor darkerColor1() const;
QColor darkerColor2() const;
QColor darkerColor3() const;
QColor lighterColor1() const;
QColor lighterColor2() const;
QColor lighterColor3() const;
float gradMidPoint() const;
void setDarkerColor1( const QColor & _c );
void setDarkerColor2( const QColor & _c );
void setDarkerColor3( const QColor & _c );
void setLighterColor1( const QColor & _c );
void setLighterColor2( const QColor & _c );
void setLighterColor3( const QColor & _c );
void setGradMidPoint( float _g );
public slots:
void update();
void changePosition( const MidiTime & _new_pos = MidiTime( -1 ) );
@@ -295,6 +342,14 @@ private:
QPixmap m_background;
// qproperty fields
QColor * m_darkerColor1;
QColor * m_darkerColor2;
QColor * m_darkerColor3;
QColor * m_lighterColor1;
QColor * m_lighterColor2;
QColor * m_lighterColor3;
float m_gradMidPoint;
} ;