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.

128 lines
3.8KB

  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 Chain : public Fl_Group, public Loggable {
  31. Fl_Pack *modules_pack;
  32. Fl_Flowpack *controls_pack;
  33. Fl_Flip_Button *tab_button;
  34. Fl_Group *chain_tab;
  35. Fl_Group *control_tab;
  36. void cb_handle(Fl_Widget*);
  37. static void cb_handle(Fl_Widget*, void*);
  38. /* int _ins; */
  39. /* int _outs; */
  40. Mixer_Strip *_strip;
  41. // sample_t **_buffer;
  42. // int _nbuffers;
  43. Fl_Callback *_configure_outputs_callback;
  44. void *_configure_outputs_userdata;
  45. const char *_name;
  46. void draw_connections ( Module *m );
  47. std::list<Module*> process_queue;
  48. void build_process_queue ( void );
  49. void add_to_process_queue ( Module *m );
  50. static std::vector <Module::Port> port;
  51. static std::list <Chain*> chain;
  52. protected:
  53. void get ( Log_Entry &e ) const;
  54. void set ( Log_Entry &e );
  55. int handle ( int m );
  56. void draw ( void );
  57. public:
  58. void resize ( int X, int Y, int W, int H );
  59. Mixer_Strip *strip ( void ) const { return _strip; }
  60. void strip ( Mixer_Strip *v );
  61. const char *name ( void ) const { return _name; }
  62. void name ( const char *name );
  63. void configure_ports ( void );
  64. int required_buffers ( void );
  65. Chain ( int X, int Y, int W, int H, const char *L = 0 );
  66. Chain ( );
  67. virtual ~Chain ( );
  68. bool can_support_input_channels ( int n );
  69. /* void ins ( int i ) { _ins = i; } */
  70. /* void outs ( int i ) { _outs = i; } */
  71. /* int ins ( void ) const { return _ins; } */
  72. /* int outs ( void ) const { return _outs; } */
  73. int modules ( void ) const { return modules_pack->children(); }
  74. Module *module ( int n ) const { return (Module*)modules_pack->child( n ); }
  75. void remove ( Module *m );
  76. bool add ( Module *m );
  77. bool insert ( Module *m, Module *n );
  78. void add_control ( Module *m );
  79. void initialize_with_default ( void );
  80. bool can_configure_outputs ( Module *m, int n ) const;
  81. void configure_outputs_callback ( Fl_Callback *cb, void *v )
  82. {
  83. _configure_outputs_callback = cb;
  84. _configure_outputs_userdata = v;
  85. }
  86. Fl_Callback * configure_outputs_callback ( void ) const { return _configure_outputs_callback; }
  87. void process ( nframes_t );
  88. void log_children ( void );
  89. LOG_CREATE_FUNC( Chain );
  90. };