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.

119 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 <vector>
  21. #include "JACK/Port.H"
  22. #include "OSC/Endpoint.H"
  23. class Fl_Menu_Button;
  24. class Fl_Menu_;
  25. class Fl_Valuator;
  26. class Controller_Module : public Module
  27. {
  28. static void update_cb ( void *v );
  29. void update_cb ( void );
  30. bool _pad;
  31. volatile float control_value;
  32. Fl_Menu_Button & menu ( void );
  33. static void menu_cb ( Fl_Widget *w, void *v );
  34. void menu_cb ( const Fl_Menu_ *m );
  35. char *_osc_path;
  36. char *_osc_path_cv;
  37. public:
  38. enum Mode { GUI, CV, OSC, MIDI };
  39. enum Type { KNOB,
  40. SLIDER,
  41. SPINNER,
  42. TOGGLE,
  43. SPATIALIZATION };
  44. Mode mode ( void ) const { return _mode; }
  45. void mode ( Mode v );
  46. Type type ( void ) const { return _type; }
  47. Controller_Module ( bool is_default = false );
  48. virtual ~Controller_Module ( );
  49. const char *name ( void ) const { return "Controller"; }
  50. int can_support_inputs ( int ) { return 0; }
  51. bool configure_inputs ( int ) { return false; }
  52. void pad ( bool v ) { _pad = v; }
  53. static void cb_handle ( Fl_Widget *w, void *v );
  54. void cb_handle ( Fl_Widget *w );
  55. static void cb_spatializer_handle ( Fl_Widget *w, void *v );
  56. void cb_spatializer_handle ( Fl_Widget *w );
  57. void connect_to ( Port *p );
  58. bool connect_spatializer_to ( Module *m );
  59. void disconnect ( void );
  60. void handle_control_changed ( Port *p );
  61. void handle_chain_name_changed ( void );
  62. virtual void command_remove ( void );
  63. LOG_CREATE_FUNC( Controller_Module );
  64. void process ( nframes_t nframes );
  65. void draw ( void )
  66. {
  67. draw_box();
  68. Fl_Group::draw();
  69. }
  70. int handle ( int m );
  71. // void set_control_value ( float f ) { control_value = f; }
  72. protected:
  73. void get ( Log_Entry &e ) const;
  74. void set ( Log_Entry &e );
  75. private:
  76. char *generate_osc_path ( void );
  77. void change_osc_path ( char *path );
  78. std::vector<JACK::Port> jack_input;
  79. Mode _mode;
  80. Type _type;
  81. Fl_Valuator *control;
  82. };