LMMS
Loading...
Searching...
No Matches
AudioProcessor.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
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>
7
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.
11
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.
15
16 For a full copy of the GNU General Public License see the doc/GPL.txt file.
17
18 ==============================================================================
19*/
20
21#include "AudioProcessor.h"
22
23namespace water {
24
26{
27 numAudioIns = 0;
28 numAudioOuts = 0;
29 numCVIns = 0;
30 numCVOuts = 0;
31 numMIDIIns = 0;
32 numMIDIOuts = 0;
33
35 blockSize = 0;
37
38 suspended = false;
39 nonRealtime = false;
40}
41
45
46//==============================================================================
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)
55{
56 numAudioIns = newNumIns;
57 numAudioOuts = newNumOuts;
58 numCVIns = newNumCVIns;
59 numCVOuts = newNumCVOuts;
60 numMIDIIns = newNumMIDIIns;
61 numMIDIOuts = newNumMIDIOuts;
62 setRateAndBufferSizeDetails (newSampleRate, newBlockSize);
63}
64
65void AudioProcessor::setRateAndBufferSizeDetails (double newSampleRate, int newBlockSize) noexcept
66{
67 currentSampleRate = newSampleRate;
68 blockSize = newBlockSize;
69}
70
71//==============================================================================
72void AudioProcessor::setNonRealtime (const bool newNonRealtime) noexcept
73{
74 nonRealtime = newNonRealtime;
75}
76
77void AudioProcessor::setLatencySamples (const int newLatency)
78{
79 if (latencySamples != newLatency)
80 latencySamples = newLatency;
81}
82
83void AudioProcessor::suspendProcessing (const bool shouldBeSuspended)
84{
85 const CarlaRecursiveMutexLocker cml (callbackLock);
86 suspended = shouldBeSuspended;
87}
88
91
93{
94 switch (t)
95 {
97 return numAudioIns;
98 case ChannelTypeCV:
99 return numCVIns;
100 case ChannelTypeMIDI:
101 return numMIDIIns;
102 }
103
104 return 0;
105}
106
108{
109 switch (t)
110 {
111 case ChannelTypeAudio:
112 return numAudioOuts;
113 case ChannelTypeCV:
114 return numCVOuts;
115 case ChannelTypeMIDI:
116 return numMIDIOuts;
117 }
118
119 return 0;
120}
121
123{
124 return t == ChannelTypeMIDI ? "events-in" : "";
125}
126
128{
129 return t == ChannelTypeMIDI ? "events-out" : "";
130}
131
132}
unsigned int uint
Definition CarlaDefines.h:327
bool suspended
Definition AudioProcessor.h:319
virtual void setNonRealtime(bool isNonRealtime) noexcept
Definition AudioProcessor.cpp:72
uint getTotalNumOutputChannels(ChannelType t) const noexcept
Definition AudioProcessor.cpp:107
virtual const String getOutputChannelName(ChannelType, uint) const
Definition AudioProcessor.cpp:127
virtual ~AudioProcessor()
Definition AudioProcessor.cpp:42
void setPlayConfigDetails(uint numAudioIns, uint numAudioOuts, uint numCVIns, uint numCVOuts, uint numMIDIIns, uint numMIDIOuts, double sampleRate, int blockSize)
Definition AudioProcessor.cpp:47
virtual void reconfigure()
Definition AudioProcessor.cpp:90
uint numMIDIIns
Definition AudioProcessor.h:324
uint getTotalNumInputChannels(ChannelType t) const noexcept
Definition AudioProcessor.cpp:92
bool nonRealtime
Definition AudioProcessor.h:319
uint numMIDIOuts
Definition AudioProcessor.h:324
AudioProcessor()
Definition AudioProcessor.cpp:25
void setLatencySamples(int newLatency)
Definition AudioProcessor.cpp:77
ChannelType
Definition AudioProcessor.h:58
@ ChannelTypeCV
Definition AudioProcessor.h:60
@ ChannelTypeMIDI
Definition AudioProcessor.h:61
@ ChannelTypeAudio
Definition AudioProcessor.h:59
int blockSize
Definition AudioProcessor.h:318
uint numCVIns
Definition AudioProcessor.h:323
virtual void reset()
Definition AudioProcessor.cpp:89
CarlaRecursiveMutex callbackLock
Definition AudioProcessor.h:320
void setRateAndBufferSizeDetails(double sampleRate, int blockSize) noexcept
Definition AudioProcessor.cpp:65
void suspendProcessing(bool shouldBeSuspended)
Definition AudioProcessor.cpp:83
uint numCVOuts
Definition AudioProcessor.h:323
uint numAudioIns
Definition AudioProcessor.h:322
double currentSampleRate
Definition AudioProcessor.h:317
virtual const String getInputChannelName(ChannelType, uint) const
Definition AudioProcessor.cpp:122
uint numAudioOuts
Definition AudioProcessor.h:322
int latencySamples
Definition AudioProcessor.h:318
Definition String.h:48
struct huft * t
Definition inflate.c:943
Definition AudioSampleBuffer.h:33