12 #include "IPlugAPP_host.h" 14 #if defined OS_MAC || defined OS_LINUX 15 #include <IPlugSWELL.h> 19 int GetTitleBarOffset()
21 int offset = GetSystemMetrics(SM_CYMENU);
23 if(SWELL_GetOSXVersion() >= 0x1100)
30 using namespace iplug;
34 IPlugAPP::IPlugAPP(
const InstanceInfo& info,
const Config& config)
40 Trace(TRACELOC,
"%s%s", config.pluginName, config.channelIOStr);
42 SetChannelConnections(ERoute::kInput, 0,
MaxNChannels(ERoute::kInput),
true);
43 SetChannelConnections(ERoute::kOutput, 0,
MaxNChannels(ERoute::kOutput),
true);
45 SetBlockSize(DEFAULT_BLOCK_SIZE);
52 bool parentResized =
false;
54 if (viewWidth != GetEditorWidth() || viewHeight != GetEditorHeight())
57 const int titleBarOffset = GetTitleBarOffset();
59 GetWindowRect(gHWND, &r);
60 SetWindowPos(gHWND, 0, r.left, r.bottom - viewHeight - titleBarOffset, viewWidth, viewHeight + titleBarOffset, 0);
63 SetEditorSize(viewWidth, viewHeight);
80 std::vector<uint8_t> message;
81 message.push_back(msg.mStatus);
82 message.push_back(msg.mData1);
83 message.push_back(msg.mData2);
85 mAppHost->mMidiOut->sendMessage(&message);
98 std::vector<uint8_t> message;
100 for (
int i = 0; i < msg.mSize; i++)
102 message.push_back(msg.mData[i]);
105 mAppHost->mMidiOut->sendMessage(&message);
112 void IPlugAPP::SendSysexMsgFromUI(
const ISysEx& msg)
117 void IPlugAPP::AppProcess(
double** inputs,
double** outputs,
int nFrames)
120 SetChannelConnections(ERoute::kOutput, 0,
MaxNChannels(ERoute::kOutput),
true);
124 if(mMidiMsgsFromCallback.ElementsAvailable())
128 while (mMidiMsgsFromCallback.Pop(msg))
131 mMidiMsgsFromProcessor.
Push(msg);
135 if(mSysExMsgsFromCallback.ElementsAvailable())
139 while (mSysExMsgsFromCallback.Pop(data))
141 ISysEx msg { data.mOffset, data.mData, data.mSize };
143 mSysExDataFromProcessor.
Push(data);
151 while (mMidiMsgsFromEditor.
Pop(msg))
int MaxNChannels(ERoute direction) const
The base class of an IPlug plug-in, which interacts with the different plug-in APIs.
Standalone application base class for an IPlug plug-in.
bool SendSysEx(const ISysEx &msg) override
Send a single MIDI System Exclusive (SysEx) message // TODO: info about what thread should this be ca...
Encapsulates a MIDI message and provides helper functions.
bool EditorResize(int viewWidth, int viewHeight) override
Implementations call into the APIs resize hooks returns a bool to indicate whether the DAW or plugin ...
bool IsInstrument() const
size_t ElementsAvailable() const
bool SendSysEx(const ISysEx &msg) override
Send a single MIDI System Exclusive (SysEx) message // TODO: info about what thread should this be ca...
void CreateTimer()
Called by the API class to create the timer that pumps the parameter/message queues.
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!...
virtual void ProcessSysEx(ISysEx &msg)
Override this method to handle incoming MIDI System Exclusive (SysEx) messages.
virtual void ProcessMidiMsg(const IMidiMsg &msg)
Override this method to handle incoming MIDI messages.
The base class for IPlug Audio Processing.
A struct for dealing with SysEx messages.
This structure is used when queueing Sysex messages.
A class that hosts an IPlug as a standalone app and provides Audio/Midi I/O.
int NChannelsConnected(ERoute direction) const