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.

99 lines
2.2KB

  1. /*
  2. Copyright (C) 2001 Paul Davis
  3. Copyright (C) 2004-2006 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. enum JackPortFlags fFlags;
  32. char fName[JACK_PORT_NAME_SIZE + 2];
  33. int fRefNum;
  34. jack_nframes_t fLatency;
  35. uint8_t fMonitorRequests;
  36. bool fInUse;
  37. bool fLocked;
  38. jack_port_id_t fTied; // Locally tied source port
  39. float fBuffer[BUFFER_SIZE_MAX];
  40. bool IsUsed() const;
  41. static void MixBuffer(float* mixbuffer, float* buffer, jack_nframes_t frames);
  42. public:
  43. JackPort();
  44. virtual ~JackPort();
  45. void Allocate(int refnum, const char* port_name, JackPortFlags flags);
  46. void Release();
  47. const char* GetName() const;
  48. const char* GetShortName() const;
  49. int SetName(const char * name);
  50. int Flags() const;
  51. const char* Type() const;
  52. int Lock();
  53. int Unlock();
  54. int Tie(jack_port_id_t port_index);
  55. int UnTie();
  56. jack_nframes_t GetLatency() const;
  57. void SetLatency(jack_nframes_t latency);
  58. int RequestMonitor(bool onoff);
  59. int EnsureMonitor(bool onoff);
  60. bool MonitoringInput();
  61. float* GetBuffer();
  62. int GetRefNum() const;
  63. };
  64. } // end of namespace
  65. #endif