Xpressive plugin (#3259)

* First Preview of the X-Pressive Plugin
(exprtk.hpp is not included, get it from my exprtk fork in the branch
internal_data_functions)
available keys:
f- note's frequency. available only in the output expressions
t- time in seconds. in the Waves (W1,W2,W3) it's in the range [0,1)
key- the note's keyboard key. available only in the output expressions.
v- the note's velocity (divided by 255.0 so it is in the range [0,1]).
available only in the output expressions.
rel- gives 0 while the key is holded, and 1 after the key release.
available only in the output expressions.
A1,A2,A3- general purpose knobs (you can control them with the
automations). available only in the output expressions.
W1,W2,W3- precalculated wave forms. can be also load from file. you can
use them only in the output expressions
available functions:
cent(x)- gives pow(2,x/1200)
rand()- random number generator. in range [-1,1). each call gives other
value.
randv(i)- random vector (with pseudo infinite integer cells). the values
are in range [-1,1). it's stays consistent only across the note
playback. so each note playback will get other vector (even on the same
key).
sinew- sine wave with period of 1.
saww- saw wave with period of 1.
squarew- square wave with period of 1.
trianglew- triangle wave with period of 1.
expw- exponent wave with period of 1.
expnw- another exponent wave with period of 1.
moogw- moog wave with period of 1.
moogsaww- moog-saw wave with period of 1.
you can use * % ^ / + - pow sin log pi etc.

* Xpressive Plug-In:
Added Release transition knob that control the "rel" variable. (the
duration of transit from 0 to 1)
Fixed some problems in the displays. (update display when changing
A1,A2,A3, clear display with invalid expression.

* X-Pressive Plug-In: Few more fixes
Changed the callbacks in exprfront.cpp to be templated.
Added help.
Added ExprTk.hpp.
some bug fixes (inf issues).
Added integrate function.

* Special version of ExprTk with modified license (BSL) for the LMMS project https://github.com/LMMS/lmms

* Xpressive Plug-In- fixed some building errors.
Added the "e" euler's constant.

* Xpressive Plug-In - fix mingw64 issues

* X-Pressive Plug-in:
Added "trel" (time since release) variable.
The integrate function can now have unlimited usage.
Added selective interpolation per wave.
Improved a little the random vector function.
Some other improvements, code cleaning, etc...

* Xpressive Plug-In:
move clearGraph definition into Graph.cpp.
fixed compilation errors. (oops..)

* X-Pressive plug-in: updated presets names

* X-Pressive plug-in
added semitone function, added sample-rate variable

* X-Pressive plug-in, code cleaning, changed the rendering function to
achieve performace gain.

* X-Pressive plug-in - fix the string counting function

* X-Pressive plug-in - until somebody will find a better solution,
exprtk.hpp is patched under the name exprtk.patched.hpp ...

* X-Pressive plug-in - fix compiling errors.

* X-Pressive plug-in - added patch file for exprtk.hpp,
added last function that gives last calculated samples.
moved ExprSynth to be with ExprFront for performance reasons.

* X-Pressive plugin - moved the patched file back to the source tree, added .gitignore file..

* X-Pressive plugin - fix compilation error. (isnan isinf)

* X-Pressive plugin - tried to fix embed.cpp problem,
added new variable to the parser (tempo)

* X-Pressive plugin - fixed cmake script

* X-Pressive plugin - updated the license and the diff file.

* Updates to ExprTk

* Added return statement enable/disable via parser settings

Added exprtk_disable_return_statement macro for disabling return statements and associated exceptions at the source code level.

* X-Pressive plugin - updated CMakeLists.txt to use the correct flags on each platform.
also added exprtk.hpp as a dependency for the patch command.
Updated the exprtk diff file.

* X-Pressive plugin - moved the enhanced features flag to the WIN64 installation.

* X-Pressive plugin - another fix for CMakeLists.txt

* Minor updates to ExprTk

Updated multi-sub expression operator to return final sub-expression type.
Updates to exprtk_disable_return_statement macro for disabling return statements and associated exceptions at the source code level.

* X-Pressive plug-in - added try-block around exprtk calls and enabled the
-fexceptions flag, so patch file is no longer needed.

* X-Pressive plug-in - small fix in CMakeLists.txt

* Update ExprTk to tip of branch.

* X-Pressive plugin - added graph drawing feature..

* Updating exprtk.hpp to the latest upstream version
This commit is contained in:
gnudles
2017-06-26 20:45:59 +03:00
committed by Oskar Wallgren
parent d8dc29e675
commit dff76b2e83
48 changed files with 40575 additions and 28 deletions

View File

@@ -130,14 +130,8 @@ void Graph::mouseMoveEvent ( QMouseEvent * _me )
x = qMax( 2, qMin( x, width()-3 ) );
y = qMax( 2, qMin( y, height()-3 ) );
if( qAbs( diff ) > 1 )
{
drawLineAt( x, y, m_lastCursorX );
}
else
{
changeSampleAt( x, y );
}
drawLineAt( x, y, m_lastCursorX );
// update mouse
if( diff != 0 )
@@ -209,25 +203,47 @@ void Graph::drawLineAt( int _x, int _y, int _lastx )
float range = minVal - maxVal;
float val = ( _y*range/( height()-5 ) ) + maxVal;
float lastval = model() -> m_samples[ (int)( _lastx * xscale ) ];
// calculate line drawing variables
int linelen = qAbs( _x - _lastx ) + 1;
int xstep = _x > _lastx ? -1 : 1;
float ystep = ( lastval - val ) / linelen;
int start = INT_MAX;
int end = 0;
// draw a line
for ( int i = 0; i < linelen; i++ )
int sample_begin, sample_end;
float lastval;
float val_begin, val_end;
if (_lastx > _x)
{
int x = (_x + (i * xstep)) * xscale; // get x value
model()->drawSampleAt( x, val + (i * ystep));
start = qMin( start, x );
end = qMax( end, x );
sample_begin = (int)((_x) * xscale);
sample_end = (int)ceil((_lastx+1) * xscale);
lastval = model() -> m_samples[ (int)( sample_end - 1 ) ];
val_begin = val;
val_end = lastval;
}
else
{
sample_begin = (int)(_lastx * xscale);
sample_end = (int)ceil((_x+1) * xscale);
lastval = model() -> m_samples[ (int)( sample_begin ) ];
val_begin = lastval;
val_end = val;
}
model()->samplesChanged( start, end );
// calculate line drawing variables
int linelen = sample_end - sample_begin;
if (linelen == 1)
{
val_begin = val;
}
//int xstep = _x > _lastx ? -1 : 1;
float ystep = ( val_end - val_begin ) / linelen;
// draw a line
for ( int i = 0 ; i < linelen; i++ )
{
model()->drawSampleAt( sample_begin + i , val_begin + ((i ) * ystep));
}
model()->samplesChanged( sample_begin, sample_end );
}
void Graph::changeSampleAt( int _x, int _y )
@@ -265,6 +281,7 @@ void Graph::mouseReleaseEvent( QMouseEvent * _me )
m_mouseDown = false;
setCursor( Qt::CrossCursor );
update();
emit drawn();
}
}
@@ -633,7 +650,24 @@ void graphModel::smoothNonCyclic()
emit samplesChanged(0, length()-1);
}
//makes a cyclic convolution.
void graphModel::convolve(const float *convolution, const int convolutionLength, const int centerOffset)
{
// store values in temporary array
QVector<float> temp = m_samples;
const int graphLength = length();
float sum;
for ( int i = 0; i < graphLength; i++ )
{
sum = 0;
for ( int j = 0; j < convolutionLength; j++ )
{
sum += convolution[j] * temp[( i + j ) % graphLength];
}
m_samples[( i + centerOffset ) % graphLength] = sum;
}
emit samplesChanged(0, graphLength - 1);
}
void graphModel::normalize()
{
@@ -676,7 +710,7 @@ void graphModel::invert()
void graphModel::shiftPhase( int _deg )
{
// calculate offset in samples
int offset = ( _deg * length() ) / 360; //multiply first because integers
const int offset = ( _deg * length() ) / 360; //multiply first because integers
// store values in temporary array
QVector<float> temp = m_samples;
@@ -692,6 +726,14 @@ void graphModel::shiftPhase( int _deg )
emit samplesChanged( 0, length()-1 );
}
void graphModel::clear()
{
const int graph_length = length();
for( int i = 0; i < graph_length; i++ )
m_samples[i] = 0;
emit samplesChanged( 0, graph_length - 1 );
}
void graphModel::drawSampleAt( int x, float val )