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.

116 lines
3.0KB

  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 General Public License as published by
  6. the Free Software Foundation; either version 2 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 General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #ifndef __JackPort__
  17. #define __JackPort__
  18. #include "types.h"
  19. #include "JackConstants.h"
  20. namespace Jack
  21. {
  22. #define ALL_PORTS 0xFFFF
  23. #define NO_PORT 0xFFFE
  24. /*!
  25. \brief Base class for port.
  26. */
  27. class JackPort
  28. {
  29. friend class JackGraphManager;
  30. private:
  31. int fTypeId;
  32. enum JackPortFlags fFlags;
  33. char fName[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
  34. char fAlias1[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
  35. char fAlias2[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
  36. int fRefNum;
  37. jack_nframes_t fLatency;
  38. jack_nframes_t fTotalLatency;
  39. uint8_t fMonitorRequests;
  40. bool fInUse;
  41. jack_port_id_t fTied; // Locally tied source port
  42. #ifdef WIN32
  43. //__declspec(align(16)) float fBuffer[BUFFER_SIZE_MAX];
  44. float fBuffer[BUFFER_SIZE_MAX];
  45. #elif __GNUC__
  46. float fBuffer[BUFFER_SIZE_MAX] __attribute__((aligned(64))); // 16 alignment for vector code, 64 better for cache loads/stores
  47. #else
  48. #warning Buffer will not be aligned on 16 bytes boundaries : vector based code (Altivec of SSE) will fail
  49. float fBuffer[BUFFER_SIZE_MAX];
  50. #endif
  51. bool IsUsed() const;
  52. // RT
  53. void ClearBuffer(jack_nframes_t frames);
  54. void MixBuffers(void** src_buffers, int src_count, jack_nframes_t frames);
  55. public:
  56. JackPort();
  57. virtual ~JackPort();
  58. bool Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
  59. void Release();
  60. const char* GetName() const;
  61. const char* GetShortName() const;
  62. int SetName(const char* name);
  63. void Rename(const char* name, int index);
  64. int GetAliases(char* const aliases[2]);
  65. int SetAlias(const char* alias);
  66. int UnsetAlias(const char* alias);
  67. bool NameEquals(const char* target);
  68. int GetFlags() const;
  69. const char* GetType() const;
  70. int Tie(jack_port_id_t port_index);
  71. int UnTie();
  72. jack_nframes_t GetLatency() const;
  73. jack_nframes_t GetTotalLatency() const;
  74. void SetLatency(jack_nframes_t latency);
  75. int RequestMonitor(bool onoff);
  76. int EnsureMonitor(bool onoff);
  77. bool MonitoringInput();
  78. float* GetBuffer();
  79. int GetRefNum() const;
  80. };
  81. } // end of namespace
  82. #endif