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. 6
      Source/PluginProcessor.cpp

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

@ -13,6 +13,7 @@
#include "math.h" #include "math.h"
#include "PluginFx.h" #include "PluginFx.h"
#include "PluginProcessor.h"
static float gaintable[199] = { 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, 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) { void PluginFx::init(int sampleRate) {
uiCutoff = 0; uiCutoff = 1;
uiReso = 0; uiReso = 0;
srate = sampleRate; srate = sampleRate;
output = 0; output = 0;
@ -54,10 +55,16 @@ void PluginFx::init(int sampleRate) {
} }
void PluginFx::process(float *work, int sampleSize) { 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 // the UI values haved changed
if ( uiCutoff != pCutoff || uiReso != pReso) { if ( uiCutoff != pCutoff || uiReso != pReso) {
// calc cutoff // 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 fc = 2 * freqCutoff / srate;
float x2 = fc*fc; float x2 = fc*fc;
float x3 = fc*x2; float x3 = fc*x2;
@ -74,7 +81,7 @@ void PluginFx::process(float *work, int sampleSize) {
} }
for (int i=0; i < sampleSize; i++ ) { 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++) { for(int pole=0; pole < 4; pole++) {
float temp = state[pole]; float temp = state[pole];
output = saturate( output + p * (output - temp)); output = saturate( output + p * (output - temp));

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

Loading…
Cancel
Save