The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

142 lines
5.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  19. #define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__
  20. //==============================================================================
  21. /**
  22. A subclass of AudioPlayHead can supply information about the position and
  23. status of a moving play head during audio playback.
  24. One of these can be supplied to an AudioProcessor object so that it can find
  25. out about the position of the audio that it is rendering.
  26. @see AudioProcessor::setPlayHead, AudioProcessor::getPlayHead
  27. */
  28. class JUCE_API AudioPlayHead
  29. {
  30. protected:
  31. //==============================================================================
  32. AudioPlayHead() {}
  33. public:
  34. virtual ~AudioPlayHead() {}
  35. //==============================================================================
  36. /** Frame rate types. */
  37. enum FrameRateType
  38. {
  39. fps24 = 0,
  40. fps25 = 1,
  41. fps2997 = 2,
  42. fps30 = 3,
  43. fps2997drop = 4,
  44. fps30drop = 5,
  45. fpsUnknown = 99
  46. };
  47. //==============================================================================
  48. /** This structure is filled-in by the AudioPlayHead::getCurrentPosition() method.
  49. */
  50. struct JUCE_API CurrentPositionInfo
  51. {
  52. /** The tempo in BPM */
  53. double bpm;
  54. /** Time signature numerator, e.g. the 3 of a 3/4 time sig */
  55. int timeSigNumerator;
  56. /** Time signature denominator, e.g. the 4 of a 3/4 time sig */
  57. int timeSigDenominator;
  58. /** The current play position, in samples from the start of the edit. */
  59. int64 timeInSamples;
  60. /** The current play position, in seconds from the start of the edit. */
  61. double timeInSeconds;
  62. /** For timecode, the position of the start of the edit, in seconds from 00:00:00:00. */
  63. double editOriginTime;
  64. /** The current play position in pulses-per-quarter-note.
  65. This is the number of quarter notes since the edit start.
  66. */
  67. double ppqPosition;
  68. /** The position of the start of the last bar, in pulses-per-quarter-note.
  69. This is the number of quarter notes from the start of the edit to the
  70. start of the current bar.
  71. Note - this value may be unavailable on some hosts, e.g. Pro-Tools. If
  72. it's not available, the value will be 0.
  73. */
  74. double ppqPositionOfLastBarStart;
  75. /** The video frame rate, if applicable. */
  76. FrameRateType frameRate;
  77. /** True if the transport is currently playing. */
  78. bool isPlaying;
  79. /** True if the transport is currently recording.
  80. (When isRecording is true, then isPlaying will also be true).
  81. */
  82. bool isRecording;
  83. /** The current cycle start position in pulses-per-quarter-note.
  84. Note that not all hosts or plugin formats may provide this value.
  85. @see isLooping
  86. */
  87. double ppqLoopStart;
  88. /** The current cycle end position in pulses-per-quarter-note.
  89. Note that not all hosts or plugin formats may provide this value.
  90. @see isLooping
  91. */
  92. double ppqLoopEnd;
  93. /** True if the transport is currently looping. */
  94. bool isLooping;
  95. //==============================================================================
  96. bool operator== (const CurrentPositionInfo& other) const noexcept;
  97. bool operator!= (const CurrentPositionInfo& other) const noexcept;
  98. void resetToDefault();
  99. };
  100. //==============================================================================
  101. /** Fills-in the given structure with details about the transport's
  102. position at the start of the current processing block.
  103. */
  104. virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
  105. };
  106. #endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__