Browse Source

Fix links

tags/1.9.4
falkTX 11 years ago
parent
commit
0fcc3c1b63
11 changed files with 762 additions and 6 deletions
  1. +0
    -1
      source/modules/carla_native/vex/cArp.h
  2. +311
    -0
      source/modules/carla_native/vex/cArp.h
  3. +0
    -1
      source/modules/carla_native/vex/cArpSettings.h
  4. +83
    -0
      source/modules/carla_native/vex/cArpSettings.h
  5. +0
    -1
      source/modules/carla_native/vex/cChorus.h
  6. +156
    -0
      source/modules/carla_native/vex/cChorus.h
  7. +0
    -1
      source/modules/carla_native/vex/cDelay.h
  8. +128
    -0
      source/modules/carla_native/vex/cDelay.h
  9. +0
    -1
      source/modules/carla_native/vex/cReverb.h
  10. +84
    -0
      source/modules/carla_native/vex/cReverb.h
  11. +0
    -1
      source/modules/carla_native/vex/freeverb

+ 0
- 1
source/modules/carla_native/vex/cArp.h View File

@@ -1 +0,0 @@
/home/falktx/Personal/FOSS/GIT/distrho/ports/vex/source/synth/cArp.h

+ 311
- 0
source/modules/carla_native/vex/cArp.h View File

