diff options
-rw-r--r-- | lvz/gendata.cpp | 47 | ||||
-rw-r--r-- | src/mdaSpecMeter.bmp | bin | 73678 -> 0 bytes | |||
-rw-r--r-- | src/mdaSpecMeter.cpp | 503 | ||||
-rw-r--r-- | src/mdaSpecMeter.h | 87 | ||||
-rw-r--r-- | src/mdaSpecMeter.png | bin | 3869 -> 0 bytes | |||
-rw-r--r-- | src/mdaSpecMeterGUI.cpp | 210 | ||||
-rw-r--r-- | src/mdaSpecMeterGUI.h | 62 | ||||
-rwxr-xr-x | src/pre_merge.sh | 1 |
8 files changed, 4 insertions, 906 deletions
diff --git a/lvz/gendata.cpp b/lvz/gendata.cpp index dac5dc7..8d82efa 100644 --- a/lvz/gendata.cpp +++ b/lvz/gendata.cpp @@ -26,7 +26,6 @@ #include <dlfcn.h> #include "audioeffectx.h" -#include "AEffEditor.hpp" using namespace std; @@ -44,10 +43,9 @@ struct Record { UIs uis; }; + typedef std::map<string, Record> Manifest; Manifest manifest; -typedef std::map<string, Record> GUIManifest; -GUIManifest gui_manifest; string @@ -158,27 +156,6 @@ write_plugin(AudioEffectX* effect, const string& lib_file_name) void -write_gui(AEffEditor* gui, const string& lib_file_name) -{ - const string base_name = lib_file_name.substr(0, lib_file_name.find_last_of(".")); - assert(gui_manifest.find(gui->getURI()) == gui_manifest.end()); - gui_manifest.insert(std::make_pair(gui->getURI(), Record(base_name))); - Manifest::iterator plugin_record = manifest.find(lib_file_name); - if (plugin_record != manifest.end()) { - plugin_record->second.uis.push_back(gui->getPluginURI()); - } - Manifest::iterator i = manifest.find(gui->getPluginURI()); - if (i != manifest.end()) { - i->second.uis.push_back(gui->getURI()); - } else { - Record r("ERRNOBASE"); - r.uis.push_back(gui->getURI()); - manifest.insert(std::make_pair(gui->getPluginURI(), r)); - } -} - - -void write_manifest(ostream& os) { os << "@prefix lv2: <http://lv2plug.in/ns/lv2core#> ." << endl; @@ -193,13 +170,6 @@ write_manifest(ostream& os) os << ";" << endl << "\tuiext:ui <" << *j << "> "; os << "." << endl << endl; } - - for (GUIManifest::iterator i = gui_manifest.begin(); i != gui_manifest.end(); ++i) { - Record& r = i->second; - os << "<" << i->first << "> a uiext:GtkUI ;" << endl; - os << "\trdfs:seeAlso <" << r.base_name << ".ttl> ;" << endl; - os << "\tuiext:binary <" << r.base_name << ".so> ." << endl << endl; - } } @@ -216,13 +186,10 @@ main(int argc, char** argv) } typedef AudioEffectX* (*new_effect_func)(); - typedef AEffEditor* (*new_gui_func)(); typedef AudioEffectX* (*plugin_uri_func)(); - new_effect_func constructor = NULL; - new_gui_func gui_constructor = NULL; - AudioEffectX* effect = NULL; - AEffEditor* gui = NULL; + new_effect_func constructor = NULL; + AudioEffectX* effect = NULL; for (int i = 1; i < argc; ++i) { void* handle = dlopen(argv[i], RTLD_LAZY); @@ -242,13 +209,7 @@ main(int argc, char** argv) write_plugin(effect, lib_path); } - gui_constructor = (new_gui_func)dlsym(handle, "lvz_new_aeffeditor"); - if (gui_constructor != NULL) { - gui = gui_constructor(); - write_gui(gui, lib_path); - } - - if (constructor == NULL && gui_constructor == NULL) { + if (constructor == NULL) { cerr << "ERROR: " << argv[i] << ": not an LVZ plugin library, ignoring" << endl; } diff --git a/src/mdaSpecMeter.bmp b/src/mdaSpecMeter.bmp Binary files differdeleted file mode 100644 index 0374930..0000000 --- a/src/mdaSpecMeter.bmp +++ /dev/null diff --git a/src/mdaSpecMeter.cpp b/src/mdaSpecMeter.cpp deleted file mode 100644 index 100724b..0000000 --- a/src/mdaSpecMeter.cpp +++ /dev/null @@ -1,503 +0,0 @@ -/* - Copyright 2008-2011 David Robillard <http://drobilla.net> - Copyright 2002 Paul Kellett (Maxim Digital Audio) - - This is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - This software is distributed in the hope that it 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 General Public License - along with this software. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <stdio.h> -#include <string.h> -#include <float.h> -#include <math.h> - -#include "mdaSpecMeter.h" -//#include "mdaSpecMeterGUI.h" -//#include "AEffEditor.hpp" - -AudioEffect * -createEffectInstance (audioMasterCallback audioMaster) -{ - return new mdaSpecMeter (audioMaster); -} - -mdaSpecMeterProgram::mdaSpecMeterProgram () -{ - param[_PARAM0] = 0.5; - //param[_PARAM1] = 0.5; - //param[_PARAM2] = 0.75; - strcpy (name, "default"); -} - - -mdaSpecMeter::mdaSpecMeter (audioMasterCallback audioMaster):AudioEffectX (audioMaster, 1, - NPARAMS) -{ - //editor = new mdaSpecMeterGUI(this); - - programs = new mdaSpecMeterProgram[numPrograms]; - if (programs) { - setProgram (0); - } - - setNumInputs (2); - setNumOutputs (2); - DECLARE_LVZ_DEPRECATED (canMono) (); - setUniqueID ("mdaSpecMeter"); - canProcessReplacing (); - - //initialise... - K = counter = 0; - kmax = 2048; - topband = 11; - iK = 1.0f / (float) kmax; - den = 1.0e-8f; - - //buffer = new float[44100]; - - suspend (); -} - -bool -mdaSpecMeter::getProductString (char *text) -{ - strcpy (text, "MDA SpecMeter"); - return true; -} - -bool -mdaSpecMeter::getVendorString (char *text) -{ - strcpy (text, "mda"); - return true; -} - -bool -mdaSpecMeter::getEffectName (char *name) -{ - strcpy (name, "SpecMeter"); - return true; -} - -void -mdaSpecMeter::suspend () -{ - Lpeak = Rpeak = Lrms = Rrms = Corr = 0.0f; - lpeak = rpeak = lrms = rrms = corr = 0.0f; - Lhold = Rhold = 0.0f; - Lmin = Rmin = 0.0000001f; - for (LvzInt32 i = 0; i < 16; i++) { - band[0][i] = band[1][i] = 0.0f; - for (LvzInt32 j = 0; j < 6; j++) - lpp[j][i] = rpp[j][i] = 0.0f; - } - - //memset(buffer, 0, size * sizeof (float)); -} - -void -mdaSpecMeter::setSampleRate(float sampleRate) -{ - AudioEffectX::setSampleRate(sampleRate); - if(sampleRate > 64000) { topband = 12; kmax = 4096; } - else { topband = 11; kmax = 2048; } - iK = 1.0f / (float)kmax; -} - -mdaSpecMeter::~mdaSpecMeter () -{ - //if(buffer) delete [] buffer; - if (programs) - delete[]programs; -} - - -void -mdaSpecMeter::setProgramName (char *name) -{ - strcpy (programs[curProgram].name, name); -} - -void -mdaSpecMeter::getProgramName (char *name) -{ - strcpy (name, programs[curProgram].name); -} - - -bool -mdaSpecMeter::getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name) -{ - if ((unsigned int)index < NPROGS) { - strcpy(name, programs[index].name); - return true; - } - return false; -} - -float -mdaSpecMeter::getParameter (LvzInt32 index) -{ - return programs[curProgram].param[index]; -} - -void -mdaSpecMeter::setProgram (LvzInt32 program) -{ - mdaSpecMeterProgram *p = &programs[program]; - curProgram = program; - setProgramName (p->name); - for (long i = 0; i < NPARAMS; i++) - setParameter (i, p->param[i]); -} - -////////////////////////////////////////////////////////////////////////////////// - -void -mdaSpecMeter::setParameter (LvzInt32 index, float value) -{ - programs[curProgram].param[index] = value; - - switch (index) { - case _PARAM0: - gain = (float)pow(10.0f, 2.0f * programs[curProgram].param[index] - 1.0f); - break; - - default: - break; - } - - //if(editor) editor->postUpdate(); -} - - -void -mdaSpecMeter::getParameterName (LvzInt32 index, char *label) -{ - switch (index) { - case _PARAM0: - strcpy (label, "Gain"); - break; - default: - strcpy (label, ""); - } -} - - -void -mdaSpecMeter::getParameterDisplay (LvzInt32 index, char *text) -{ - char string[16]; - float * param = programs[curProgram].param; - - switch (index) { - case _PARAM0: - sprintf(string, "%.1f", 40.0f * param[index] - 20.0f); - break; - /*case _PARAM1: - strcpy (string, ""); - break;*/ - default: - sprintf(string, "%.0f", 100.0f * param[index]); - } - string[8] = 0; - strcpy (text, (char *) string); -} - - -void -mdaSpecMeter::getParameterLabel (LvzInt32 index, char *label) -{ - switch (index) { - case _PARAM0: - strcpy (label, ""); - break; - default: - strcpy (label, ""); - } -} - -////////////////////////////////////////////////////////////////////////////////// - -void -mdaSpecMeter::process (float **inputs, float **outputs, LvzInt32 sampleFrames) -{ - float *in1 = inputs[0]; - float *in2 = inputs[1]; - float *out1 = outputs[0]; - float *out2 = outputs[1]; - - den = -den; - float l, r, p, q, iN = iK; - long k = K, j0 = topband, mask, j; - - while (--sampleFrames >= 0) { - l = *in1++; - r = *in2++; - *out1++ += l; - *out2++ += r; - - l += den; //anti-denormal - r += den; - - lrms += l * l; //RMS integrate - rrms += r * r; - - p = (float) fabs (l); - if (p > lpeak) - lpeak = p; //peak detect - q = (float) fabs (r); - if (q > rpeak) - rpeak = q; - /* - if(p > 1.0e-8f && p < lmin) lmin = p; //'trough' detect - if(q > 1.0e-8f && q < rmin) rmin = q; - */ - if ((l * r) > 0.0f) - corr += iN; //measure correlation - - j = j0; - mask = k << 1; - - do { //polyphase filter bank - p = lpp[0][j] + 0.208f * l; - lpp[0][j] = lpp[1][j]; - lpp[1][j] = l - 0.208f * p; - - q = lpp[2][j] + lpp[4][j] * 0.682f; - lpp[2][j] = lpp[3][j]; - lpp[3][j] = lpp[4][j] - 0.682f * q; - lpp[4][j] = l; - lpp[5][j] += (float) fabs (p - q); //top octave - l = p + q; //lower octaves - - p = rpp[0][j] + 0.208f * r; - rpp[0][j] = rpp[1][j]; - rpp[1][j] = r - 0.208f * p; - - q = rpp[2][j] + rpp[4][j] * 0.682f; - rpp[2][j] = rpp[3][j]; - rpp[3][j] = rpp[4][j] - 0.682f * q; - rpp[4][j] = r; - rpp[5][j] += (float) fabs (p - q); //top octave - r = p + q; //lower octaves - - j--; - mask >>= 1; - } while (mask & 1); - - if (++k == kmax) { - k = 0; - counter++; //editor waits for this to change - - if (lpeak == 0.0f) - Lpeak = Lrms = 0.0f; - else { ///add limits here! - if (lpeak > 2.0f) - lpeak = 2.0f; - if (lpeak >= Lpeak) { - Lpeak = lpeak; - Lhold = 2.0f * Lpeak; - } else { - Lhold *= 0.95f; - if (Lhold < Lpeak) - Lpeak = Lhold; - } - Lmin = lmin; - lmin *= 1.01f; - Lrms += 0.2f * (iN * lrms - Lrms); - } - - if (rpeak == 0.0f) - Rpeak = Rrms = 0.0f; - else { - if (rpeak > 2.0f) - rpeak = 2.0f; - if (rpeak >= Rpeak) { - Rpeak = rpeak; - Rhold = 2.0f * Rpeak; - } else { - Rhold *= 0.95f; - if (Rhold < Rpeak) - Rpeak = Rhold; - } - Rmin = rmin; - rmin *= 1.01f; - Rrms += 0.2f * (iN * rrms - Rrms); - } - - rpeak = lpeak = lrms = rrms = 0.0f; - Corr += 0.1f * (corr - Corr); //correlation - corr = SILENCE; - - float dec = 0.08f; - for (j = 0; j < 13; j++) { //spectrum output - band[0][j] += dec * (iN * lpp[5][j] - band[0][j]); - if (band[0][j] > 2.0f) - band[0][j] = 2.0f; - else if (band[0][j] < 0.014f) - band[0][j] = 0.014f; - - band[1][j] += dec * (iN * rpp[5][j] - band[1][j]); - if (band[1][j] > 2.0f) - band[1][j] = 2.0f; - else if (band[1][j] < 0.014f) - band[1][j] = 0.014f; - - rpp[5][j] = lpp[5][j] = SILENCE; - dec = dec * 1.1f; - } - } - } - - K = k; -} - -////////////////////////////////////////////////////////////////////////////////// - -void -mdaSpecMeter::processReplacing (float **inputs, float **outputs, - LvzInt32 sampleFrames) -{ - float *in1 = inputs[0]; - float *in2 = inputs[1]; - float *out1 = outputs[0]; - float *out2 = outputs[1]; - - den = -den; - float l, r, p, q, iN = iK; - long k = K, j0 = topband, mask, j; - - while (--sampleFrames >= 0) { - l = *in1++; - r = *in2++; - *out1++ = l; - *out2++ = r; - - l += den; //anti-denormal - r += den; - - lrms += l * l; //RMS integrate - rrms += r * r; - - p = (float) fabs (l); - if (p > lpeak) - lpeak = p; //peak detect - q = (float) fabs (r); - if (q > rpeak) - rpeak = q; - /* - if(p > 1.0e-8f && p < lmin) lmin = p; //'trough' detect - if(q > 1.0e-8f && q < rmin) rmin = q; - */ - if ((l * r) > 0.0f) - corr += iN; //measure correlation - - j = j0; - mask = k << 1; - - do { //polyphase filter bank - p = lpp[0][j] + 0.208f * l; - lpp[0][j] = lpp[1][j]; - lpp[1][j] = l - 0.208f * p; - - q = lpp[2][j] + lpp[4][j] * 0.682f; - lpp[2][j] = lpp[3][j]; - lpp[3][j] = lpp[4][j] - 0.682f * q; - lpp[4][j] = l; - lpp[5][j] += (float) fabs (p - q); //top octave - l = p + q; //lower octaves - - p = rpp[0][j] + 0.208f * r; - rpp[0][j] = rpp[1][j]; - rpp[1][j] = r - 0.208f * p; - - q = rpp[2][j] + rpp[4][j] * 0.682f; - rpp[2][j] = rpp[3][j]; - rpp[3][j] = rpp[4][j] - 0.682f * q; - rpp[4][j] = r; - rpp[5][j] += (float) fabs (p - q); //top octave - r = p + q; //lower octaves - - j--; - mask >>= 1; - } while (mask & 1); - - if (++k == kmax) { - k = 0; - //counter++; //editor waits for this to change - - if (lpeak == 0.0f) - Lpeak = Lrms = 0.0f; - else { ///add limits here! - if (lpeak > 2.0f) - lpeak = 2.0f; - if (lpeak >= Lpeak) { - Lpeak = lpeak; - Lhold = 2.0f * Lpeak; - } else { - Lhold *= 0.95f; - if (Lhold < Lpeak) - Lpeak = Lhold; - } - Lmin = lmin; - lmin *= 1.01f; - Lrms += 0.2f * (iN * lrms - Lrms); - } - - if (rpeak == 0.0f) - Rpeak = Rrms = 0.0f; - else { - if (rpeak > 2.0f) - rpeak = 2.0f; - if (rpeak >= Rpeak) { - Rpeak = rpeak; - Rhold = 2.0f * Rpeak; - } else { - Rhold *= 0.95f; - if (Rhold < Rpeak) - Rpeak = Rhold; - } - Rmin = rmin; - rmin *= 1.01f; - Rrms += 0.2f * (iN * rrms - Rrms); - } - - rpeak = lpeak = lrms = rrms = 0.0f; - Corr += 0.1f * (corr - Corr); //correlation - corr = SILENCE; - - float dec = 0.08f; - for (j = 0; j < 13; j++) { //spectrum output - band[0][j] += dec * (iN * lpp[5][j] - band[0][j]); - if (band[0][j] > 2.0f) - band[0][j] = 2.0f; - else if (band[0][j] < 0.014f) - band[0][j] = 0.014f; - - band[1][j] += dec * (iN * rpp[5][j] - band[1][j]); - if (band[1][j] > 2.0f) - band[1][j] = 2.0f; - else if (band[1][j] < 0.014f) - band[1][j] = 0.014f; - - rpp[5][j] = lpp[5][j] = SILENCE; - dec = dec * 1.1f; - } - - counter++; //editor waits for this to change - } - } - - K = k; -} diff --git a/src/mdaSpecMeter.h b/src/mdaSpecMeter.h deleted file mode 100644 index b23a92d..0000000 --- a/src/mdaSpecMeter.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright 2008-2011 David Robillard <http://drobilla.net> - Copyright 2002 Paul Kellett (Maxim Digital Audio) - - This is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - This software is distributed in the hope that it 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 General Public License - along with this software. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "audioeffectx.h" - -#include <string.h> - -#define NPROGS 4 //can hide decay settings in programs! fast...slow...peak hold -#define SILENCE 0.00000001f - -enum { - _PARAM0, //gain -// _PARAM0, //peak decay -// _PARAM1, //RMS speed -// _PARAM2, //spectrum speed -// _PARAM3, //peak reset? - - NPARAMS -}; - -class mdaSpecMeter; - -class mdaSpecMeterProgram -{ -friend class mdaSpecMeter; -public: - mdaSpecMeterProgram(); -private: - float param[NPARAMS]; - char name[24]; -}; - - -class mdaSpecMeter : public AudioEffectX -{ -public: - mdaSpecMeter(audioMasterCallback audioMaster); - ~mdaSpecMeter(); - - virtual void process(float **inputs, float **outputs, LvzInt32 sampleFrames); - virtual void processReplacing(float **inputs, float **outputs, LvzInt32 sampleFrames); - virtual void setProgram(LvzInt32 program); - virtual void setProgramName(char *name); - virtual void getProgramName(char *name); - virtual bool getProgramNameIndexed (LvzInt32 category, LvzInt32 index, char* name); - virtual void setParameter(LvzInt32 index, float value); - virtual float getParameter(LvzInt32 index); - virtual void getParameterLabel(LvzInt32 index, char *label); - virtual void getParameterDisplay(LvzInt32 index, char *text); - virtual void getParameterName(LvzInt32 index, char *text); - virtual void setSampleRate(float sampleRate); - virtual void suspend(); - - virtual bool getEffectName(char *name); - virtual bool getVendorString(char *text); - virtual bool getProductString(char *text); - virtual LvzInt32 getVendorVersion() { return 1000; } - - //accessible from editor - LvzInt32 counter; - float Lpeak, Lhold, Lmin, Lrms, Rpeak, Rhold, Rmin, Rrms, Corr; // #11 #12 - float band[2][16]; //8 16 31 64 125 250 500 1k 2k 4k 8k 16k 32k - -private: - mdaSpecMeterProgram *programs; - - float iK, lpeak, lmin, lrms, rpeak, rmin, rrms, corr, den; - float lpp[6][16], rpp[6][16]; - LvzInt32 topband, K, kmax; - - float gain; -}; diff --git a/src/mdaSpecMeter.png b/src/mdaSpecMeter.png Binary files differdeleted file mode 100644 index 220857d..0000000 --- a/src/mdaSpecMeter.png +++ /dev/null diff --git a/src/mdaSpecMeterGUI.cpp b/src/mdaSpecMeterGUI.cpp deleted file mode 100644 index bb88816..0000000 --- a/src/mdaSpecMeterGUI.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* - Copyright 2008-2011 David Robillard <http://drobilla.net> - Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) - - This is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - This software is distributed in the hope that it 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 General Public License - along with this software. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "mdaSpecMeterGUI.h" -#include "mdaSpecMeter.h" -#include <X11/Xlib.h> -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <gtk/gtk.h> - -#include <math.h> - -CResTable pngResources = { { 128, "mdaSpecMeter.png" } }; - -mdaSpecMeterGUI::mdaSpecMeterGUI(AudioEffect * effect) - : AEffGUIEditor(effect) - , background(NULL) -{ - background = new CBitmap(128); - rect.right = (LvzInt16) background->getWidth(); - rect.bottom = (LvzInt16) background->getHeight(); -} - - -mdaSpecMeterGUI::~mdaSpecMeterGUI() -{ - delete background; -} - - -long -mdaSpecMeterGUI::open(void *ptr) -{ - AEffGUIEditor::open(ptr); - - CPoint offs(0, 0); - CRect size(0, 0, background->getWidth(), background->getHeight()); - frame = new CFrame(size, ptr, this); - - size.offset(0, 0); - draw = new CDraw(size, 0.0f, background); - frame->addView(draw); - - return true; -} - - -void -mdaSpecMeterGUI::close() -{ - delete frame; - frame = 0; -} - - -void -mdaSpecMeterGUI::idle() -{ - LvzInt32 xnow = ((mdaSpecMeter *)effect)->counter; - if(xnow != xtimer) - { - xtimer = xnow; - - //if(draw) temp = draw->temp; - //if(label) label->setLabel(xtimer); - - if(draw) //copy data from effect (this can't be the best way!) - { - draw->Lpeak = ((mdaSpecMeter *)effect)->Lpeak; - draw->Lmin = ((mdaSpecMeter *)effect)->Lmin; - draw->Lrms = ((mdaSpecMeter *)effect)->Lrms; - draw->Rpeak = ((mdaSpecMeter *)effect)->Rpeak; - draw->Rmin = ((mdaSpecMeter *)effect)->Rmin; - draw->Rrms = ((mdaSpecMeter *)effect)->Rrms; - draw->Corr = ((mdaSpecMeter *)effect)->Corr; - for(LvzInt32 i=0; i<13; i++) - { - draw->band[0][i] = ((mdaSpecMeter *)effect)->band[0][i]; - draw->band[1][i] = ((mdaSpecMeter *)effect)->band[1][i]; - } - draw->setDirty(true); //trigger redraw - } - } - - AEffGUIEditor::idle(); -} - - -CDraw::CDraw(CRect & size, float value, CBitmap * background) : CControl(size) -{ - bitmap = background; - - Lpeak = Lmin = Lrms = Rpeak = Rmin = Rrms = Corr = 0.0f; - for (LvzInt32 i = 0; i < 16; i++) - band[0][i] = band[1][i] = 0.0f; - - setValue(value); -} - - -CDraw::~CDraw() -{ -} - - -void -CDraw::draw(CDrawContext *pContext) -{ - LvzInt32 r, p; - CRect block; - CRect rect(0, 0, bitmap->getWidth(), bitmap->getHeight()); - - bitmap->draw(pContext, rect); - /* - pContext->setFillColor(kGreenCColor); - - p = x2pix(Lmin); - block(p - 3, 10, p - 1, 18); - pContext->fillRect(block); - - p = x2pix(Rmin); - block(p - 3, 18, p - 1, 26); - pContext->fillRect(block); - */ - pContext->setFillColor(kBlackCColor); - - r = x22pix(Lrms); if(r > 454) r = 454; - p = x2pix(Lpeak); if(p > 454) p = 454; - block(r - 1, 10, p - 1, 18); - pContext->fillRect(block); - block(p - 1, 10, 478, 18); - if(p < 454) pContext->fillRect(block); - - r = x22pix(Rrms); if(r > 454) r = 454; - p = x2pix(Rpeak); if(p > 454) p = 454; - block(r - 1, 18, p - 1, 26); - pContext->fillRect(block); - block(p - 1, 18, 478, 26); - if(p < 454) pContext->fillRect(block); - - //block(x2pix(Rpeak), 18, 478, 26); - //buf->fillRect(block); - - block(235, 42, 244, 134 - (LvzInt32)(90 * Corr)); - pContext->fillRect(block); - - LvzInt32 i, x1=2, x2=256; //octave bands - float dB; - for(i=0; i<13; i++) - { - dB = band[0][i]; - block(x1, 42, x1+18, 49 - (LvzInt32)(20.0 * log(dB))); - pContext->fillRect(block); - x1 += 17; - - dB = band[1][i]; - block(x2, 42, x2+18, 49 - (LvzInt32)(20.0 * log(dB))); - pContext->fillRect(block); - x2 += 17; - } -} - - -LvzInt32 -CDraw::x2pix(float x) -{ - float dB = x; - LvzInt32 p = 478; - - if(x > 0.00000005f) dB = 8.6858896f * (float)log(x); else dB = -146.0f; - if(dB < -20.0) - p = 293 + (LvzInt32)(2.0f * dB); - else - p = 453 + (LvzInt32)(10.0f * dB); - - return p; -} - - -LvzInt32 -CDraw::x22pix(float x) //power version for squared summed -{ - float dB = x; - LvzInt32 p = 478; - - if(x > 0.00000005f) dB = 4.3429448f * (float)log(x); else dB = -146.0f; - if(dB < -20.0) - p = 293 + (LvzInt32)(2.0f * dB); - else - if(dB < 0.0f) p = 453 + (LvzInt32)(10.0f * dB); - - return p; -} - diff --git a/src/mdaSpecMeterGUI.h b/src/mdaSpecMeterGUI.h deleted file mode 100644 index edb0f9c..0000000 --- a/src/mdaSpecMeterGUI.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright 2008-2011 David Robillard <http://drobilla.net> - Copyright 1999-2000 Paul Kellett (Maxim Digital Audio) - - This is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - This software is distributed in the hope that it 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 General Public License - along with this software. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef _mdaSpecMeterGUI_h_ -#define _mdaSpecMeterGUI_h_ - -#include "vstgui.h" - - -class CDraw : public CControl -{ -public: - CDraw(CRect& size, float x, CBitmap* background); - ~CDraw(); - - void draw(CDrawContext *pContext); - LvzInt32 x2pix(float x); - LvzInt32 x22pix(float x); - - float Lpeak, Lrms, Lmin, Rpeak, Rrms, Rmin, Corr; - float band[2][16]; - LvzInt32 temp; - -protected: - CBitmap* bitmap; -}; - - -class mdaSpecMeterGUI : public AEffGUIEditor -{ -public: - mdaSpecMeterGUI(AudioEffect* effect); - ~mdaSpecMeterGUI(); - - long open(void* ptr); - void idle(); - void close(); - -private: - CDraw* draw; - CBitmap* background; - LvzInt32 xtimer; -}; - - -#endif // _mdaSpecMeterGUI_h_ - diff --git a/src/pre_merge.sh b/src/pre_merge.sh index e3a13d0..238118e 100755 --- a/src/pre_merge.sh +++ b/src/pre_merge.sh @@ -4,7 +4,6 @@ ln -fs mdaDeEss.h mdaDe-ess.h ln -fs mdaDeEss.cpp mdaDe-ess.cpp ln -fs mdaRePsycho.h mdaRePsycho!.h ln -fs mdaRePsycho.cpp mdaRePsycho!.cpp -ln -fs mdaSpecMeter.cpp mdaspecmeter.cpp sed -i 's/LvzInt32/VstInt32/g' *.h *.cpp sed -i 's/LvzInt16/VstInt16/g' *.h *.cpp |