Skip to content

Commit

Permalink
Reverb ready, add license.
Browse files Browse the repository at this point in the history
  • Loading branch information
BLumia committed Sep 11, 2016
1 parent fe9d983 commit ff9f4f5
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 16 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016 BLumia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 22 additions & 10 deletions Synthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ enum ELayout
kWidth = GUI_WIDTH,
kHeight = GUI_HEIGHT,
kKeybX = 12,
kKeybY = 226,
kKeybY = 297,
kGreenRow = 10,
kOrangeRow = 80,
kBlueRow = 150,
kPurpleRow = 220,
kSwitcherTopPadding = 10,
};

Expand All @@ -82,6 +83,7 @@ Synthesis::Synthesis(IPlugInstanceInfo instanceInfo)
IBitmap blueKnobBitmap = pGraphics->LoadIBitmap(BLUE_KNOB_ID, BLUE_KNOB_FN, 31);
IBitmap blueKnobCenterBitmap = pGraphics->LoadIBitmap(BLUE_KNOB_CENTER_ID, BLUE_KNOB_CENTER_FN, 31);
IBitmap orangeKnobBitmap = pGraphics->LoadIBitmap(ORANGE_KNOB_ID, ORANGE_KNOB_FN, 31);
IBitmap purpleKnobBitmap = pGraphics->LoadIBitmap(PURPLE_KNOB_ID, PURPLE_KNOB_FN, 31);
IBitmap waveformBitmap = pGraphics->LoadIBitmap(WAVEFORM_ID, WAVEFORM_FN, 5);
IBitmap filtermodeBitmap = pGraphics->LoadIBitmap(FILTERMODE_ID, FILTERMODE_FN, 3);
IBitmap switcherLightBitmap = pGraphics->LoadIBitmap(SWITCHER_LIGHT_ID, SWITCHER_LIGHT_FN, 2);
Expand Down Expand Up @@ -213,10 +215,15 @@ Synthesis::Synthesis(IPlugInstanceInfo instanceInfo)

// Reverb
GetParam(mVerbRoomSize)->InitDouble("Room Size", 0.5, 0.3, 0.99, 0.001);
pGraphics->AttachControl(new IKnobMultiControl(this, 137, kPurpleRow, mVerbRoomSize, &purpleKnobBitmap));
GetParam(mVerbDamp)->InitDouble("Dampening", 0.5, 0., 1., 0.001);
pGraphics->AttachControl(new IKnobMultiControl(this, 195, kPurpleRow, mVerbDamp, &purpleKnobBitmap));
GetParam(mVerbWidth)->InitDouble("Width", 1., -1., 1., 0.001);
pGraphics->AttachControl(new IKnobMultiControl(this, 255, kPurpleRow, mVerbWidth, &purpleKnobBitmap));
GetParam(mVerbDry)->InitDouble("Dry", 1., 0., 1., 0.001);
pGraphics->AttachControl(new IKnobMultiControl(this, 329, kPurpleRow, mVerbDry, &purpleKnobBitmap));
GetParam(mVerbWet)->InitDouble("Wet", 0.5, 0., 1., 0.001);
pGraphics->AttachControl(new IKnobMultiControl(this, 383, kPurpleRow, mVerbWet, &purpleKnobBitmap));

AttachGraphics(pGraphics);

Expand Down Expand Up @@ -247,26 +254,31 @@ void Synthesis::ProcessDoubleReplacing(double** inputs, double** outputs, int nF
return;
}
*/

double* ori_l;
double* ori_r;
ori_l = (double*)malloc(nFrames * sizeof(double));
ori_r = (double*)malloc(nFrames * sizeof(double));

double *leftOutput = outputs[0];
double *rightOutput = outputs[1];

processVirtualKeyboard();
for (int i = 0; i < nFrames; ++i) {
mMIDIReceiver.advance();

leftOutput[i] = rightOutput[i] = voiceManager.nextSample();
ori_l[i] = ori_r[i] = leftOutput[i] = rightOutput[i] = voiceManager.nextSample();

// Verb
mVerbEngine.ProcessSample(leftOutput, rightOutput);
// Reverb
mVerbEngine.ProcessSample(leftOutput + i, rightOutput + i);
// Mix dry/wet
/* FIXME: wtf bug idk
if (i == nFrames - 1) break;
*leftOutput++ = mWet * *leftOutput;
*rightOutput++ = mWet * *rightOutput;
*/
leftOutput[i] = mDry * ori_l[i] + mWet * leftOutput[i];
rightOutput[i] = mDry * ori_r[i] + mWet * rightOutput[i];

}

free(ori_l);
free(ori_r);

mMIDIReceiver.Flush(nFrames);
}

Expand Down
1 change: 1 addition & 0 deletions Synthesis.rc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ BLUE_KNOB_ID PNG BLUE_KNOB_FN
BLUE_KNOB_CENTER_ID PNG BLUE_KNOB_CENTER_FN
FILTERMODE_ID PNG FILTERMODE_FN
ORANGE_KNOB_ID PNG ORANGE_KNOB_FN
PURPLE_KNOB_ID PNG PURPLE_KNOB_FN
SWITCHER_LIGHT_ID PNG SWITCHER_LIGHT_FN

#ifdef SA_API
Expand Down
14 changes: 8 additions & 6 deletions resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ instrument determined by PLUG _IS _INST
#define WAVEFORM_ID 103
#define GREEN_KNOB_ID 104
#define BLUE_KNOB_ID 105
#define FILTERMODE_ID 106
#define BLUE_KNOB_CENTER_ID 107
#define ORANGE_KNOB_ID 108
#define GREEN_KNOB_CENTER_ID 109
#define SWITCHER_LIGHT_ID 110
#define FILTERMODE_ID 106
#define ORANGE_KNOB_ID 107
#define PURPLE_KNOB_ID 108
#define BLUE_KNOB_CENTER_ID 109
#define GREEN_KNOB_CENTER_ID 110
#define SWITCHER_LIGHT_ID 111

// Image resource locations for this plug.
#define BG_FN "resources/img/bg.png"
Expand All @@ -78,9 +79,10 @@ instrument determined by PLUG _IS _INST
#define GREEN_KNOB_FN "resources/img/greenknob.png"
#define BLUE_KNOB_FN "resources/img/blueknob.png"
#define FILTERMODE_FN "resources/img/filtermode.png"
#define ORANGE_KNOB_FN "resources/img/orangeknob.png"
#define PURPLE_KNOB_FN "resources/img/purpleknob.png"
#define GREEN_KNOB_CENTER_FN "resources/img/greenknob-center0.png"
#define BLUE_KNOB_CENTER_FN "resources/img/blueknob-center0.png"
#define ORANGE_KNOB_FN "resources/img/orangeknob.png"
#define SWITCHER_LIGHT_FN "resources/img/switcherlight.png"

// GUI default dimensions
Expand Down
Binary file modified resources/img/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/img/purpleknob.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ff9f4f5

Please sign in to comment.