@@ -0,0 +1,311 @@
/*
==============================================================================
This file is part of the JUCETICE project - Copyright 2008 by Lucio Asnaghi.
JUCETICE is based around the JUCE library - "Jules' Utility Class Extensions"
Copyright 2008 by Julian Storer.
------------------------------------------------------------------------------
JUCE and JUCETICE can be redistributed and/or modified under the terms of
the GNU Lesser General Public License, as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
JUCE and JUCETICE are distributed in the hope that they 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 Lesser General Public License
along with JUCE and JUCETICE; if not, visit www.gnu.org/licenses or write to
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
==============================================================================
@author rockhardbuns
@tweaker Lucio Asnaghi
==============================================================================
*/
#ifndef __JUCETICE_VEXCARP_HEADER__
#define __JUCETICE_VEXCARP_HEADER__
#include "cArpSettings.h"
#ifdef CARLA_EXPORT
#include "JuceHeader.h"
#else
#include "../StandardHeader.h"
#endif
class VexArp
{
public:
static const int kMaxNotes = 10;
VexArp(const VexArpSettings* p)
: arpSet(p),
dead(true),
notesPlaying(false),
doSync(true),
nextStep(0),
sampleCount(0),
sampleRate(44100)
{
meter[0] = 4;
meter[1] = 8;
meter[2] = 16;
meter[3] = 32;
for (int i = 0; i < kMaxNotes; ++i)
{
cKeysDown[i] = 0;
cNotesToKill[i] = 0;
cKeysVelocity[i] = 0;
}
outMidiBuffer.ensureSize(kMaxNotes+128);
}
void addNote(const char note, const char vel)
{
char tmp, tmpNote = note, tmpVel = vel;
for (int i = 0; i < kMaxNotes; ++i)
{
if (note < cKeysDown[i] || cKeysDown[i] == 0)
{
tmp = cKeysDown[i]; cKeysDown[i] = tmpNote; tmpNote = tmp;
tmp = cKeysVelocity[i]; cKeysVelocity[i] = tmpVel; tmpVel = tmp;
}
}
doSync = true;
}
void dropNote(const char note)
{
int i = 0;
for (; i < kMaxNotes; ++i)
{
if (cKeysDown[i] == note)
break;
}
if (i == kMaxNotes)
return;
for (; i < kMaxNotes-1; ++i)
{
cKeysDown[i] = cKeysDown[i+1];
cKeysVelocity[i] = cKeysVelocity[i+1];
}
cKeysDown[kMaxNotes-1] = 0;
cKeysVelocity[kMaxNotes-1] = 0;
}
void killThisNoteLater(const char note)
{
for (int i = 0; i < kMaxNotes; ++i)
{
if (cNotesToKill[i] == note)
break;
if (cNotesToKill[i] == 0)
{
cNotesToKill[i] = note;
break;
}
}
}
void setSampleRate(const int srate)
{
sampleRate = srate;
}
const MidiBuffer& processMidi(MidiBuffer& inMidiBuffer, const bool isPlaying,
const double ppqPosition,
const double ppqPositionOfLastBarStart,
const double bpm,
const int numSamples)
{
const int timeSig = meter[arpSet->timeMode];
// Loop though the midibuffer, take away note on/off, let the rest pass
{
outMidiBuffer.clear();
MidiBuffer::Iterator inBufferIterator(inMidiBuffer);
MidiMessage midiMessage(0xf4);
int sampleNumber;
while (inBufferIterator.getNextEvent(midiMessage, sampleNumber))
{
if (midiMessage.isNoteOn())
addNote(midiMessage.getNoteNumber(), midiMessage.getVelocity());
else if(midiMessage.isNoteOff())
dropNote(midiMessage.getNoteNumber());
else
outMidiBuffer.addEvent(midiMessage, sampleNumber);
}
}
// BarSync
const int samplesPerStep = int((60.0 / bpm) * sampleRate * 4) / timeSig;
if (isPlaying && arpSet->syncMode == 2)
{
if (doSync)
{
//offset sample count
sampleCount = int((ppqPosition - ppqPositionOfLastBarStart) * ((60 / bpm) * sampleRate));
//offset step count
nextStep = sampleCount / samplesPerStep;
//Cycle the counts
sampleCount = (sampleCount % samplesPerStep) + samplesPerStep - 10;
nextStep = nextStep % arpSet->length;
}
doSync = false;
}
else
{
doSync = true;
}
//***************************
if (cKeysDown[0])
{ //Keys are down
dead = false;
sampleCount += numSamples;
bool repeat = false;
do
{
repeat = false;
//***
if (sampleCount >= samplesPerStep)
{ //Play step
int offset = numSamples - (sampleCount - samplesPerStep);
bool doFail = true;
for (int i = 0; i < 5; ++i)
{
if((cKeysDown[i]!= 0) && (arpSet->grid[nextStep*5 + i]))
{ //we have a note to play
int vel;
switch (arpSet->velMode)
{
case 1:
vel = roundFloatToInt (arpSet->velocities[nextStep] * 127.0f);
break;
case 2:
vel = (int) cKeysVelocity[i];
break;
case 3:
vel = (int) cKeysVelocity[i] + roundFloatToInt (arpSet->velocities[nextStep] * 127.0f);
break;
default:
vel = 127;
break;
}
doFail = false;
notesPlaying = true;
killThisNoteLater(cKeysDown[i]);
outMidiBuffer.addEvent(MidiMessage::noteOn(1, cKeysDown[i], uint8(vel)), offset);
}
}
if (doFail)
{
switch (arpSet->failMode)
{
case 1: //normal
sampleCount -= samplesPerStep;
nextStep++;
nextStep = nextStep % arpSet->length;
break;
case 2: //skip one
//SampleCount -= SamplesPerStep;
nextStep++;
nextStep = nextStep % arpSet->length;
repeat = true;
break;
case 3: //skip two
//SampleCount -= SamplesPerStep;
nextStep += 2;
nextStep = nextStep % arpSet->length;
repeat = true;
break;
}
}
else
{
sampleCount -= samplesPerStep;
nextStep++;
nextStep = nextStep % arpSet->length; //Cycle the steps over pattern length
}
}
} while (repeat);
//***
unsigned int NoteLength = (samplesPerStep / 4) * 3;
if ((sampleCount >= NoteLength) && notesPlaying)
{ //Mute step
int offset = numSamples - (sampleCount - NoteLength);
//***
for(int i = 0; i < kMaxNotes; ++i)
{
if (cNotesToKill[i] != 0)
{ //do we have a note to kill?
outMidiBuffer.addEvent(MidiMessage::noteOff(1, cNotesToKill[i]), offset);
cNotesToKill[i] = 0;
}
}
notesPlaying = false;
}
//***
}
else if (! dead)
{ //No keys pressed - kill 'em all
for (int i = 0; i < kMaxNotes; ++i)
{
if (cNotesToKill[i] != 0)
{ //do we have a note to kill?
outMidiBuffer.addEvent(MidiMessage::noteOff(1, cNotesToKill[i]), 0);
cNotesToKill[i] = 0;
}
}
nextStep = 0;
sampleCount = samplesPerStep;
dead = true;
}
return outMidiBuffer;
}
private:
const VexArpSettings* arpSet;
MidiBuffer outMidiBuffer;
bool dead, notesPlaying, doSync;
char nextStep;
unsigned int sampleCount, sampleRate;
int meter[4];
char cKeysDown[kMaxNotes];
char cKeysVelocity[kMaxNotes];
char cNotesToKill[kMaxNotes];
};
#endif

