Audio plugin host https://kx.studio/carla
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.

132 lines
4.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #include "AudioProcessor.h"
  18. namespace water {
  19. AudioProcessor::AudioProcessor()
  20. {
  21. cachedTotalIns = 0;
  22. cachedTotalOuts = 0;
  23. // playHead = nullptr;
  24. currentSampleRate = 0;
  25. blockSize = 0;
  26. latencySamples = 0;
  27. suspended = false;
  28. nonRealtime = false;
  29. }
  30. AudioProcessor::~AudioProcessor()
  31. {
  32. }
  33. //==============================================================================
  34. // void AudioProcessor::setPlayHead (AudioPlayHead* const newPlayHead)
  35. // {
  36. // playHead = newPlayHead;
  37. // }
  38. void AudioProcessor::setPlayConfigDetails (const int newNumIns,
  39. const int newNumOuts,
  40. const double newSampleRate,
  41. const int newBlockSize)
  42. {
  43. cachedTotalIns = newNumIns;
  44. cachedTotalOuts = newNumOuts;
  45. setRateAndBufferSizeDetails (newSampleRate, newBlockSize);
  46. }
  47. void AudioProcessor::setRateAndBufferSizeDetails (double newSampleRate, int newBlockSize) noexcept
  48. {
  49. currentSampleRate = newSampleRate;
  50. blockSize = newBlockSize;
  51. }
  52. //==============================================================================
  53. void AudioProcessor::setNonRealtime (const bool newNonRealtime) noexcept
  54. {
  55. nonRealtime = newNonRealtime;
  56. }
  57. void AudioProcessor::setLatencySamples (const int newLatency)
  58. {
  59. if (latencySamples != newLatency)
  60. latencySamples = newLatency;
  61. }
  62. void AudioProcessor::suspendProcessing (const bool shouldBeSuspended)
  63. {
  64. const CarlaRecursiveMutexLocker cml (callbackLock);
  65. suspended = shouldBeSuspended;
  66. }
  67. void AudioProcessor::reset() {}
  68. void AudioProcessor::processBypassed (AudioSampleBuffer& buffer, MidiBuffer&)
  69. {
  70. for (int ch = getTotalNumInputChannels(); ch < getTotalNumOutputChannels(); ++ch)
  71. buffer.clear (ch, 0, buffer.getNumSamples());
  72. }
  73. void AudioProcessor::processBlockBypassed (AudioSampleBuffer& buffer, MidiBuffer& midi) { processBypassed (buffer, midi); }
  74. #if 0
  75. //==============================================================================
  76. bool AudioPlayHead::CurrentPositionInfo::operator== (const CurrentPositionInfo& other) const noexcept
  77. {
  78. return timeInSamples == other.timeInSamples
  79. && ppqPosition == other.ppqPosition
  80. && editOriginTime == other.editOriginTime
  81. && ppqPositionOfLastBarStart == other.ppqPositionOfLastBarStart
  82. && frameRate == other.frameRate
  83. && isPlaying == other.isPlaying
  84. && isRecording == other.isRecording
  85. && bpm == other.bpm
  86. && timeSigNumerator == other.timeSigNumerator
  87. && timeSigDenominator == other.timeSigDenominator
  88. && ppqLoopStart == other.ppqLoopStart
  89. && ppqLoopEnd == other.ppqLoopEnd
  90. && isLooping == other.isLooping;
  91. }
  92. bool AudioPlayHead::CurrentPositionInfo::operator!= (const CurrentPositionInfo& other) const noexcept
  93. {
  94. return ! operator== (other);
  95. }
  96. void AudioPlayHead::CurrentPositionInfo::resetToDefault()
  97. {
  98. zerostruct (*this);
  99. timeSigNumerator = 4;
  100. timeSigDenominator = 4;
  101. bpm = 120;
  102. }
  103. #endif
  104. }