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.

125 lines
3.9KB

  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 <FL/Fl.H>
  20. #include <FL/Fl_Pack.H>
  21. #include <FL/Fl_Button.H>
  22. #include "Module.H"
  23. #include "JACK/Port.H"
  24. #include <vector>
  25. #include <list>
  26. #include "Loggable.H"
  27. class Mixer_Strip;
  28. class Fl_Flowpack;
  29. class Fl_Flip_Button;
  30. class Engine;
  31. class Controller_Module;
  32. class Chain : public Fl_Group, public Loggable {
  33. Fl_Flip_Button *tab_button;
  34. Fl_Flowpack *controls_pack;
  35. Fl_Group *chain_tab;
  36. Fl_Group *control_tab;
  37. Fl_Pack *modules_pack;
  38. Mixer_Strip *_strip;
  39. const char *_name;
  40. std::list<Module*> process_queue;
  41. std::vector <Module::Port> scratch_port;
  42. Engine *_engine;
  43. Fl_Callback *_configure_outputs_callback;
  44. void *_configure_outputs_userdata;
  45. private:
  46. void cb_handle(Fl_Widget*);
  47. static void cb_handle(Fl_Widget*, void*);
  48. void draw_connections ( Module *m );
  49. void build_process_queue ( void );
  50. void add_to_process_queue ( Module *m );
  51. static void process ( nframes_t, void * );
  52. void process ( nframes_t );
  53. static void buffer_size ( nframes_t nframes, void *v );
  54. void buffer_size ( nframes_t nframes );
  55. protected:
  56. void get ( Log_Entry &e ) const;
  57. void set ( Log_Entry &e );
  58. public:
  59. Chain ( int X, int Y, int W, int H, const char *L = 0 );
  60. Chain ( );
  61. virtual ~Chain ( );
  62. void draw ( void );
  63. void resize ( int X, int Y, int W, int H );
  64. Mixer_Strip *strip ( void ) const { return _strip; }
  65. void strip ( Mixer_Strip *v );
  66. const char *name ( void ) const { return _name; }
  67. void name ( const char *name );
  68. void configure_ports ( void );
  69. int required_buffers ( void );
  70. bool can_support_input_channels ( int n );
  71. int modules ( void ) const { return modules_pack->children(); }
  72. Module *module ( int n ) const { return (Module*)modules_pack->child( n ); }
  73. void remove ( Module *m );
  74. bool add ( Module *m );
  75. bool add ( Controller_Module *m );
  76. bool insert ( Module *m, Module *n );
  77. void add_control ( Controller_Module *m );
  78. void initialize_with_default ( void );
  79. bool can_configure_outputs ( Module *m, int n ) const;
  80. void configure_outputs_callback ( Fl_Callback *cb, void *v )
  81. {
  82. _configure_outputs_callback = cb;
  83. _configure_outputs_userdata = v;
  84. }
  85. Fl_Callback * configure_outputs_callback ( void ) const { return _configure_outputs_callback; }
  86. void log_children ( void );
  87. static int maximum_name_length ( void );
  88. Engine *engine ( void ) const { return _engine; }
  89. LOG_CREATE_FUNC( Chain );
  90. };