-
Notifications
You must be signed in to change notification settings - Fork 2
/
audio_engine.cpp
58 lines (43 loc) · 1.26 KB
/
audio_engine.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
==============================================================================
AudioEngine.cpp
Created: 1 Sep 2021 6:24:22pm
Author: Thomas Hézard
==============================================================================
*/
#include "audio_engine.h"
#include <cassert>
#include <cstring>
AudioEngine::AudioEngine() : audio_processor_{}, parameter_a_{0.0f}, parameter_b_{0.0f}
{
}
void AudioEngine::prepareResources(int maxSamplesPerBlock, double sampleRate)
{
audio_processor_.Prepare();
}
void AudioEngine::releaseResources()
{
}
void AudioEngine::processAudioData(float *const*ioAudioData, int inputNumChannels, int outputNumChannels, int numSamples)
{
assert(inputNumChannels == 1);
assert(outputNumChannels == 2);
audio_processor_.Process(ioAudioData[0], ioAudioData[0], numSamples);
memcpy(ioAudioData[1], ioAudioData[0], numSamples*sizeof(float));
}
void AudioEngine::setParameterA(float parameter)
{
parameter_a_ = parameter;
}
float AudioEngine::getParameterA() const
{
return parameter_a_;
}
void AudioEngine::setParameterB(float parameter)
{
parameter_b_ = parameter;
}
float AudioEngine::getParameterB() const
{
return parameter_b_;
}