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.

124 lines
4.2KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. VSTaudiooutput.h - Audio output for VST
  4. Copyright (C) 2002 Nasca Octavian Paul
  5. Author: Nasca Octavian Paul
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of version 2 of the GNU General Public License
  8. as published by the Free Software Foundation.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License (version 2 or later) for more details.
  13. You should have received a copy of the GNU General Public License (version 2)
  14. along with this program; if not, write to the Free Software Foundation,
  15. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #ifndef VST_AUDIO_OUTPUT_H
  18. #define VST_AUDIO_OUTPUT_H
  19. #include <pthread.h>
  20. #include "../globals.h"
  21. #include "../Misc/Master.h"
  22. #include <dssi.h>
  23. #include <ladspa.h>
  24. #include <vector>
  25. class DSSIaudiooutput
  26. {
  27. public:
  28. //
  29. // Static stubs for LADSPA member functions
  30. //
  31. static void stub_connectPort(LADSPA_Handle instance,
  32. unsigned long port,
  33. LADSPA_Data *data);
  34. static void stub_activate(LADSPA_Handle instance);
  35. static void stub_run(LADSPA_Handle instance, unsigned long sample_count);
  36. static void stub_deactivate(LADSPA_Handle Instance);
  37. static void stub_cleanup(LADSPA_Handle instance);
  38. //
  39. // Static stubs for DSSI member functions
  40. //
  41. static const DSSI_Program_Descriptor *stub_getProgram(
  42. LADSPA_Handle instance,
  43. unsigned long Index);
  44. static void stub_selectProgram(LADSPA_Handle instance,
  45. unsigned long bank,
  46. unsigned long program);
  47. static int stub_getMidiControllerForPort(LADSPA_Handle instance,
  48. unsigned long port);
  49. static void stub_runSynth(LADSPA_Handle instance,
  50. unsigned long sample_count,
  51. snd_seq_event_t *events,
  52. unsigned long event_count);
  53. /*
  54. * LADSPA member functions
  55. */
  56. static LADSPA_Handle instantiate(const LADSPA_Descriptor *descriptor,
  57. unsigned long s_rate);
  58. void connectPort(unsigned long port, LADSPA_Data *data);
  59. void activate();
  60. void run(unsigned long sample_count);
  61. void deactivate();
  62. void cleanup();
  63. static const LADSPA_Descriptor *getLadspaDescriptor(unsigned long index);
  64. /*
  65. * DSSI member functions
  66. */
  67. const DSSI_Program_Descriptor *getProgram(unsigned long Index);
  68. void selectProgram(unsigned long bank, unsigned long program);
  69. int getMidiControllerForPort(unsigned long port);
  70. void runSynth(unsigned long sample_count,
  71. snd_seq_event_t *events,
  72. unsigned long event_count);
  73. static const DSSI_Descriptor *getDssiDescriptor(unsigned long index);
  74. struct ProgramDescriptor {
  75. unsigned long bank;
  76. unsigned long program;
  77. std::string name;
  78. ProgramDescriptor(unsigned long _bank,
  79. unsigned long _program,
  80. char *_name);
  81. };
  82. private:
  83. DSSIaudiooutput(unsigned long sampleRate);
  84. ~DSSIaudiooutput();
  85. static DSSI_Descriptor *initDssiDescriptor();
  86. static DSSIaudiooutput *getInstance(LADSPA_Handle instance);
  87. void initBanks();
  88. bool mapNextBank();
  89. LADSPA_Data *outl;
  90. LADSPA_Data *outr;
  91. long sampleRate;
  92. Master *master;
  93. static DSSI_Descriptor *dssiDescriptor;
  94. static std::string bankDirNames[];
  95. static
  96. std::vector<ProgramDescriptor> programMap;
  97. /**
  98. * Flag controlling the list of bank directories
  99. */
  100. bool banksInited;
  101. static
  102. long bankNoToMap;
  103. };
  104. #endif