Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
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.

123 lines
3.4KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2009 Jonathan Moore Liles */
  3. /* */
  4. /* This program is free software; you can redistribute it and/or modify it */
  5. /* under the terms of the GNU General Public License as published by the */
  6. /* Free Software Foundation; either version 2 of the License, or (at your */
  7. /* option) any later version. */
  8. /* */
  9. /* This program is distributed in the hope that it will be useful, but WITHOUT */
  10. /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
  11. /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
  12. /* more details. */
  13. /* */
  14. /* You should have received a copy of the GNU General Public License along */
  15. /* with This program; see the file COPYING. If not,write to the Free Software */
  16. /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  17. /*******************************************************************************/
  18. #pragma once
  19. #include "Module.H"
  20. #include "Loggable.H"
  21. class Fl_Menu_Button;
  22. class Thread;
  23. class Plugin_Module : public Module {
  24. static Thread *plugin_discover_thread;
  25. public:
  26. struct Plugin_Info
  27. {
  28. const char *path;
  29. unsigned long id;
  30. Plugin_Info ( )
  31. {
  32. path = 0;
  33. id = 0;
  34. }
  35. };
  36. bool load ( unsigned long id );
  37. private:
  38. void init ( void );
  39. void bbox ( int &X, int &Y, int &W, int &H )
  40. {
  41. X = x();
  42. Y = y() + 5;
  43. W = w();
  44. H = h() - 10;
  45. }
  46. void cb_handle(Fl_Widget*);
  47. static void cb_handle(Fl_Widget*, void*);
  48. Fl_Button *close_button;
  49. struct ImplementationData;
  50. ImplementationData *_idata;
  51. bool _active;
  52. int _plugin_ins;
  53. int _plugin_outs;
  54. bool _crosswire;
  55. static void *discover_thread ( void * );
  56. static Plugin_Info* get_all_plugins ( void );
  57. void set_input_buffer ( int n, void *buf );
  58. void set_output_buffer ( int n, void *buf );
  59. void set_control_buffer ( int n, void *buf );
  60. void activate ( void );
  61. void deactivate ( void );
  62. void process ( unsigned long nframes );
  63. bool active ( void ) const { return _active; }
  64. bool plugin_instances ( unsigned int );
  65. void connect_ports ( void );
  66. public:
  67. static void spawn_discover_thread ( void );
  68. Plugin_Module ( );
  69. virtual ~Plugin_Module();
  70. static Plugin_Module * pick_plugin ( void );
  71. static void add_plugins_to_menu ( Fl_Menu_Button *menu );
  72. int plugin_ins ( void ) const { return _plugin_ins; }
  73. int plugin_outs ( void ) const { return _plugin_outs; }
  74. void select_plugin ( unsigned long id );
  75. const char *name ( void ) const { return "Plugin"; }
  76. int can_support_inputs ( int );
  77. bool configure_inputs ( int );
  78. void process ( void );
  79. void handle_port_connection_change ( void );
  80. LOG_CREATE_FUNC( Plugin_Module );
  81. protected:
  82. void get ( Log_Entry &e ) const;
  83. void set ( Log_Entry &e );
  84. };