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.

128 lines
3.9KB

  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 the GNU
  7. General Public License as published by the Free Software Foundation;
  8. either version 2 of the License, or any later version.
  9. This program is distributed in the hope that it will be useful, but WITHOUT
  10. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. For a full copy of the GNU General Public License see the doc/GPL.txt file.
  13. ==============================================================================
  14. */
  15. #include "AudioProcessor.h"
  16. namespace water {
  17. AudioProcessor::AudioProcessor()
  18. {
  19. cachedTotalIns = 0;
  20. cachedTotalOuts = 0;
  21. // playHead = nullptr;
  22. currentSampleRate = 0;
  23. blockSize = 0;
  24. latencySamples = 0;
  25. suspended = false;
  26. nonRealtime = false;
  27. }
  28. AudioProcessor::~AudioProcessor()
  29. {
  30. }
  31. //==============================================================================
  32. // void AudioProcessor::setPlayHead (AudioPlayHead* const newPlayHead)
  33. // {
  34. // playHead = newPlayHead;
  35. // }
  36. void AudioProcessor::setPlayConfigDetails (const int newNumIns,
  37. const int newNumOuts,
  38. const double newSampleRate,
  39. const int newBlockSize)
  40. {
  41. cachedTotalIns = newNumIns;
  42. cachedTotalOuts = newNumOuts;
  43. setRateAndBufferSizeDetails (newSampleRate, newBlockSize);
  44. }
  45. void AudioProcessor::setRateAndBufferSizeDetails (double newSampleRate, int newBlockSize) noexcept
  46. {
  47. currentSampleRate = newSampleRate;
  48. blockSize = newBlockSize;
  49. }
  50. //==============================================================================
  51. void AudioProcessor::setNonRealtime (const bool newNonRealtime) noexcept
  52. {
  53. nonRealtime = newNonRealtime;
  54. }
  55. void AudioProcessor::setLatencySamples (const int newLatency)
  56. {
  57. if (latencySamples != newLatency)
  58. latencySamples = newLatency;
  59. }
  60. void AudioProcessor::suspendProcessing (const bool shouldBeSuspended)
  61. {
  62. const CarlaRecursiveMutexLocker cml (callbackLock);
  63. suspended = shouldBeSuspended;
  64. }
  65. void AudioProcessor::reset() {}
  66. void AudioProcessor::processBypassed (AudioSampleBuffer& buffer, MidiBuffer&)
  67. {
  68. for (int ch = getTotalNumInputChannels(); ch < getTotalNumOutputChannels(); ++ch)
  69. buffer.clear (ch, 0, buffer.getNumSamples());
  70. }
  71. void AudioProcessor::processBlockBypassed (AudioSampleBuffer& buffer, MidiBuffer& midi) { processBypassed (buffer, midi); }
  72. #if 0
  73. //==============================================================================
  74. bool AudioPlayHead::CurrentPositionInfo::operator== (const CurrentPositionInfo& other) const noexcept
  75. {
  76. return timeInSamples == other.timeInSamples
  77. && ppqPosition == other.ppqPosition
  78. && editOriginTime == other.editOriginTime
  79. && ppqPositionOfLastBarStart == other.ppqPositionOfLastBarStart
  80. && frameRate == other.frameRate
  81. && isPlaying == other.isPlaying
  82. && isRecording == other.isRecording
  83. && bpm == other.bpm
  84. && timeSigNumerator == other.timeSigNumerator
  85. && timeSigDenominator == other.timeSigDenominator
  86. && ppqLoopStart == other.ppqLoopStart
  87. && ppqLoopEnd == other.ppqLoopEnd
  88. && isLooping == other.isLooping;
  89. }
  90. bool AudioPlayHead::CurrentPositionInfo::operator!= (const CurrentPositionInfo& other) const noexcept
  91. {
  92. return ! operator== (other);
  93. }
  94. void AudioPlayHead::CurrentPositionInfo::resetToDefault()
  95. {
  96. zerostruct (*this);
  97. timeSigNumerator = 4;
  98. timeSigDenominator = 4;
  99. bpm = 120;
  100. }
  101. #endif
  102. }