+ 0
- 1
source/modules/carla_native/vex/cArpSettings.h View File

@@ -1 +0,0 @@
/home/falktx/Personal/FOSS/GIT/distrho/ports/vex/source/synth/cArpSettings.h

+ 83
- 0
source/modules/carla_native/vex/cArpSettings.h View File

@@ -0,0 +1,83 @@
/*
==============================================================================
This file is part of the JUCETICE project - Copyright 2008 by Lucio Asnaghi.
JUCETICE is based around the JUCE library - "Jules' Utility Class Extensions"
Copyright 2008 by Julian Storer.
------------------------------------------------------------------------------
JUCE and JUCETICE can be redistributed and/or modified under the terms of
the GNU Lesser General Public License, as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
JUCE and JUCETICE are distributed in the hope that they 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 Lesser General Public License
along with JUCE and JUCETICE; if not, visit www.gnu.org/licenses or write to
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
==============================================================================
@author rockhardbuns
@tweaker Lucio Asnaghi
==============================================================================
*/
#ifndef __JUCETICE_VEXPEGGYSETTINGS_HEADER__
#define __JUCETICE_VEXPEGGYSETTINGS_HEADER__
struct VexArpSettings
{
static const int kVelocitiesSize = 16;
static const int kGridSize = kVelocitiesSize*5;
int length; // 1-16 (16=kVelocitiesSize)
int timeMode; // timeSig, 0-3 (4, 8, 16, 32), 0 is unused
int syncMode; // 1, 2 (key sync, bar sync)
int failMode; // 1, 2 or 3 (normal, skip one, skip two)
int velMode; // 1, 2 or 3
float velocities[kVelocitiesSize];
bool grid[kGridSize];
bool on;
VexArpSettings()
: length(8),
timeMode(2),
syncMode(1),
failMode(1),
velMode(1),
on(false)
{
for (int i = 0; i < kVelocitiesSize; ++i)
velocities[i] = 0.5f;
for (int i = 0; i < kGridSize; ++i)
grid[i] = false;
}
void reset()
{
length = 8;
timeMode = 2;
syncMode = 1;
failMode = 1;
velMode = 1;
on = false;
for (int i = 0; i < kVelocitiesSize; ++i)
velocities[i] = 0.5f;
for (int i = 0; i < kGridSize; ++i)
grid[i] = false;
}
};
#endif

+ 0
- 1
source/modules/carla_native/vex/cChorus.h View File

@@ -1 +0,0 @@
/home/falktx/Personal/FOSS/GIT/distrho/ports/vex/source/synth/cChorus.h

+ 156
- 0
source/modules/carla_native/vex/cChorus.h View File

