KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mda-lv2_programs.patch 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. --- mda-lv2-1.0.0.orig/mda.lv2/Piano.ttl
  2. +++ mda-lv2-1.0.0/mda.lv2/Piano.ttl
  3. @@ -21,6 +21,7 @@ mda:Piano
  4. doap:license <http://usefulinc.com/doap/licenses/gpl> ;
  5. lv2:optionalFeature lv2:hardRTCapable ;
  6. lv2:requiredFeature <http://lv2plug.in/ns/ext/urid#map> ;
  7. + lv2:extensionData <http://kxstudio.sf.net/ns/lv2ext/programs#Interface> ;
  8. pg:mainInput mda:mainIn ;
  9. pg:mainOutput mda:mainOut ;
  10. lv2:port [
  11. --- mda-lv2-1.0.0.orig/mda.lv2/Detune.ttl
  12. +++ mda-lv2-1.0.0/mda.lv2/Detune.ttl
  13. @@ -13,6 +13,7 @@ mda:Detune
  14. doap:shortdesc "Simple up/down pitch shifting thickener" ;
  15. doap:license <http://usefulinc.com/doap/licenses/gpl> ;
  16. lv2:optionalFeature lv2:hardRTCapable ;
  17. + lv2:extensionData <http://kxstudio.sf.net/ns/lv2ext/programs#Interface> ;
  18. pg:mainInput mda:mainIn ;
  19. pg:mainOutput mda:mainOut ;
  20. rdfs:comment "A low-quality stereo pitch shifter for the sort of chorus and detune effects found on multi-effects hardware." ;
  21. --- mda-lv2-1.0.0.orig/mda.lv2/EPiano.ttl
  22. +++ mda-lv2-1.0.0/mda.lv2/EPiano.ttl
  23. @@ -13,6 +13,7 @@ mda:EPiano
  24. doap:license <http://usefulinc.com/doap/licenses/gpl> ;
  25. lv2:optionalFeature lv2:hardRTCapable ;
  26. lv2:requiredFeature <http://lv2plug.in/ns/ext/urid#map> ;
  27. + lv2:extensionData <http://kxstudio.sf.net/ns/lv2ext/programs#Interface> ;
  28. pg:mainInput mda:mainIn ;
  29. pg:mainOutput mda:mainOut ;
  30. lv2:port [
  31. --- mda-lv2-1.0.0.orig/mda.lv2/Leslie.ttl
  32. +++ mda-lv2-1.0.0/mda.lv2/Leslie.ttl
  33. @@ -14,6 +14,7 @@ mda:Leslie
  34. doap:shortdesc "Rotary speaker simulator" ;
  35. doap:license <http://usefulinc.com/doap/licenses/gpl> ;
  36. lv2:optionalFeature lv2:hardRTCapable ;
  37. + lv2:extensionData <http://kxstudio.sf.net/ns/lv2ext/programs#Interface> ;
  38. pg:mainInput mda:mainIn ;
  39. pg:mainOutput mda:mainOut ;
  40. rdfs:comment "No overdrive or speaker cabinet simulation is added - you may want to combine this plug-in with Combo. For a much thicker sound try combining two Leslie plug-ins in series!" ;
  41. --- mda-lv2-1.0.0.orig/mda.lv2/Vocoder.ttl
  42. +++ mda-lv2-1.0.0/mda.lv2/Vocoder.ttl
  43. @@ -14,6 +14,7 @@ mda:Vocoder
  44. doap:shortdesc "Switchable 8 or 16 band vocoder" ;
  45. doap:license <http://usefulinc.com/doap/licenses/gpl> ;
  46. lv2:optionalFeature lv2:hardRTCapable ;
  47. + lv2:extensionData <http://kxstudio.sf.net/ns/lv2ext/programs#Interface> ;
  48. pg:mainInput mda:mainIn ;
  49. pg:mainOutput mda:mainOut ;
  50. rdfs:comment """16-band vocoder for applying the spectrum of one sound (the modulator, usually a voice or rhythm part) to the waveform of another (the carrier, usually a synth pad or sawtooth wave).
  51. --- mda-lv2-1.0.0.orig/mda.lv2/JX10.ttl
  52. +++ mda-lv2-1.0.0/mda.lv2/JX10.ttl
  53. @@ -28,6 +28,7 @@ mda:JX10
  54. doap:license <http://usefulinc.com/doap/licenses/gpl> ;
  55. lv2:optionalFeature lv2:hardRTCapable ;
  56. lv2:requiredFeature <http://lv2plug.in/ns/ext/urid#map> ;
  57. + lv2:extensionData <http://kxstudio.sf.net/ns/lv2ext/programs#Interface> ;
  58. pg:mainInput mda:mainIn ;
  59. pg:mainOutput mda:mainOut ;
  60. rdfs:comment """When Vibrato is set to PWM, the two oscillators are phase-locked and will produce a square wave if set to the same pitch. Pitch modulation of one oscillator then causes Pulse Width Modulation. (pitch modulation of both oscillators for vibrato is still available from the modulation wheel). Unlike other synths, in PWM mode the oscillators can still be detuned to give a wider range of PWM effects.
  61. --- mda-lv2-1.0.0.orig/mda.lv2/ThruZero.ttl
  62. +++ mda-lv2-1.0.0/mda.lv2/ThruZero.ttl
  63. @@ -13,6 +13,7 @@ mda:ThruZero
  64. doap:shortdesc "Classic tape-flanging simulation" ;
  65. doap:license <http://usefulinc.com/doap/licenses/gpl> ;
  66. lv2:optionalFeature lv2:hardRTCapable ;
  67. + lv2:extensionData <http://kxstudio.sf.net/ns/lv2ext/programs#Interface> ;
  68. pg:mainInput mda:mainIn ;
  69. pg:mainOutput mda:mainOut ;
  70. rdfs:comment """Tape flanger and ADT
  71. --- mda-lv2-1.0.0.orig/mda.lv2/DX10.ttl
  72. +++ mda-lv2-1.0.0/mda.lv2/DX10.ttl
  73. @@ -21,6 +21,7 @@ mda:DX10
  74. doap:license <http://usefulinc.com/doap/licenses/gpl> ;
  75. lv2:optionalFeature lv2:hardRTCapable ;
  76. lv2:requiredFeature <http://lv2plug.in/ns/ext/urid#map> ;
  77. + lv2:extensionData <http://kxstudio.sf.net/ns/lv2ext/programs#Interface> ;
  78. pg:mainInput mda:mainIn ;
  79. pg:mainOutput mda:mainOut ;
  80. rdfs:comment "Sounds similar to the later Yamaha DX synths including the heavy bass but with a warmer, cleaner tone. This plug-in is 8-voice polyphonic." ;
  81. --- mda-lv2-1.0.0.orig/mda.lv2/Splitter.ttl
  82. +++ mda-lv2-1.0.0/mda.lv2/Splitter.ttl
  83. @@ -14,6 +14,7 @@ mda:Splitter
  84. doap:shortdesc "Frequency/level crossover for setting up dynamic processing" ;
  85. doap:license <http://usefulinc.com/doap/licenses/gpl> ;
  86. lv2:optionalFeature lv2:hardRTCapable ;
  87. + lv2:extensionData <http://kxstudio.sf.net/ns/lv2ext/programs#Interface> ;
  88. pg:mainInput mda:mainIn ;
  89. pg:mainOutput mda:mainOut ;
  90. rdfs:comment """This plug-in can split a signal based on frequency or level, for example for producing dynamic effects where only loud drum hits are sent to a reverb. Other functions include a simple "spectral gate" in INVERSE mode and a conventional gate and filter for separating drum sounds in NORMAL mode.""" ;
  91. --- mda-lv2-1.0.0.orig/lvz/wrapper.cpp
  92. +++ mda-lv2-1.0.0/lvz/wrapper.cpp
  93. @@ -32,6 +32,7 @@
  94. #include <stdlib.h>
  95. #include "audioeffectx.h"
  96. #include "lv2.h"
  97. +#include "lv2_programs.h"
  98. #include "lv2/lv2plug.in/ns/ext/atom/atom.h"
  99. #include "lv2/lv2plug.in/ns/ext/midi/midi.h"
  100. #include "lv2/lv2plug.in/ns/ext/urid/urid.h"
  101. @@ -161,9 +162,47 @@ lvz_run(LV2_Handle instance, uint32_t sa
  102. plugin->effect->processReplacing(plugin->inputs, plugin->outputs, sample_count);
  103. }
  104. +static const LV2_Program_Descriptor*
  105. +lv2_get_program(LV2_Handle handle, uint32_t index)
  106. +{
  107. + static LV2_Program_Descriptor desc = { 0, 0, NULL };
  108. + static char name[256] = { 0 };
  109. +
  110. + LVZPlugin* plugin = (LVZPlugin*)handle;
  111. +
  112. + if ((int)index < plugin->effect->getNumPrograms() && plugin->effect->getProgramNameIndexed(0, index, name))
  113. + {
  114. + desc.bank = index / 128;
  115. + desc.program = index % 128;
  116. + desc.name = name;
  117. + return &desc;
  118. + }
  119. +
  120. + return NULL;
  121. +}
  122. +
  123. +static void
  124. +lv2_select_program(LV2_Handle handle, uint32_t bank, uint32_t program)
  125. +{
  126. + LVZPlugin* plugin = (LVZPlugin*)handle;
  127. +
  128. + int realProgram = bank * 128 + program;
  129. +
  130. + if (realProgram < plugin->effect->getNumPrograms())
  131. + {
  132. + plugin->effect->setProgram(realProgram);
  133. +
  134. + for (int32_t i = 0; i < plugin->effect->getNumParameters(); ++i)
  135. + plugin->controls[i] = plugin->control_buffers[i][0] = plugin->effect->getParameter(i);
  136. + }
  137. +}
  138. +
  139. static const void*
  140. lvz_extension_data(const char* uri)
  141. {
  142. + static const LV2_Programs_Interface programs = { lv2_get_program, lv2_select_program };
  143. + if (strcmp(uri, LV2_PROGRAMS__Interface) == 0)
  144. + return &programs;
  145. return NULL;
  146. }
  147. --- mda-lv2-1.0.0.orig/lvz/audioeffectx.h
  148. +++ mda-lv2-1.0.0/lvz/audioeffectx.h
  149. @@ -106,6 +106,7 @@ public:
  150. virtual void getParameterName(int32_t index, char *label) = 0;
  151. virtual bool getProductString(char* text) = 0;
  152. virtual void getProgramName(char *name) { name[0] = '\0'; }
  153. + virtual bool getProgramNameIndexed (int32_t, int32_t, char*) { return false; }
  154. virtual int32_t canDo(const char* text) { return false; }
  155. virtual bool canHostDo(const char* act) { return false; }
  156. --- /dev/null
  157. +++ mda-lv2-1.0.0/src/lv2_programs.h
  158. @@ -0,0 +1,174 @@
  159. +/*
  160. + LV2 Programs Extension
  161. + Copyright 2012 Filipe Coelho <falktx@falktx.com>
  162. +
  163. + Permission to use, copy, modify, and/or distribute this software for any
  164. + purpose with or without fee is hereby granted, provided that the above
  165. + copyright notice and this permission notice appear in all copies.
  166. +
  167. + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  168. + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  169. + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  170. + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  171. + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  172. + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  173. + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  174. +*/
  175. +
  176. +/**
  177. + @file lv2_programs.h
  178. + C header for the LV2 programs extension <http://kxstudio.sf.net/ns/lv2ext/programs>.
  179. +*/
  180. +
  181. +#ifndef LV2_PROGRAMS_H
  182. +#define LV2_PROGRAMS_H
  183. +
  184. +#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
  185. +#include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
  186. +
  187. +#define LV2_PROGRAMS_URI "http://kxstudio.sf.net/ns/lv2ext/programs"
  188. +#define LV2_PROGRAMS_PREFIX LV2_PROGRAMS_URI "#"
  189. +
  190. +#define LV2_PROGRAMS__Host LV2_PROGRAMS_PREFIX "Host"
  191. +#define LV2_PROGRAMS__Interface LV2_PROGRAMS_PREFIX "Interface"
  192. +#define LV2_PROGRAMS__UIInterface LV2_PROGRAMS_PREFIX "UIInterface"
  193. +
  194. +#ifdef __cplusplus
  195. +extern "C" {
  196. +#endif
  197. +
  198. +typedef void* LV2_Programs_Handle;
  199. +
  200. +typedef struct _LV2_Program_Descriptor {
  201. +
  202. + /** Bank number for this program. Note that this extension does not
  203. + support MIDI-style separation of bank LSB and MSB values. There is
  204. + no restriction on the set of available banks: the numbers do not
  205. + need to be contiguous, there does not need to be a bank 0, etc. */
  206. + uint32_t bank;
  207. +
  208. + /** Program number (unique within its bank) for this program. There is
  209. + no restriction on the set of available programs: the numbers do not
  210. + need to be contiguous, there does not need to be a program 0, etc. */
  211. + uint32_t program;
  212. +
  213. + /** Name of the program. */
  214. + const char * name;
  215. +
  216. +} LV2_Program_Descriptor;
  217. +
  218. +/**
  219. + Programs extension, plugin data.
  220. +
  221. + When the plugin's extension_data is called with argument LV2_PROGRAMS__Interface,
  222. + the plugin MUST return an LV2_Programs_Instance structure, which remains valid
  223. + for the lifetime of the plugin.
  224. +*/
  225. +typedef struct _LV2_Programs_Interface {
  226. + /**
  227. + * get_program()
  228. + *
  229. + * This member is a function pointer that provides a description
  230. + * of a program (named preset sound) available on this plugin.
  231. + *
  232. + * The index argument is an index into the plugin's list of
  233. + * programs, not a program number as represented by the Program
  234. + * field of the LV2_Program_Descriptor. (This distinction is
  235. + * needed to support plugins that use non-contiguous program or
  236. + * bank numbers.)
  237. + *
  238. + * This function returns a LV2_Program_Descriptor pointer that is
  239. + * guaranteed to be valid only until the next call to get_program
  240. + * or deactivate, on the same plugin instance. This function must
  241. + * return NULL if passed an index argument out of range, so that
  242. + * the host can use it to query the number of programs as well as
  243. + * their properties.
  244. + */
  245. + const LV2_Program_Descriptor *(*get_program)(LV2_Handle handle,
  246. + uint32_t index);
  247. +
  248. + /**
  249. + * select_program()
  250. + *
  251. + * This member is a function pointer that selects a new program
  252. + * for this plugin. The program change should take effect
  253. + * immediately at the start of the next run() call. (This
  254. + * means that a host providing the capability of changing programs
  255. + * between any two notes on a track must vary the block size so as
  256. + * to place the program change at the right place. A host that
  257. + * wanted to avoid this would probably just instantiate a plugin
  258. + * for each program.)
  259. + *
  260. + * Plugins should ignore a select_program() call with an invalid
  261. + * bank or program.
  262. + *
  263. + * A plugin is not required to select any particular default
  264. + * program on activate(): it's the host's duty to set a program
  265. + * explicitly.
  266. + *
  267. + * A plugin is permitted to re-write the values of its input
  268. + * control ports when select_program is called. The host should
  269. + * re-read the input control port values and update its own
  270. + * records appropriately. (This is the only circumstance in which
  271. + * a LV2 plugin is allowed to modify its own control-input ports.)
  272. + */
  273. + void (*select_program)(LV2_Handle handle,
  274. + uint32_t bank,
  275. + uint32_t program);
  276. +
  277. +} LV2_Programs_Interface;
  278. +
  279. +/**
  280. + Programs extension, UI data.
  281. +
  282. + When the UI's extension_data is called with argument LV2_PROGRAMS__UIInterface,
  283. + the UI MUST return an LV2_Programs_UI_Interface structure, which remains valid
  284. + for the lifetime of the UI.
  285. +*/
  286. +typedef struct _LV2_Programs_UI_Interface {
  287. + /**
  288. + * select_program()
  289. + *
  290. + * This is exactly the same as select_program in LV2_Programs_Instance,
  291. + * but this struct relates to the UI instead of the plugin.
  292. + *
  293. + * When called, UIs should update their state to match the selected program.
  294. + */
  295. + void (*select_program)(LV2UI_Handle handle,
  296. + uint32_t bank,
  297. + uint32_t program);
  298. +
  299. +} LV2_Programs_UI_Interface;
  300. +
  301. +/**
  302. + Feature data for LV2_PROGRAMS__Host.
  303. +*/
  304. +typedef struct _LV2_Programs_Host {
  305. + /**
  306. + * Opaque host data.
  307. + */
  308. + LV2_Programs_Handle handle;
  309. +
  310. + /**
  311. + * program_changed()
  312. + *
  313. + * Tell the host to reload a plugin's program.
  314. + * Parameter handle MUST be the 'handle' member of this struct.
  315. + * Parameter index is program index to change.
  316. + * When index is -1, host should reload all the programs.
  317. + *
  318. + * The plugin MUST NEVER call this function on a RT context or during run().
  319. + *
  320. + * NOTE: This call is to inform the host about a program's bank, program or name change.
  321. + * It DOES NOT change the current selected program.
  322. + */
  323. + void (*program_changed)(LV2_Programs_Handle handle,
  324. + int32_t index);
  325. +
  326. +} LV2_Programs_Host;
  327. +
  328. +#ifdef __cplusplus
  329. +} /* extern "C" */
  330. +#endif
  331. +
  332. +#endif /* LV2_PROGRAMS_H */