LadspaBase.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * LadspaBase.h - basic declarations concerning LADSPA
  3. *
  4. * Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
  5. * Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  6. *
  7. * This file is part of LMMS - https://lmms.io
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public
  20. * License along with this program (see COPYING); if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301 USA.
  23. *
  24. */
  25. #ifndef LADSPA_BASE_H
  26. #define LADSPA_BASE_H
  27. #include "LadspaManager.h"
  28. #include "Plugin.h"
  29. class LadspaControl;
  30. typedef enum BufferRates
  31. {
  32. CHANNEL_IN,
  33. CHANNEL_OUT,
  34. AUDIO_RATE_INPUT,
  35. AUDIO_RATE_OUTPUT,
  36. CONTROL_RATE_INPUT,
  37. CONTROL_RATE_OUTPUT
  38. } buffer_rate_t;
  39. typedef enum BufferData
  40. {
  41. TOGGLED,
  42. ENUM,
  43. INTEGER,
  44. FLOATING,
  45. TIME,
  46. NONE
  47. } buffer_data_t;
  48. //! This struct is used to hold port descriptions internally
  49. //! which where received from the ladspa plugin
  50. typedef struct PortDescription
  51. {
  52. QString name;
  53. ch_cnt_t proc;
  54. uint16_t port_id;
  55. uint16_t control_id;
  56. buffer_rate_t rate;
  57. buffer_data_t data_type;
  58. float scale;
  59. LADSPA_Data max;
  60. LADSPA_Data min;
  61. LADSPA_Data def;
  62. LADSPA_Data value;
  63. //! This is true iff ladspa suggests logscale
  64. //! Note however that the model can still decide to use a linear scale
  65. bool suggests_logscale;
  66. LADSPA_Data * buffer;
  67. LadspaControl * control;
  68. } port_desc_t;
  69. inline Plugin::Descriptor::SubPluginFeatures::Key ladspaKeyToSubPluginKey(
  70. const Plugin::Descriptor * _desc,
  71. const QString & _name,
  72. const ladspa_key_t & _key )
  73. {
  74. Plugin::Descriptor::SubPluginFeatures::Key::AttributeMap m;
  75. QString file = _key.first;
  76. m["file"] = file.remove( QRegExp( "\\.so$" ) ).remove( QRegExp( "\\.dll$" ) );
  77. m["plugin"] = _key.second;
  78. return Plugin::Descriptor::SubPluginFeatures::Key( _desc, _name, m );
  79. }
  80. #endif