iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
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#include <unordered_map>
22
23#include <CoreAudio/CoreAudioTypes.h>
24
25#include "wdlstring.h"
26#include "assocarray.h"
27
28#include "IPlugAPIBase.h"
29#include "IPlugProcessor.h"
30
31union AURenderEvent;
32struct AUMIDIEvent;
33
34BEGIN_IPLUG_NAMESPACE
35
37struct InstanceInfo
38{
39};
40
43class IPlugAUv3 : public IPlugAPIBase
44 , public IPlugProcessor
45{
46public:
47 IPlugAUv3(const InstanceInfo& info, const Config& config);
48
49 //IPlugAPIBase
50 void BeginInformHostOfParamChange(int idx) override;
51 void InformHostOfParamChange(int idx, double normalizedValue) override;
52 void EndInformHostOfParamChange(int idx) override;
53 void InformHostOfPresetChange() override {};
54
55 //IPlugProcessor
56 bool SendMidiMsg(const IMidiMsg& msg) override;
57// bool SendMidiMsgs(WDL_TypedBuf<IMidiMsg>& msgs) override;
58 bool SendSysEx(const ISysEx& msg) override;
59
60 //IPlugAUv3
61 void ProcessWithEvents(AudioTimeStamp const* timestamp, uint32_t frameCount, AURenderEvent const* events, ITimeInfo& timeInfo);
62 void SetParameterFromValueObserver(uint64_t address, float value);
63 void SendParameterValueFromObserver(uint64_t address, float value);
64 float GetParameter(uint64_t address);
65 const char* GetParamDisplay(uint64_t address, float value);
66 float GetParamStringToValue(uint64_t address, const char* str);
67 void AttachInputBuffers(AudioBufferList* pInBufferList);
68 void AttachOutputBuffers(AudioBufferList* pOutBufferList, uint32_t busNumber);
69 void Prepare(double sampleRate, uint32_t blockSize);
70 void AddParamAddress(int paramIdx, uint64_t paramAddress)
71 {
72 mParamAddressMap.insert({paramIdx, paramAddress});
73 mAddressParamMap.insert({paramAddress, paramIdx});
74 }
75
76 uint64_t GetParamAddress(int paramIdx) { return mParamAddressMap[paramIdx]; }
77 int GetParamIdx(uint64_t paramAddress) { return mAddressParamMap[paramAddress]; }
78
79 void SetAUAudioUnit(void* pAUAudioUnit);
80
81 void SetOffline(bool renderingOffline) { IPlugProcessor::SetRenderingOffline(renderingOffline); }
82
83private:
84 // void HandleOneEvent(AURenderEvent const* event, int64_t startTime);
85 // void PerformAllSimultaneousEvents(int64_t now, AURenderEvent const*& event);
86 std::unordered_map<int, uint64_t> mParamAddressMap;
87 std::unordered_map<uint64_t, int> mAddressParamMap;
88 void* mAUAudioUnit = nullptr;
89 AudioTimeStamp mLastTimeStamp;
90};
91
92IPlugAUv3* MakePlug(const InstanceInfo& info);
93
94END_IPLUG_NAMESPACE
95
96#endif //_IPLUGAPI_
The base class of an IPlug plug-in, which interacts with the different plug-in APIs.
Definition: IPlugAPIBase.h:43
AudioUnit v3 API base class for an IPlug plug-in.
Definition: IPlugAUv3.h:45
void InformHostOfParamChange(int idx, double normalizedValue) override
Implemented by the API class, called by the UI via SetParameterValue() with the value of a parameter ...
Definition: IPlugAUv3.mm:41
bool SendSysEx(const ISysEx &msg) override
Send a single MIDI System Exclusive (SysEx) message // TODO: info about what thread should this be ca...
Definition: IPlugAUv3.mm:68
bool SendMidiMsg(const IMidiMsg &msg) override
Send a single MIDI message // TODO: info about what thread should this be called on or not called on!
Definition: IPlugAUv3.mm:54
void BeginInformHostOfParamChange(int idx) override
Implemented by the API class, called by the UI (or by a delegate) at the beginning of a parameter cha...
Definition: IPlugAUv3.mm:35
void EndInformHostOfParamChange(int idx) override
Implemented by the API class, called by the UI (or by a delegate) at the end of a parameter change ge...
Definition: IPlugAUv3.mm:48
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:53
The base class for IPlug Audio Processing.
Encapsulates information about the host transport state.
Definition: IPlugStructs.h:585
Encapsulates a MIDI message and provides helper functions.
Definition: IPlugMidi.h:31
A struct for dealing with SysEx messages.
Definition: IPlugMidi.h:539