@@ -0,0 +1,156 @@
/*
==============================================================================
This file is part of the JUCETICE project - Copyright 2008 by Lucio Asnaghi.
JUCETICE is based around the JUCE library - "Jules' Utility Class Extensions"
Copyright 2008 by Julian Storer.
------------------------------------------------------------------------------
JUCE and JUCETICE can be redistributed and/or modified under the terms of
the GNU Lesser General Public License, as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
JUCE and JUCETICE are distributed in the hope that they 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 Lesser General Public License
along with JUCE and JUCETICE; if not, visit www.gnu.org/licenses or write to
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
==============================================================================
@author rockhardbuns
@tweaker Lucio Asnaghi
==============================================================================
*/
#ifndef __JUCETICE_VEXCCHORUS_HEADER__
#define __JUCETICE_VEXCCHORUS_HEADER__
#ifdef CARLA_EXPORT
#include "JuceHeader.h"
#else
#include "../StandardHeader.h"
#endif
class VexChorus
{
public:
VexChorus(const float* const p)
: lfo1(0.0f),
lfo2(0.0f),
lastlfo1(0.0f),
lastlfo2(0.0f),
parameters(p),
sampleRate(44100.0f),
cycle(44100 / 32),
iRead(cycle * 0.5f),
iWrite(0),
buffer(2, cycle)
{
lfoS[0] = 0.5f;
lfoS[1] = 0.0f;
buffer.clear();
}
void updateParameterPtr(const float* const p)
{
parameters = p;
}
void setSampleRate(const float s)
{
if (sampleRate == s)
return;
sampleRate = s;
cycle = int(sampleRate / 32);
iRead = int(cycle * 0.5f);
iWrite = 0;
buffer.setSize(2, cycle, false, false, true);
buffer.clear();
}
void processBlock(AudioSampleBuffer* const outBuffer)
{
processBlock(outBuffer->getSampleData(0, 0), outBuffer->getSampleData(1, 0), outBuffer->getNumSamples());
}
void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples)
{
#ifdef CARLA_EXPORT
const float depth = parameters[0] * 0.2f;
const float speed = parameters[1] * parameters[1];
#else
const float depth = parameters[77] * 0.2f;
const float speed = parameters[76] * parameters[76];
#endif
const int delay = int(cycle * 0.5f);
const float lfoC = 2.0f * sinf(float_Pi * (speed * 5.0f) / sampleRate);
float* const bufferL = buffer.getSampleData(0, 0);
float* const bufferR = buffer.getSampleData(1, 0);
float a, b, alpha, readpoint;
int rp;
for (int i = 0; i < numSamples ; ++i)
{
// LFO
lfoS[0] = lfoS[0] - lfoC*lfoS[1];
lfoS[1] = lfoS[1] + lfoC*lfoS[0];
lastlfo1 = lfo1;
lastlfo2 = lfo2;
lfo1 = (lfoS[0] + 1) * depth;
lfo2 = (lfoS[1] + 1) * depth;
// Write to buffer
bufferL[iWrite] = outBufferL[i];
bufferR[iWrite] = outBufferR[i];
iWrite++; //inc and cycle the write index
iWrite = iWrite % cycle;
iRead = iWrite + delay; //cycle the read index
iRead = iRead % cycle;
// Read left
readpoint = cycle * lfo1 * 0.5f;
rp = roundFloatToInt(readpoint - 0.5f);
alpha = readpoint - rp;
a = bufferL[(iRead + rp -1) % cycle];
b = bufferL[(iRead + rp) % cycle];
outBufferL[i] = a + alpha * (b - a);
// Read right
readpoint = cycle * lfo2 * 0.5f;
rp = roundFloatToInt(readpoint - 0.5f);
alpha = readpoint - rp;
a = bufferR[(iRead + rp -1) % cycle];
b = bufferR[(iRead + rp) % cycle];
outBufferR[i] = a + alpha * (b - a);
}
}
private:
float lfo1, lfo2, lastlfo1, lastlfo2;
float lfoS[2];
const float* parameters;
float sampleRate;
int cycle;
int iRead, iWrite;
AudioSampleBuffer buffer;
};
#endif

+ 0
- 1
source/modules/carla_native/vex/cDelay.h View File

@@ -1 +0,0 @@
/home/falktx/Personal/FOSS/GIT/distrho/ports/vex/source/synth/cDelay.h

+ 128
- 0
source/modules/carla_native/vex/cDelay.h View File

