diff options
author | David Robillard <d@drobilla.net> | 2008-08-09 00:47:39 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-08-09 00:47:39 +0000 |
commit | de77c4beb69f2fc7f27424d2bd07a4d376e7bcdc (patch) | |
tree | 2085f7265a9fcbcdef415f57cb9c90db44320db9 /lvz | |
parent | 4772ada37bef92a628f76f3bde65ddd95c601a1e (diff) | |
download | mda.lv2-de77c4beb69f2fc7f27424d2bd07a4d376e7bcdc.tar.gz mda.lv2-de77c4beb69f2fc7f27424d2bd07a4d376e7bcdc.tar.bz2 mda.lv2-de77c4beb69f2fc7f27424d2bd07a4d376e7bcdc.zip |
Clean up port friendly names.
More data generation.
git-svn-id: http://svn.drobilla.net/lad/mda-lv2@1323 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'lvz')
-rw-r--r-- | lvz/audioeffectx.h | 16 | ||||
-rw-r--r-- | lvz/gendata.cpp | 47 |
2 files changed, 33 insertions, 30 deletions
diff --git a/lvz/audioeffectx.h b/lvz/audioeffectx.h index 07a6302..0030065 100644 --- a/lvz/audioeffectx.h +++ b/lvz/audioeffectx.h @@ -70,18 +70,21 @@ public: , URI("NIL") , curProgram(0) , numPrograms(progs) + , numParams(params) , numInputs(0) , numOutputs(0) , sampleRate(44100) { } - const char* getURI() { return URI; } - const char* getUniqueID() { return uniqueID; } - float getSampleRate() { return sampleRate; } - uint32_t getNumInputs() { return numInputs; } - uint32_t getNumOutputs() { return numOutputs; } - + const char* getURI() { return URI; } + const char* getUniqueID() { return uniqueID; } + float getSampleRate() { return sampleRate; } + uint32_t getNumInputs() { return numInputs; } + uint32_t getNumOutputs() { return numOutputs; } + uint32_t getNumParameters() { return numParams; } + + virtual void getParameterName(LvzInt32 index, char *label) = 0; virtual bool getProductString(char* text) = 0; void canMono() {} @@ -103,6 +106,7 @@ protected: const char* URI; uint32_t curProgram; uint32_t numPrograms; + uint32_t numParams; uint32_t numInputs; uint32_t numOutputs; float sampleRate; diff --git a/lvz/gendata.cpp b/lvz/gendata.cpp index f1337a1..c426b80 100644 --- a/lvz/gendata.cpp +++ b/lvz/gendata.cpp @@ -49,37 +49,36 @@ write_data(AudioEffectX* effect, const char* lib_file_name) os << "\t:symbol \"" << effect->getUniqueID() << "\" ;" << endl; os << "\tdoap:name \"" << name << "\""; - if (effect->getNumInputs() + effect->getNumOutputs() == 0) - os << " ." << endl; + uint32_t num_params = effect->getNumParameters(); + uint32_t num_audio_ins = effect->getNumInputs(); + uint32_t num_audio_outs = effect->getNumOutputs(); + uint32_t num_ports = num_params + num_audio_ins + num_audio_outs; + + if (num_ports > 0) + os << " ;" << endl << "\t:port [" << endl; else - os << " ;" << endl; + os << " ." << endl; - for (uint32_t i = 0; i < effect->getNumInputs(); ++i) { - if (i == 0) - os << "\t:port [" << endl; + uint32_t idx = 0; + + for (uint32_t i = idx; i < num_params; ++i, ++idx) { + effect->getParameterName(i, name); + os << "\t\ta :InputPort, :ControlPort ;" << endl; + os << "\t\t:index" << " " << idx << " ;" << endl; + os << "\t\t:name \"" << name << "\" ;" << endl; + os << ((idx == num_ports - 1) ? "\t] ." : "\t] , [") << endl; + } + for (uint32_t i = 0; i < num_audio_ins; ++i, ++idx) { os << "\t\ta :InputPort, :AudioPort ;" << endl; - os << "\t\t:index" << " " << i << " ;" << endl; - - if (i == effect->getNumInputs() - 1) { - os << "\t] " << (effect->getNumOutputs() ? ";" : ".") << endl; - } else { - os << "\t] , [" << endl; - } + os << "\t\t:index" << " " << idx << " ;" << endl; + os << ((idx == num_ports - 1) ? "\t] ." : "\t] , [") << endl; } - for (uint32_t i = 0; i < effect->getNumOutputs(); ++i) { - if (i == 0) - os << "\t:port [" << endl; - + for (uint32_t i = 0; i < num_audio_outs; ++i, ++idx) { os << "\t\ta :OutputPort, :AudioPort ;" << endl; - os << "\t\t:index" << " " << effect->getNumInputs() + i << " ;" << endl; - - if (i == effect->getNumInputs() - 1) { - os << "\t] ." << endl; - } else { - os << "\t] , [" << endl; - } + os << "\t\t:index" << " " << idx << " ;" << endl; + os << ((idx == num_ports - 1) ? "\t] ." : "\t] , [") << endl; } os.close(); |