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.

146 lines
4.2KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2008 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 "Sequence.H"
  20. #include "Control_Point.H"
  21. #include "JACK/Port.H"
  22. // class JACK::Port;
  23. #include "OSC/Endpoint.H"
  24. class Control_Sequence_Header;
  25. class Fl_Menu_Button;
  26. class Control_Sequence : public Sequence
  27. {
  28. /* not permitted */
  29. Control_Sequence ( const Control_Sequence &rhs );
  30. Control_Sequence & operator = ( const Control_Sequence &rhs );
  31. public:
  32. enum Curve_Type { None, Linear, Quadratic };
  33. enum Mode {
  34. CV,
  35. OSC,
  36. MIDI
  37. };
  38. private:
  39. static void cb_button ( Fl_Widget *w, void *v );
  40. void cb_button ( Fl_Widget *w );
  41. JACK::Port *_output;
  42. /* these are used to cache the saved osc connection until the
  43. * session is loaded, at which time we will reconnect */
  44. std::list<char*> _persistent_osc_connections;
  45. /* osc output port */
  46. volatile void *__osc_output;
  47. OSC::Signal *_osc_output ( void ) const
  48. {
  49. return (OSC::Signal *)__osc_output;
  50. }
  51. void _osc_output ( OSC::Signal * s)
  52. {
  53. __osc_output = s;
  54. }
  55. static void peer_callback( const char *name, const OSC::Signal *sig, void *v );
  56. void peer_callback( const char *name, const OSC::Signal *sig );
  57. void add_osc_peers_to_menu ( Fl_Menu_Button *m, const char *prefix );
  58. static Fl_Widget *_highlighted;
  59. Curve_Type _interpolation;
  60. void init ( void );
  61. void draw_curve ( bool filled );
  62. static void menu_cb ( Fl_Widget *w, void *v );
  63. void menu_cb ( const Fl_Menu_ *m );
  64. Mode _mode;
  65. float _rate;
  66. protected:
  67. Control_Sequence ( );
  68. virtual void get ( Log_Entry &e ) const;
  69. virtual void get_unjournaled ( Log_Entry &e ) const;
  70. void set ( Log_Entry &e );
  71. void draw_box ( void );
  72. void draw ( void );
  73. int handle ( int m );
  74. void update_port_name ( void );
  75. Fl_Menu_Button & menu ( void );
  76. public:
  77. Control_Sequence_Header * header ( void ) { return (Control_Sequence_Header*)child(0); }
  78. virtual void name ( const char *s );
  79. virtual const char *name ( void ) const;
  80. void process_osc ( void );
  81. void connect_osc ( void );
  82. static bool draw_with_polygon;
  83. static bool draw_with_grid;
  84. LOG_CREATE_FUNC( Control_Sequence );
  85. Control_Sequence ( Track *, const char *name = 0 );
  86. ~Control_Sequence ( );
  87. Fl_Cursor cursor ( void ) const { return FL_CURSOR_CROSS; }
  88. Curve_Type interpolation ( void ) const { return _interpolation; }
  89. void interpolation ( Curve_Type v )
  90. {
  91. _interpolation = v;
  92. damage( FL_DAMAGE_USER1 );
  93. }
  94. Mode mode ( void ) const { return _mode; }
  95. void mode ( Mode v );
  96. /* Engine */
  97. void output ( JACK::Port *p ) { _output = p; }
  98. nframes_t play ( sample_t *buf, nframes_t frame, nframes_t nframes );
  99. nframes_t process ( nframes_t nframes );
  100. };