jack2 codebase
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.

107 lines
2.7KB

  1. /*
  2. Copyright (C) 2001 Paul Davis
  3. Copyright (C) 2004-2008 Grame
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. */
  16. #ifndef __JackPort__
  17. #define __JackPort__
  18. #include "types.h"
  19. #include "JackConstants.h"
  20. #include "JackCompilerDeps.h"
  21. namespace Jack
  22. {
  23. #define ALL_PORTS 0xFFFF
  24. #define NO_PORT 0xFFFE
  25. /*!
  26. \brief Base class for port.
  27. */
  28. class SERVER_EXPORT JackPort
  29. {
  30. friend class JackGraphManager;
  31. private:
  32. int fTypeId;
  33. enum JackPortFlags fFlags;
  34. char fName[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
  35. char fAlias1[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
  36. char fAlias2[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
  37. int fRefNum;
  38. jack_nframes_t fLatency;
  39. jack_nframes_t fTotalLatency;
  40. uint8_t fMonitorRequests;
  41. bool fInUse;
  42. jack_port_id_t fTied; // Locally tied source port
  43. MEM_ALIGN(float fBuffer[BUFFER_SIZE_MAX], 64); // 16 bytes alignment for vector code, 64 bytes better for cache loads/stores
  44. bool IsUsed() const;
  45. // RT
  46. void ClearBuffer(jack_nframes_t frames);
  47. void MixBuffers(void** src_buffers, int src_count, jack_nframes_t frames);
  48. public:
  49. JackPort();
  50. bool Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
  51. void Release();
  52. const char* GetName() const;
  53. const char* GetShortName() const;
  54. void SetName(const char* name);
  55. int GetAliases(char* const aliases[2]);
  56. int SetAlias(const char* alias);
  57. int UnsetAlias(const char* alias);
  58. bool NameEquals(const char* target);
  59. int GetFlags() const;
  60. const char* GetType() const;
  61. int Tie(jack_port_id_t port_index);
  62. int UnTie();
  63. jack_nframes_t GetLatency() const;
  64. jack_nframes_t GetTotalLatency() const;
  65. void SetLatency(jack_nframes_t latency);
  66. int RequestMonitor(bool onoff);
  67. int EnsureMonitor(bool onoff);
  68. bool MonitoringInput();
  69. float* GetBuffer();
  70. int GetRefNum() const;
  71. };
  72. } // end of namespace
  73. #endif