12#include "IPlugAPP_host.h"
14#if defined OS_MAC || defined OS_LINUX
15#include <IPlugSWELL.h>
17extern float GetScaleForHWND(HWND hWnd);
24IPlugAPP::IPlugAPP(
const InstanceInfo& info,
const Config& config)
30 Trace(TRACELOC,
"%s%s", config.pluginName, config.channelIOStr);
32 SetChannelConnections(ERoute::kInput, 0, MaxNChannels(ERoute::kInput),
true);
33 SetChannelConnections(ERoute::kOutput, 0, MaxNChannels(ERoute::kOutput),
true);
35 SetBlockSize(DEFAULT_BLOCK_SIZE);
42 bool parentResized =
false;
44 if (viewWidth != GetEditorWidth() || viewHeight != GetEditorHeight())
46 #if defined OS_MAC || defined NO_IGRAPHICS
47 RECT rcClient, rcWindow;
50 GetClientRect(gHWND, &rcClient);
51 GetWindowRect(gHWND, &rcWindow);
53 ptDiff.x = (rcWindow.right - rcWindow.left) - rcClient.right;
54 ptDiff.y = (rcWindow.bottom - rcWindow.top) - rcClient.bottom;
60 float ss = GetScaleForHWND(gHWND);
65 SetWindowPos(gHWND, 0, rcWindow.left * ss,
66 (rcWindow.bottom - viewHeight - ptDiff.y) * ss,
67 (viewWidth + ptDiff.x) * ss,
68 (viewHeight + ptDiff.y) * ss, flags);
72 SetEditorSize(viewWidth, viewHeight);
89 std::vector<uint8_t> message;
90 message.push_back(msg.mStatus);
91 message.push_back(msg.mData1);
92 message.push_back(msg.mData2);
94 mAppHost->mMidiOut->sendMessage(&message);
107 std::vector<uint8_t> message;
109 for (
int i = 0; i < msg.mSize; i++)
111 message.push_back(msg.mData[i]);
114 mAppHost->mMidiOut->sendMessage(&message);
121void IPlugAPP::SendSysexMsgFromUI(
const ISysEx& msg)
126void IPlugAPP::AppProcess(
double** inputs,
double** outputs,
int nFrames)
129 SetChannelConnections(ERoute::kOutput, 0,
MaxNChannels(ERoute::kOutput),
true);
137 while (mMidiMsgsFromCallback.
Pop(msg))
140 mMidiMsgsFromProcessor.Push(msg);
148 while (mSysExMsgsFromCallback.
Pop(data))
150 ISysEx msg { data.mOffset, data.mData, data.mSize };
152 mSysExDataFromProcessor.Push(data);
156 if(mMidiMsgsFromEditor.ElementsAvailable())
160 while (mMidiMsgsFromEditor.Pop(msg))
The base class of an IPlug plug-in, which interacts with the different plug-in APIs.
A class that hosts an IPlug as a standalone app and provides Audio/Midi I/O.
bool SendSysEx(const ISysEx &msg) override
Send a single MIDI System Exclusive (SysEx) message // TODO: info about what thread should this be ca...
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!
bool EditorResize(int viewWidth, int viewHeight) override
Implementations call into the APIs resize hooks returns a bool to indicate whether the DAW or plugin ...
The base class for IPlug Audio Processing.
virtual void ProcessMidiMsg(const IMidiMsg &msg)
Override this method to handle incoming MIDI messages.
bool IsInstrument() const
int NChannelsConnected(ERoute direction) const
int MaxNChannels(ERoute direction) const
virtual void ProcessSysEx(ISysEx &msg)
Override this method to handle incoming MIDI System Exclusive (SysEx) messages.
size_t ElementsAvailable() const
Encapsulates a MIDI message and provides helper functions.
A struct for dealing with SysEx messages.
This structure is used when queueing Sysex messages.