Window Sysex import fix and LowPass filter

pull/1/head
asb2m10 11 years ago
parent f782bb00b3
commit 11a9286a88
  1. BIN
      Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate
  2. 3
      Source/PluginEditor.cpp
  3. 13
      Source/PluginFx.cpp
  4. 8
      Source/PluginProcessor.cpp

@ -135,8 +135,7 @@ void DexedAudioProcessorEditor::buttonClicked(Button *buttonThatWasClicked) {
if ( fc.browseForFileToOpen()) {
String f = fc.getResults().getReference(0).getFullPathName();
uint8_t syx_data[4104];
ifstream fp_in;
fp_in.open(f.toRawUTF8(), ifstream::in);
ifstream fp_in(f.toRawUTF8(), ios::binary);
if (fp_in.fail()) {
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon,
"Error",

@ -13,6 +13,7 @@
#include "math.h"
#include "PluginFx.h"
#include "PluginProcessor.h"
static float gaintable[199] = {
0.999969, 0.990082, 0.980347, 0.970764, 0.961304, 0.951996, 0.94281, 0.933777, 0.924866, 0.916077, 0.90741, 0.898865, 0.890442,
@ -45,7 +46,7 @@ static inline float crossfade(float amount, float a, float b) {
}
void PluginFx::init(int sampleRate) {
uiCutoff = 0;
uiCutoff = 1;
uiReso = 0;
srate = sampleRate;
output = 0;
@ -54,10 +55,16 @@ void PluginFx::init(int sampleRate) {
}
void PluginFx::process(float *work, int sampleSize) {
// don't apply the LPF if the cutoff is to maximum
if ( uiCutoff == 1 )
return;
// the UI values haved changed
if ( uiCutoff != pCutoff || uiReso != pReso) {
// calc cutoff
float freqCutoff = uiCutoff * 22000;
// mel scale freq : http://www.speech.kth.se/~giampi/auditoryscales/
float freqCutoff = 700 * (pow(M_E,(uiCutoff*4000/1127)-1)) + 20;
float fc = 2 * freqCutoff / srate;
float x2 = fc*fc;
float x3 = fc*x2;
@ -74,7 +81,7 @@ void PluginFx::process(float *work, int sampleSize) {
}
for (int i=0; i < sampleSize; i++ ) {
output = 0.25 * ( work[i] - output ); //negative feedback
output = 0.10 * ( work[i] - output ); //negative feedback
for(int pole=0; pole < 4; pole++) {
float temp = state[pole];
output = saturate( output + p * (output - temp));

@ -58,7 +58,8 @@ void DexedAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)
Freqlut::init(sampleRate);
Lfo::init(sampleRate);
PitchEnv::init(sampleRate);
fx.init(sampleRate);
for (int note = 0; note < MAX_ACTIVE_NOTES; ++note) {
voices[note].dx7_note = new Dx7Note;
voices[note].keydown = false;
@ -136,7 +137,7 @@ void DexedAudioProcessor::processBlock(AudioSampleBuffer& buffer, MidiBuffer& mi
channelData[i] = (double) f;
}
//fx.process(channelData, numSamples);
fx.process(channelData, numSamples);
// DX7 is a mono synth
for (int channel = 1; channel < getNumInputChannels(); ++channel) {
@ -176,8 +177,6 @@ void DexedAudioProcessor::processMidiMessage(MidiMessage *msg) {
TRACE("not a yamaha sysex %d", buf[0]);
return;
}
TRACE("buf 2 %d", buf[2]);
// single voice dump
if ( buf[2] == 0 ) {
@ -313,6 +312,7 @@ void DexedAudioProcessor::processSamples(int n_samples, int16_t *buffer) {
int32_t val = audiobuf.get()[j] >> 4;
int clip_val = val < -(1 << 24) ? 0x8000 : val >= (1 << 24) ? 0x7fff :
val >> 9;
val = val & 0x0FFF7000;
// TODO: maybe some dithering?
if (j < jmax) {
buffer[i + j] = clip_val;

Loading…
Cancel
Save