Overte C++ Documentation
AudioReverb.h
1 //
2 // AudioReverb.h
3 // libraries/audio/src
4 //
5 // Created by Ken Cooke on 10/11/15.
6 // Copyright 2015 High Fidelity, Inc.
7 //
8 
9 #ifndef hifi_AudioReverb_h
10 #define hifi_AudioReverb_h
11 
12 #include <stdint.h>
13 
14 typedef struct ReverbParameters {
15 
16  float sampleRate; // [24000, 48000] Hz
17  float bandwidth; // [20, 24000] Hz
18 
19  float preDelay; // [0, 333] ms
20  float lateDelay; // [0, 166] ms
21 
22  float reverbTime; // [0.1, 100] seconds
23 
24  float earlyDiffusion; // [0, 100] percent
25  float lateDiffusion; // [0, 100] percent
26 
27  float roomSize; // [0, 100] percent
28  float density; // [0, 100] percent
29 
30  float bassMult; // [0.1, 10] ratio
31  float bassFreq; // [10, 500] Hz
32  float highGain; // [-24, 0] dB
33  float highFreq; // [1000, 12000] Hz
34 
35  float modRate; // [0.1, 10] Hz
36  float modDepth; // [0, 100] percent
37 
38  float earlyGain; // [-96, +24] dB
39  float lateGain; // [-96, +24] dB
40 
41  float earlyMixLeft; // [0, 100] percent
42  float earlyMixRight; // [0, 100] percent
43  float lateMixLeft; // [0, 100] percent
44  float lateMixRight; // [0, 100] percent
45 
46  float wetDryMix; // [0, 100] percent
47 
48 } ReverbParameters;
49 
50 class ReverbImpl;
51 
52 class AudioReverb {
53 public:
54  AudioReverb(float sampleRate);
55  ~AudioReverb();
56 
57  void setParameters(ReverbParameters *p);
58  void getParameters(ReverbParameters *p);
59  void reset();
60 
61  // deinterleaved float input/output (native format)
62  void render(float** inputs, float** outputs, int numFrames);
63 
64  // interleaved int16_t input/output
65  void render(const int16_t* input, int16_t* output, int numFrames);
66 
67  // interleaved float input/output
68  void render(const float* input, float* output, int numFrames);
69 
70 private:
71  ReverbImpl *_impl;
72  ReverbParameters _params;
73 
74  float* _inout[2];
75 
76  void convertInput(const int16_t* input, float** outputs, int numFrames);
77  void convertOutput(float** inputs, int16_t* output, int numFrames);
78 
79  void convertInput(const float* input, float** outputs, int numFrames);
80  void convertOutput(float** inputs, float* output, int numFrames);
81 };
82 
83 #endif // hifi_AudioReverb_h