iPlug2 - C++ Audio Plug-in Framework
IPlugAUv3.h
Go to the documentation of this file.
1  /*
2  ==============================================================================
3 
4  This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5 
6  See LICENSE.txt for more info.
7 
8  ==============================================================================
9 */
10 
11 #ifndef _IPLUGAPI_
12 #define _IPLUGAPI_
13 // Only load one API class!
14 
20 #include <cstring>
21 
22 #include <CoreAudio/CoreAudioTypes.h>
23 
24 #include "wdlstring.h"
25 #include "assocarray.h"
26 
27 #include "IPlugAPIBase.h"
28 #include "IPlugProcessor.h"
29 
30 union AURenderEvent;
31 struct AUMIDIEvent;
32 
33 BEGIN_IPLUG_NAMESPACE
34 
36 struct InstanceInfo
37 {
38 };
39 
42 class IPlugAUv3 : public IPlugAPIBase
43  , public IPlugProcessor
44 {
45 public:
46  IPlugAUv3(const InstanceInfo& info, const Config& config);
47 
48  //IPlugAPIBase
49  void BeginInformHostOfParamChange(int idx) override;
50  void InformHostOfParamChange(int idx, double normalizedValue) override;
51  void EndInformHostOfParamChange(int idx) override;
52  void InformHostOfPresetChange() override {};
53 
54  //IPlugProcessor
55  bool SendMidiMsg(const IMidiMsg& msg) override;
56 // bool SendMidiMsgs(WDL_TypedBuf<IMidiMsg>& msgs) override;
57  bool SendSysEx(const ISysEx& msg) override;
58 
59  //IPlugAUv3
60  void ProcessWithEvents(AudioTimeStamp const* timestamp, uint32_t frameCount, AURenderEvent const* events, ITimeInfo& timeInfo);
61  void SetParameterFromValueObserver(uint64_t address, float value);
62  void SendParameterValueFromObserver(uint64_t address, float value);
63  float GetParameter(uint64_t address);
64  const char* GetParamDisplay(uint64_t address, float value);
65  float GetParamStringToValue(uint64_t address, const char* str);
66  void SetBuffers(AudioBufferList* pInBufferList, AudioBufferList* pOutBufferList, uint32_t outBusNumber);
67  void Prepare(double sampleRate, uint32_t blockSize);
68  void AddParamAddress(int paramIdx, uint64_t paramAddress) { mParamAddressMap.Insert(paramIdx, paramAddress); }
69  uint64_t GetParamAddress(int paramIdx) { return mParamAddressMap.Get(paramIdx); }
70  int GetParamIdx(uint64_t paramAddress) { return mParamAddressMap.ReverseLookup(paramAddress); }
71 
72  void SetAUAudioUnit(void* pAUAudioUnit);
73 
74  void SetOffline(bool renderingOffline) { IPlugProcessor::SetRenderingOffline(renderingOffline); }
75 
76 private:
77 // void HandleOneEvent(AURenderEvent const* event, int64_t startTime);
78 // void PerformAllSimultaneousEvents(int64_t now, AURenderEvent const*& event);
79  WDL_IntKeyedArray<uint64_t> mParamAddressMap;
80  void* mAUAudioUnit = nullptr;
81  AudioTimeStamp mLastTimeStamp;
82 };
83 
84 IPlugAUv3* MakePlug(const InstanceInfo& info);
85 
86 END_IPLUG_NAMESPACE
87 
88 #endif //_IPLUGAPI_
The base class for IPlug Audio Processing.
The base class of an IPlug plug-in, which interacts with the different plug-in APIs.
Definition: IPlugAPIBase.h:42
Encapsulates a MIDI message and provides helper functions.
Definition: IPlugMidi.h:30
AudioUnit v3 API base class for an IPlug plug-in.
Definition: IPlugAUv3.h:42
void InformHostOfPresetChange() override
Implemented by the API class, called by the UI (etc) when the plug-in initiates a program/preset chan...
Definition: IPlugAUv3.h:52
The base class for IPlug Audio Processing.
The base class of an IPlug plug-in, which interacts with the different plug-in APIs.
A struct for dealing with SysEx messages.
Definition: IPlugMidi.h:538
Encapsulates information about the host transport state.
Definition: IPlugStructs.h:581