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,
66 static_cast<LONG
>(rcWindow.left * ss),
67 static_cast<LONG
>((rcWindow.bottom - viewHeight - ptDiff.y) * ss),
68 static_cast<LONG
>((viewWidth + ptDiff.x) * ss),
69 static_cast<LONG
>((viewHeight + ptDiff.y) * ss), flags);
73 SetEditorSize(viewWidth, viewHeight);
90 std::vector<uint8_t> message;
91 message.push_back(msg.mStatus);
92 message.push_back(msg.mData1);
93 message.push_back(msg.mData2);
95 mAppHost->mMidiOut->sendMessage(&message);
108 std::vector<uint8_t> message;
110 for (
int i = 0; i < msg.mSize; i++)
112 message.push_back(msg.mData[i]);
115 mAppHost->mMidiOut->sendMessage(&message);
122void IPlugAPP::SendSysexMsgFromUI(
const ISysEx& msg)
127void IPlugAPP::AppProcess(
double** inputs,
double** outputs,
int nFrames)
130 SetChannelConnections(ERoute::kOutput, 0,
MaxNChannels(ERoute::kOutput),
true);
138 while (mMidiMsgsFromCallback.
Pop(msg))
141 mMidiMsgsFromProcessor.Push(msg);
149 while (mSysExMsgsFromCallback.
Pop(data))
151 ISysEx msg { data.mOffset, data.mData, data.mSize };
153 mSysExDataFromProcessor.Push(data);
157 if(mMidiMsgsFromEditor.ElementsAvailable())
161 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
virtual void ProcessSysEx(const ISysEx &msg)
Override this method to handle incoming MIDI System Exclusive (SysEx) messages.
int MaxNChannels(ERoute direction) const
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.