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.

AudioProcessor.cpp 2.6KB

6 years ago
6 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. ==============================================================================
  3. This file is part of the Water library.
  4. Copyright (c) 2015 ROLI Ltd.
  5. Copyright (C) 2017-2018 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. currentSampleRate = 0;
  22. blockSize = 0;
  23. latencySamples = 0;
  24. suspended = false;
  25. nonRealtime = false;
  26. }
  27. AudioProcessor::~AudioProcessor()
  28. {
  29. }
  30. //==============================================================================
  31. void AudioProcessor::setPlayConfigDetails (const int newNumIns,
  32. const int newNumOuts,
  33. const double newSampleRate,
  34. const int newBlockSize)
  35. {
  36. cachedTotalIns = newNumIns;
  37. cachedTotalOuts = newNumOuts;
  38. setRateAndBufferSizeDetails (newSampleRate, newBlockSize);
  39. }
  40. void AudioProcessor::setRateAndBufferSizeDetails (double newSampleRate, int newBlockSize) noexcept
  41. {
  42. currentSampleRate = newSampleRate;
  43. blockSize = newBlockSize;
  44. }
  45. //==============================================================================
  46. void AudioProcessor::setNonRealtime (const bool newNonRealtime) noexcept
  47. {
  48. nonRealtime = newNonRealtime;
  49. }
  50. void AudioProcessor::setLatencySamples (const int newLatency)
  51. {
  52. if (latencySamples != newLatency)
  53. latencySamples = newLatency;
  54. }
  55. void AudioProcessor::suspendProcessing (const bool shouldBeSuspended)
  56. {
  57. const CarlaRecursiveMutexLocker cml (callbackLock);
  58. suspended = shouldBeSuspended;
  59. }
  60. void AudioProcessor::reset() {}
  61. void AudioProcessor::processBlockBypassed (AudioSampleBuffer& buffer, MidiBuffer&)
  62. {
  63. for (int ch = getTotalNumInputChannels(); ch < getTotalNumOutputChannels(); ++ch)
  64. buffer.clear (ch, 0, buffer.getNumSamples());
  65. }
  66. }