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.

116 lines
4.4KB

  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 <jack/jack.h>
  20. #include "Client.H"
  21. #include <stdlib.h>
  22. namespace JACK
  23. {
  24. class Port
  25. {
  26. jack_port_t *_port;
  27. char *_trackname;
  28. char *_name;
  29. JACK::Client *_client;
  30. /* FIXME: reference count? */
  31. /* /\* not permitted *\/ */
  32. /* Port ( const Port &rhs ); */
  33. /* Port & operator= ( const Port &rhs ); */
  34. public:
  35. bool operator < ( const Port & rhs ) const;
  36. enum direction_e { Output, Input };
  37. enum type_e { Audio, MIDI, CV };
  38. static int max_name ( void );
  39. Port ( JACK::Client *client, jack_port_t *port );
  40. /* Port ( JACK::Client *client, const char *name, direction_e dir, type_e type ); */
  41. Port ( JACK::Client *client, const char *trackname, const char *name, direction_e dir, type_e type );
  42. /* Port ( JACK::Client *client, direction_e dir, type_e type, const char *base, int n, const char *subtype=0 ); */
  43. /* Port ( JACK::Client *client, direction_e dir, type_e type, int n, const char *subtype=0 ); */
  44. // Port ( );
  45. ~Port ( );
  46. Port ( const Port & rhs );
  47. bool valid ( void ) const { return _port; }
  48. bool connected ( void ) const { return jack_port_connected( _port ); }
  49. direction_e direction ( void ) const { return _direction; }
  50. type_e type ( void ) const { return _type; }
  51. const char * name ( void ) const { return _name; }
  52. const char * trackname ( void ) const { return _trackname; }
  53. void name ( const char *name );
  54. void trackname ( const char *trackname );
  55. bool rename ( void );
  56. const char * jack_name ( void ) const { return jack_port_name( _port ); }
  57. // bool name ( const char *base, int n, const char *type=0 );
  58. nframes_t total_latency ( void ) const;
  59. void get_latency ( direction_e dir, nframes_t *min, nframes_t *max ) const;
  60. /* it's only valid to call this in a latency callback! */
  61. void set_latency ( direction_e dir, nframes_t min, nframes_t max );
  62. void terminal ( bool b ) { _terminal = b; }
  63. bool activate ( void );
  64. void shutdown ( void );
  65. void write ( sample_t *buf, nframes_t nframes );
  66. void read ( sample_t *buf, nframes_t nframes );
  67. void *buffer ( nframes_t nframes );
  68. void silence ( nframes_t nframes );
  69. int connect ( const char *to );
  70. int disconnect ( const char *from );
  71. bool connected_to ( const char *to );
  72. /* */
  73. const char ** connections ( void );
  74. bool connections ( const char **port_names );
  75. void freeze ( void );
  76. void thaw ( void );
  77. JACK::Client * client ( void ) const { return _client; }
  78. void client ( JACK::Client *c ) { _client = c; }
  79. private:
  80. friend class Client;
  81. direction_e _direction;
  82. type_e _type;
  83. bool _terminal;
  84. void deactivate ( void );
  85. /* bool activate ( const char *name, direction_e dir ); */
  86. const char **_connections;
  87. };
  88. }