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.

133 lines
4.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the Water library.
  4. Copyright (c) 2015 ROLI Ltd.
  5. Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
  6. Permission is granted to use this software under the terms of either:
  7. a) the GPL v2 (or any later version)
  8. b) the Affero GPL v3
  9. Details of these licenses can be found 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.juce.com for more information.
  16. ==============================================================================
  17. */
  18. #include "AudioProcessor.h"
  19. namespace water {
  20. AudioProcessor::AudioProcessor()
  21. {
  22. cachedTotalIns = 0;
  23. cachedTotalOuts = 0;
  24. // playHead = nullptr;
  25. currentSampleRate = 0;
  26. blockSize = 0;
  27. latencySamples = 0;
  28. suspended = false;
  29. nonRealtime = false;
  30. }
  31. AudioProcessor::~AudioProcessor()
  32. {
  33. }
  34. //==============================================================================
  35. // void AudioProcessor::setPlayHead (AudioPlayHead* const newPlayHead)
  36. // {
  37. // playHead = newPlayHead;
  38. // }
  39. void AudioProcessor::setPlayConfigDetails (const int newNumIns,
  40. const int newNumOuts,
  41. const double newSampleRate,
  42. const int newBlockSize)
  43. {
  44. cachedTotalIns = newNumIns;
  45. cachedTotalOuts = newNumOuts;
  46. setRateAndBufferSizeDetails (newSampleRate, newBlockSize);
  47. }
  48. void AudioProcessor::setRateAndBufferSizeDetails (double newSampleRate, int newBlockSize) noexcept
  49. {
  50. currentSampleRate = newSampleRate;
  51. blockSize = newBlockSize;
  52. }
  53. //==============================================================================
  54. void AudioProcessor::setNonRealtime (const bool newNonRealtime) noexcept
  55. {
  56. nonRealtime = newNonRealtime;
  57. }
  58. void AudioProcessor::setLatencySamples (const int newLatency)
  59. {
  60. if (latencySamples != newLatency)
  61. latencySamples = newLatency;
  62. }
  63. void AudioProcessor::suspendProcessing (const bool shouldBeSuspended)
  64. {
  65. const CarlaRecursiveMutexLocker cml (callbackLock);
  66. suspended = shouldBeSuspended;
  67. }
  68. void AudioProcessor::reset() {}
  69. void AudioProcessor::processBypassed (AudioSampleBuffer& buffer, MidiBuffer&)
  70. {
  71. for (int ch = getTotalNumInputChannels(); ch < getTotalNumOutputChannels(); ++ch)
  72. buffer.clear (ch, 0, buffer.getNumSamples());
  73. }
  74. void AudioProcessor::processBlockBypassed (AudioSampleBuffer& buffer, MidiBuffer& midi) { processBypassed (buffer, midi); }
  75. #if 0
  76. //==============================================================================
  77. bool AudioPlayHead::CurrentPositionInfo::operator== (const CurrentPositionInfo& other) const noexcept
  78. {
  79. return timeInSamples == other.timeInSamples
  80. && ppqPosition == other.ppqPosition
  81. && editOriginTime == other.editOriginTime
  82. && ppqPositionOfLastBarStart == other.ppqPositionOfLastBarStart
  83. && frameRate == other.frameRate
  84. && isPlaying == other.isPlaying
  85. && isRecording == other.isRecording
  86. && bpm == other.bpm
  87. && timeSigNumerator == other.timeSigNumerator
  88. && timeSigDenominator == other.timeSigDenominator
  89. && ppqLoopStart == other.ppqLoopStart
  90. && ppqLoopEnd == other.ppqLoopEnd
  91. && isLooping == other.isLooping;
  92. }
  93. bool AudioPlayHead::CurrentPositionInfo::operator!= (const CurrentPositionInfo& other) const noexcept
  94. {
  95. return ! operator== (other);
  96. }
  97. void AudioPlayHead::CurrentPositionInfo::resetToDefault()
  98. {
  99. zerostruct (*this);
  100. timeSigNumerator = 4;
  101. timeSigDenominator = 4;
  102. bpm = 120;
  103. }
  104. #endif
  105. }