Add initial bits for Qt6 support
[carla.git] / source / modules / water / processors / AudioProcessor.cpp
blobe8e09a2fca2bc66986baaa3fdbc1d87968728d57
1 /*
2 ==============================================================================
4 This file is part of the Water library.
5 Copyright (c) 2015 ROLI Ltd.
6 Copyright (C) 2017-2018 Filipe Coelho <falktx@falktx.com>
8 Permission is granted to use this software under the terms of the GNU
9 General Public License as published by the Free Software Foundation;
10 either version 2 of the License, or any later version.
12 This program is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 ==============================================================================
21 #include "AudioProcessor.h"
23 namespace water {
25 AudioProcessor::AudioProcessor()
27 numAudioIns = 0;
28 numAudioOuts = 0;
29 numCVIns = 0;
30 numCVOuts = 0;
31 numMIDIIns = 0;
32 numMIDIOuts = 0;
34 currentSampleRate = 0;
35 blockSize = 0;
36 latencySamples = 0;
38 suspended = false;
39 nonRealtime = false;
42 AudioProcessor::~AudioProcessor()
46 //==============================================================================
47 void AudioProcessor::setPlayConfigDetails (const uint newNumIns,
48 const uint newNumOuts,
49 const uint newNumCVIns,
50 const uint newNumCVOuts,
51 const uint newNumMIDIIns,
52 const uint newNumMIDIOuts,
53 const double newSampleRate,
54 const int newBlockSize)
56 numAudioIns = newNumIns;
57 numAudioOuts = newNumOuts;
58 numCVIns = newNumCVIns;
59 numCVOuts = newNumCVOuts;
60 numMIDIIns = newNumMIDIIns;
61 numMIDIOuts = newNumMIDIOuts;
62 setRateAndBufferSizeDetails (newSampleRate, newBlockSize);
65 void AudioProcessor::setRateAndBufferSizeDetails (double newSampleRate, int newBlockSize) noexcept
67 currentSampleRate = newSampleRate;
68 blockSize = newBlockSize;
71 //==============================================================================
72 void AudioProcessor::setNonRealtime (const bool newNonRealtime) noexcept
74 nonRealtime = newNonRealtime;
77 void AudioProcessor::setLatencySamples (const int newLatency)
79 if (latencySamples != newLatency)
80 latencySamples = newLatency;
83 void AudioProcessor::suspendProcessing (const bool shouldBeSuspended)
85 const CarlaRecursiveMutexLocker cml (callbackLock);
86 suspended = shouldBeSuspended;
89 void AudioProcessor::reset() {}
90 void AudioProcessor::reconfigure() {}
92 uint AudioProcessor::getTotalNumInputChannels(ChannelType t) const noexcept
94 switch (t)
96 case ChannelTypeAudio:
97 return numAudioIns;
98 case ChannelTypeCV:
99 return numCVIns;
100 case ChannelTypeMIDI:
101 return numMIDIIns;
104 return 0;
107 uint AudioProcessor::getTotalNumOutputChannels(ChannelType t) const noexcept
109 switch (t)
111 case ChannelTypeAudio:
112 return numAudioOuts;
113 case ChannelTypeCV:
114 return numCVOuts;
115 case ChannelTypeMIDI:
116 return numMIDIOuts;
119 return 0;
122 const String AudioProcessor::getInputChannelName(ChannelType t, uint) const
124 return t == ChannelTypeMIDI ? "events-in" : "";
127 const String AudioProcessor::getOutputChannelName(ChannelType t, uint) const
129 return t == ChannelTypeMIDI ? "events-out" : "";