Audio plugin host https://kx.studio/carla
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.

67 lines
1.4KB

  1. %module lilv
  2. %typedef unsigned uint32_t;
  3. %{
  4. #define SWIG_FILE_WITH_INIT
  5. #include "lilv/lilv.h"
  6. #include "lilv/lilvmm.hpp"
  7. %}
  8. %include "numpy.i"
  9. %init %{
  10. import_array();
  11. %}
  12. %apply (float* INPLACE_ARRAY1) {(void* data_location)}
  13. %feature("compactdefaultargs") %{
  14. lilv_plugin_get_num_ports_of_class;
  15. get_num_ports_of_class;
  16. %}
  17. %varargs(3, LilvNode* node = NULL) lilv_plugin_get_num_ports_of_class;
  18. %varargs(3, LilvNode* node = NULL) get_num_ports_of_class;
  19. %typemap(in, numinputs=0) LilvNode *node3 ""; // Make sure it's NULL terminated
  20. %include "lilv/lilv.h"
  21. %include "lilv/lilvmm.hpp"
  22. namespace Lilv {
  23. %extend Plugins {
  24. %pythoncode %{
  25. def __iter__(self):
  26. class Iterator(object):
  27. def __init__(self, plugins):
  28. self.plugins = plugins
  29. self.iter = plugins.begin()
  30. def __next__(self):
  31. if self.plugins.is_end(self.iter):
  32. raise StopIteration
  33. plugin = self.plugins.get(self.iter)
  34. self.iter = self.plugins.next(self.iter)
  35. return plugin
  36. def next(self):
  37. "Python 2 iterator protocol"
  38. return Iterator.__next__(self)
  39. return Iterator(self)
  40. def get_by_uri(self, *args):
  41. """get_by_uri(self, LilvNode uri) -> PluginClass"""
  42. ret = _lilv.Plugins_get_by_uri(self, *args)
  43. if ret.me is None:
  44. return None
  45. else:
  46. return ret
  47. %}
  48. };
  49. %extend Node {
  50. %pythoncode %{
  51. def __str__(self):
  52. return self.get_turtle_token()
  53. %}
  54. };
  55. } /* namespace Lilv */