Aviate Audio Multiverse Library
AudioEffectWrapper.h
Go to the documentation of this file.
1 /**************************************************************************/
14 #ifndef AVIATE_AUDIOEFFECT_WRAPPER_H_
15 #define AVIATE_AUDIOEFFECT_WRAPPER_H_
16 
17 #include "sysPlatform/SysTypes.h"
18 #include "sysPlatform/AudioStream.h"
19 #include "Aviate/Aviate.h"
20 #include "Aviate/ForwardDeclares.h"
21 #include "Aviate/LibBasicFunctions.h"
22 #include "Aviate/SramManager.h"
23 
24 namespace Aviate {
25 
28 public:
29 
31  virtual ~AudioEffectWrapper();
32 
35  virtual const char* getName() = 0;
36 
40  virtual void setParam(int paramIndex, float paramValue) = 0;
41 
46  virtual float getUserParamValue(int paramIndex, float normalizedParamValue) = 0;
47 
51  void sendValueReport(int controlIndex, float value);
52 
56  virtual void inputLevelAdjust(float scaleFactor);
57 
59  virtual void resetInputPeak();
60 
63  virtual uint16_t getInputPeak();
64 
66  virtual void resetOutputPeak();
67 
70  virtual uint16_t getOutputPeak();
71 
73  virtual void enable();
74 
76  virtual void disable();
77 
81  virtual void bypass(bool byp);
82 
85  virtual bool isBypass();
86 
88  virtual void toggleBypass();
89 
93  virtual void volume(float vol);
94 
98  virtual void volumeDb(float volDb);
99 
102  bool isSramReady();
103 
107 
108  // ** MIDI **
109 
114  virtual void setMidiOmni(bool isOmni);
115 
122  virtual void mapMidiControl(int parameter, int midiCC, int midiChannel = 0) = 0;
123 
128  virtual void processMidi(int channel, int midiCC, int value) = 0;
129 
132  virtual const uint8_t* getRblk() = 0;
133 
134 protected:
135  static constexpr int MIDI_CHANNEL = 0;
136  static constexpr int MIDI_CONTROL = 1;
137 
138  bool m_isOmni = false;
139  bool m_bypass = true;
140  bool m_enable = false;
141 
142  float m_inputScaleFactor = 1.0f;
143  uint16_t m_inputMaxPeak = 0;
144  uint16_t m_outputMaxPeak = 0;
145  float m_volume = 1.0f;
146 
147  SramManager* m_sramManagerPtr = nullptr;
148  ReportManager* m_reportManagerPtr = nullptr;
149 
152  void m_updateInputPeak(const audio_block_t* block);
153 
156  void m_updateInputPeak(const int16_t* audioData);
157 
160  void m_updateOutputPeak(const audio_block_t* block);
161 
164  void m_updateOutputPeak(const int16_t* audioData);
165 
169  void m_updatePeak(const int16_t* audioData, uint16_t &peak);
170 
174  void m_applyInputScaling(audio_block_t* block);
175 
176 };
177 
178 }
179 
180 #endif /* AVIATE_AUDIOEFFECT_WRAPPER_H_ */
#define AVIATE_API
enable default visibility. This is used for public API functions and classes.
Definition: Aviate.h:19
Audio Effect base class.
Definition: AudioEffectWrapper.h:27
void m_updateOutputPeak(const int16_t *audioData)
Process an audio block as a raw int16_t array and update the m_outputMaxPeak protected variable.
void sendValueReport(int controlIndex, float value)
For MONITOR-only controls, you can report them to the host using sendValueReport().
virtual uint16_t getOutputPeak()
Get the output peak level as a uint16_t.
virtual void volume(float vol)
Set the output volume. This affect both the wet and dry signals.
bool isSramReady()
Checks to seeif the SRAM Manager is ready.
virtual void processMidi(int channel, int midiCC, int value)=0
process a MIDI Continous-Controller (CC) message
virtual void resetInputPeak()
Reset the peak recorded input level.
virtual void toggleBypass()
Toggle the bypass effect.
virtual ~AudioEffectWrapper()
Destructor.
AudioEffectWrapper()
Constructor.
virtual void setParam(int paramIndex, float paramValue)=0
Updates the effect with specified parameter index and value.
void m_updateInputPeak(const audio_block_t *block)
Process an audio_block_t and update the m_inputMaxPeak protected variable.
virtual void mapMidiControl(int parameter, int midiCC, int midiChannel=0)=0
Configure an effect parameter to be controlled by a MIDI CC number on a particular channel.
virtual void enable()
Enables audio processing. Note: when not enabled, CPU load is nearly zero.
virtual void disable()
Disables audio process. When disabled, CPU load is nearly zero.
virtual void resetOutputPeak()
Reset the peak output level recorded.
void m_applyInputScaling(audio_block_t *block)
Convenience function for EFX developer. If you wish to apply input scaling, this function will use th...
void m_updateOutputPeak(const audio_block_t *block)
Process an audio_block_t and update the m_outputMaxPeak protected variable.
virtual void bypass(bool byp)
Bypass the effect.
void m_updateInputPeak(const int16_t *audioData)
Process an audio block as a raw int16_t array and update the m_inputMaxPeak protected variable.
virtual void setMidiOmni(bool isOmni)
Sets whether MIDI OMNI channel is processig on or off. When on, all midi channels are used for matchi...
virtual uint16_t getInputPeak()
Get the input peak level as a uint16_t.
void m_updatePeak(const int16_t *audioData, uint16_t &peak)
Internal function used to find the peak in a raw block of audio samples. Size must be AUDIO_SAMPLES_P...
virtual void volumeDb(float volDb)
Set the output volume in negative dB. Unity is 0.0, half volume would be -6.0 dB, etc.
virtual bool isBypass()
Get if the effect is bypassed.
virtual void inputLevelAdjust(float scaleFactor)
(OPTIONAL) controls an input scaling value applied to effects. This must be implemented by the effect...
virtual const uint8_t * getRblk()=0
Audio synchronization.
virtual const char * getName()=0
Name of the effect. This is normally implemented by automatically by the EffectCreator App.
SramManager * getSramManager()
Returns a pointer to the SramManager.
virtual float getUserParamValue(int paramIndex, float normalizedParamValue)=0
Converts a normalized [0,1.0] value to the user value/range from Effect Creator.
ReportManager provides a class to allows effects to report information back to the host computer.
Definition: ReportManager.h:30
SramManager provides a class to handle dividing an external SPI RAM into independent slots for genera...
Definition: SramManager.h:192
The Aviate library/namespace provides the primary API for working with Multiverse.
Definition: AudioEffectWrapper.h:24