@@ -0,0 +1,128 @@
/*
==============================================================================
This file is part of the JUCETICE project - Copyright 2008 by Lucio Asnaghi.
JUCETICE is based around the JUCE library - "Jules' Utility Class Extensions"
Copyright 2008 by Julian Storer.
------------------------------------------------------------------------------
JUCE and JUCETICE can be redistributed and/or modified under the terms of
the GNU Lesser General Public License, as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
JUCE and JUCETICE are distributed in the hope that they 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 Lesser General Public License
along with JUCE and JUCETICE; if not, visit www.gnu.org/licenses or write to
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
==============================================================================
@author rockhardbuns
@tweaker Lucio Asnaghi
==============================================================================
*/
#ifndef __JUCETICE_VEXCDELAY_HEADER__
#define __JUCETICE_VEXCDELAY_HEADER__
#ifdef CARLA_EXPORT
#include "JuceHeader.h"
#else
#include "../StandardHeader.h"
#endif
class VexDelay
{
public:
VexDelay(const float* const p)
: parameters(p),
sampleRate(44100),
bufferSize(sampleRate*2),
iRead(0),
iWrite(0),
buffer(2, bufferSize)
{
buffer.clear();
}
void updateParameterPtr(const float* const p)
{
parameters = p;
}
void setSampleRate(const float s)
{
if (sampleRate == s)
return;
sampleRate = s;
bufferSize = sampleRate * 2;
iRead = 0;
iWrite = 0;
buffer.setSize(2, bufferSize, false, false, true);
buffer.clear();
}
void processBlock(AudioSampleBuffer* const outBuffer, double bpm)
{
processBlock(outBuffer->getSampleData(0, 0), outBuffer->getSampleData(1, 0), outBuffer->getNumSamples(), bpm);
}
void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples, double bpm)
{
bpm = jlimit(10.0, 500.0, bpm);
#ifdef CARLA_EXPORT
const int delay = jmin(int(parameters[0]) * int(((60.0 / bpm) * sampleRate) / 4.0), 44100);
const float feedback = parameters[1]/100.0f;
#else
const int delay = jmin(int(parameters[73] * 8.0) * int(((60.0 / bpm) * sampleRate) / 4.0), 44100);
const float feedback = parameters[74];
#endif
float* const bufferL = buffer.getSampleData(0, 0);
float* const bufferR = buffer.getSampleData(1, 0);
for (int i = 0; i < numSamples; ++i)
{
iRead = iWrite - delay;
if (iRead < 0)
iRead += (int)sampleRate;
bufferL[iWrite] = outBufferL[i];
bufferR[iWrite] = outBufferR[i];
bufferR[iWrite] += bufferL[iRead] * feedback;
bufferL[iWrite] += bufferR[iRead] * feedback;
jassert(i < numSamples);
jassert(iRead < bufferSize);
jassert(iWrite < bufferSize);
outBufferL[i] = bufferL[iRead];
outBufferR[i] = bufferR[iRead];
if (++iWrite == sampleRate)
iWrite = 0;
}
}
private:
const float* parameters;
float sampleRate;
int bufferSize, iRead, iWrite;
AudioSampleBuffer buffer;
};
#endif

+ 0
- 1
source/modules/carla_native/vex/cReverb.h View File

@@ -1 +0,0 @@
/home/falktx/Personal/FOSS/GIT/distrho/ports/vex/source/synth/cReverb.h

+ 84
- 0
source/modules/carla_native/vex/cReverb.h View File

@@ -0,0 +1,84 @@
/*
==============================================================================
This file is part of the JUCETICE project - Copyright 2008 by Lucio Asnaghi.
JUCETICE is based around the JUCE library - "Jules' Utility Class Extensions"
Copyright 2008 by Julian Storer.
------------------------------------------------------------------------------
JUCE and JUCETICE can be redistributed and/or modified under the terms of
the GNU Lesser General Public License, as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
JUCE and JUCETICE are distributed in the hope that they 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 Lesser General Public License
along with JUCE and JUCETICE; if not, visit www.gnu.org/licenses or write to
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
==============================================================================
@author rockhardbuns
@tweaker Lucio Asnaghi
==============================================================================
*/
#ifndef __JUCETICE_VEXCREVERB_HEADER__
#define __JUCETICE_VEXCREVERB_HEADER__
#ifdef CARLA_EXPORT
#include "JuceHeader.h"
#else
#include "../StandardHeader.h"
#endif
#include "freeverb/revmodel.hpp"
class VexReverb
{
public:
VexReverb(const float* const p)
: parameters(p)
{
model.setwet(1.0f);
model.setdry(0.0f);
}
void updateParameterPtr(const float* const p)
{
parameters = p;
}
void processBlock(AudioSampleBuffer* const outBuffer)
{
processBlock(outBuffer->getSampleData(0, 0), outBuffer->getSampleData(1, 0), outBuffer->getNumSamples());
}
void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples)
{
#ifdef CARLA_EXPORT
model.setroomsize(parameters[0]);
model.setdamp(parameters[1]);
model.setwidth(parameters[2]);
#else
model.setroomsize(parameters[79]);
model.setdamp(parameters[81]);
model.setwidth(parameters[80]);
#endif
model.processreplace(outBufferL, outBufferR, outBufferL, outBufferR, numSamples, 1);
}
private:
revmodel model;
const float* parameters;
};
#endif

+ 0
- 1
source/modules/carla_native/vex/freeverb View File

@@ -1 +0,0 @@
/home/falktx/Personal/FOSS/GIT/distrho/ports/vex/source/synth/freeverb

Loading…
Cancel
Save