Skip to content

Commit

Permalink
Update to Jan 2019 vst3sdk (surge-synthesizer#401)
Browse files Browse the repository at this point in the history
This substantial diff undertakes the mechanical changes to update
to the Jan 2019 master version of vst3sdk (hash 82380a8f). This
move consuming nearly 7 months of changes introduced several breaking
changes in our code which required modification, and introduced a couple of
new dependencies and links.

The primary thing breaking the builds was that most classes, including
common ones like CRect and CPoint, are now in the VSTGUI namespace.
This diff follows the convention of never using a namespace in a header
file, and thus has quite a few changes which are namespace additions in
headers and using statements in cpp files. But ironically, since my first
attempt was to just put using in a header and break the rule for once,
if you put using in the header, the code doesn't compile on windows
since VSTGUI::IDropTarget and ::IDropTarget collide. So has to be this way.

On linux several xcb and xkb dependencies emerge with this vst, so they
were added to the azure pipeline. Also the vstgui_linux.cpp is no longer
needed in the way we link, and if linked, doesn't work.

On windows, an ambiguity in std::numeric_limits<T>::max() requires us to
set -DNOMINMAX=1 for the time being, alas.

On mac, we expand the number of errors reported to 'as many as you generate'.

Commands used to update the module were

 git checkout master
 git checkout -b vst3sdk-update-373
 git submodule update --remote --merge --recursive
 git add vst3sdk/
 git commit
 git submodule update --init --recursive

This commit addresses github issue surge-synthesizer#373.
  • Loading branch information
baconpaul authored Jan 28, 2019
1 parent 1bf261c commit eb31ce4
Show file tree
Hide file tree
Showing 47 changed files with 464 additions and 411 deletions.
6 changes: 6 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ jobs:
popd
sudo apt-get install -y libgtkmm-3.0-dev
sudo apt-get install -y xcb
sudo apt-get install -y libxcb-util-dev
sudo apt-get install -y libxcb-cursor-dev
sudo apt-get install -y libxcb-keysyms1-dev
sudo apt-get install -y libxkbcommon-dev
sudo apt-get install -y libxkbcommon-x11-dev
./build-linux.sh --build
Expand Down
2 changes: 1 addition & 1 deletion build-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ run_build()
else
echo
echo ${RED}** Build of ${flavor} failed**${NC}
grep -i error build_logs/build_${flavor}.log
grep -i ": error" build_logs/build_${flavor}.log
echo
echo Complete information is in build_logs/build_${flavor}.log

Expand Down
6 changes: 4 additions & 2 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ if (os.istarget("macosx")) then
buildoptions
{
"-std=c++17", "-stdlib=libc++",
"-ferror-limit=0",
"-DOBJC_OLD_DISPATCH_PROTOTYPES=1",
"-Wno-deprecated-declarations", -- Alas the AU V2 uses a whole bunch of deprecated stuff
"-Wno-inconsistent-missing-override" -- Surge was written before this was even a keyword! We do need to fix this though
Expand Down Expand Up @@ -98,7 +99,8 @@ elseif (os.istarget("windows")) then
"VA_SUBTRACTIVE_EXPORTS",
"TIXML_USE_STL",
"USE_LIBPNG",
"_CRT_SECURE_NO_WARNINGS"
"_CRT_SECURE_NO_WARNINGS",
"NOMINMAX=1" -- Jan 2019 update to vst3sdk required this to disambiguoaute std::numeric_limits. See #373
}

nuget { "libpng-msvc-x64:1.6.33.8807" }
Expand Down Expand Up @@ -274,7 +276,7 @@ function plugincommon()
"src/linux/**.cpp",
"src/linux/**.h",
-- "libs/vst/*.mm", --
VSTGUI .. "vstgui_linux.cpp",
-- VSTGUI .. "vstgui_linux.cpp", -- with the Jan 19 pointer upgrade this is no longer needed nor works
-- VSTGUI .. "vstgui_uidescription_linux.cpp", --
}

Expand Down
2 changes: 1 addition & 1 deletion src/au/aulayer_cocoaui.mm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "aulayer_cocoaui.h"
#include <gui/SurgeGUIEditor.h>


using namespace VSTGUI;

@interface SurgeNSView : NSView
{
Expand Down
126 changes: 63 additions & 63 deletions src/common/SurgePatch.cpp

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/common/gui/CAboutBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "resource.h"
#include <stdio.h>

using namespace VSTGUI;

SharedPointer<CFontDesc> CAboutBox::infoFont;

//------------------------------------------------------------------------
Expand Down Expand Up @@ -117,7 +119,9 @@ void CAboutBox::unSplash()
{
if (getFrame()->getModalView() == this)
{
getFrame()->setModalView(NULL);
// the modal view is never set anywhere. Replace this with the new vstgui
// modal view session eventually
// getFrame()->setModalView(NULL);
}
}
}
38 changes: 19 additions & 19 deletions src/common/gui/CAboutBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,37 @@

#include "vstcontrols.h"

class CAboutBox : public CControl
class CAboutBox : public VSTGUI::CControl
{
public:
CAboutBox(const CRect& size,
IControlListener* listener,
CAboutBox(const VSTGUI::CRect& size,
VSTGUI::IControlListener* listener,
long tag,
CBitmap* background,
CRect& toDisplay,
CPoint& offset,
CBitmap* aboutBitmap);
VSTGUI::CBitmap* background,
VSTGUI::CRect& toDisplay,
VSTGUI::CPoint& offset,
VSTGUI::CBitmap* aboutBitmap);
virtual ~CAboutBox();

virtual void draw(CDrawContext*);
virtual bool hitTest(const CPoint& where, const CButtonState& buttons = -1);
// virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
virtual CMouseEventResult
onMouseDown(CPoint& where,
const CButtonState& buttons); ///< called when a mouse down event occurs
virtual void draw(VSTGUI::CDrawContext*);
virtual bool hitTest(const VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons = -1);
// virtual void mouse (VSTGUI::CDrawContext *pContext, VSTGUI::CPoint &where, long button = -1);
virtual VSTGUI::CMouseEventResult
onMouseDown(VSTGUI::CPoint& where,
const VSTGUI::CButtonState& buttons); ///< called when a mouse down event occurs
virtual void unSplash();

void boxShow();
void boxHide(bool invalidateframe = true);

CLASS_METHODS(CAboutBox, CControl)
CLASS_METHODS(CAboutBox, VSTGUI::CControl)

protected:
CRect toDisplay;
CRect keepSize;
CPoint offset;
SharedPointer<CBitmap> _aboutBitmap;
VSTGUI::CRect toDisplay;
VSTGUI::CRect keepSize;
VSTGUI::CPoint offset;
VSTGUI::SharedPointer<VSTGUI::CBitmap> _aboutBitmap;
bool bvalue;

static SharedPointer<CFontDesc> infoFont;
static VSTGUI::SharedPointer<VSTGUI::CFontDesc> infoFont;
};
2 changes: 2 additions & 0 deletions src/common/gui/CCursorHidingControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <Windows.h>
#endif

using namespace VSTGUI;

CCursorHidingControl::CCursorHidingControl(const CRect& size,
IControlListener* listener,
int32_t tag,
Expand Down
26 changes: 13 additions & 13 deletions src/common/gui/CCursorHidingControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@
#pragma once
#include "vstcontrols.h"

class CCursorHidingControl : public CControl
class CCursorHidingControl : public VSTGUI::CControl
{
protected:
CCursorHidingControl(const CRect& size,
IControlListener* listener,
CCursorHidingControl(const VSTGUI::CRect& size,
VSTGUI::IControlListener* listener,
int32_t tag,
CBitmap* pBackground);
VSTGUI::CBitmap* pBackground);
virtual ~CCursorHidingControl();

virtual CMouseEventResult onMouseDown(CPoint& where, const CButtonState& buttons);
virtual CMouseEventResult onMouseUp(CPoint& where, const CButtonState& buttons);
virtual CMouseEventResult onMouseMoved(CPoint& where, const CButtonState& buttons);
virtual VSTGUI::CMouseEventResult onMouseDown(VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons);
virtual VSTGUI::CMouseEventResult onMouseUp(VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons);
virtual VSTGUI::CMouseEventResult onMouseMoved(VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons);

virtual void
onMouseMoveDelta(CPoint& where, const CButtonState& buttons, double dx, double dy) = 0;
virtual double getMouseDeltaScaling(CPoint& where, const CButtonState& buttons);
onMouseMoveDelta(VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons, double dx, double dy) = 0;
virtual double getMouseDeltaScaling(VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons);

void detachCursor(CPoint& where);
void detachCursor(VSTGUI::CPoint& where);
void attachCursor();

private:
void doDetach(CPoint& where);
void doDetach(VSTGUI::CPoint& where);
void doAttach();

CPoint _lastPos, _detachPos;
VSTGUI::CPoint _lastPos, _detachPos;
bool _isDetatched = false;

// OS specific (screen-space)
double _sumDX = 0, _sumDY = 0;
double _hideX = 0, _hideY = 0;
};
};
2 changes: 2 additions & 0 deletions src/common/gui/CDIBitmap.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "CDIBitmap.h"
#include "DspUtilities.h"

using namespace VSTGUI;

/*HBITMAP CreateDIBSection(
HDC hdc, // handle to DC
CONST BITMAPINFO *pbmi, // bitmap data
Expand Down
14 changes: 7 additions & 7 deletions src/common/gui/CDIBitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ class CDIBitmap
CDIBitmap(long width, long height);
virtual ~CDIBitmap();

void draw(CDrawContext* pContext, CRect& rect, const CPoint& offset = CPoint(0, 0));
void draw(VSTGUI::CDrawContext* pContext, VSTGUI::CRect& rect, const VSTGUI::CPoint& offset = VSTGUI::CPoint(0, 0));

void clear(CColor color);
unsigned int ccol_to_int(CColor col);
CColor int_to_ccol(unsigned int col);
void clear(VSTGUI::CColor color);
unsigned int ccol_to_int(VSTGUI::CColor col);
VSTGUI::CColor int_to_ccol(unsigned int col);

void clear(unsigned int color);

void fillRect(CRect r, unsigned int color);
void fillRect(VSTGUI::CRect r, unsigned int color);
void setPixel(int x, int y, unsigned int color);

inline int getWidth()
Expand All @@ -51,6 +51,6 @@ class CDIBitmap

protected:
private:
SharedPointer<CBitmap> _bitmap;
SharedPointer<CBitmapPixelAccess> _bitmapAccess;
VSTGUI::SharedPointer<VSTGUI::CBitmap> _bitmap;
VSTGUI::SharedPointer<VSTGUI::CBitmapPixelAccess> _bitmapAccess;
};
22 changes: 11 additions & 11 deletions src/common/gui/CEffectLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
#pragma once
#include "vstcontrols.h"

extern CFontRef surge_minifont;
extern VSTGUI::CFontRef surge_minifont;

class CEffectLabel : public CControl
class CEffectLabel : public VSTGUI::CControl
{
public:
CEffectLabel(const CRect& size) : CControl(size, 0, 0, 0)
CEffectLabel(const VSTGUI::CRect& size) : VSTGUI::CControl(size, 0, 0, 0)
{}

virtual void draw(CDrawContext* dc)
virtual void draw(VSTGUI::CDrawContext* dc)
{
CRect size = getViewSize();
CRect bl(size);
VSTGUI::CRect size = getViewSize();
VSTGUI::CRect bl(size);
bl.top = bl.bottom - 2;
CColor gray = {106, 106, 106, 255};
VSTGUI::CColor gray = {106, 106, 106, 255};
dc->setFillColor(gray);
dc->drawRect(bl, kDrawFilled);
dc->drawRect(bl, VSTGUI::kDrawFilled);
dc->setFontColor(gray);
// dc->setFont(kNormalFontSmaller,8,kBoldFace);
dc->setFont(surge_minifont);
dc->drawString(label.c_str(), size, kLeftText, false);
dc->drawString(label.c_str(), size, VSTGUI::kLeftText, false);
setDirty(false);
}
void setLabel(string s)
Expand All @@ -34,5 +34,5 @@ class CEffectLabel : public CControl
private:
string label;

CLASS_METHODS(CEffectLabel, CControl)
};
CLASS_METHODS(CEffectLabel, VSTGUI::CControl)
};
2 changes: 2 additions & 0 deletions src/common/gui/CEffectSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "CEffectSettings.h"
#include "SurgeBitmaps.h"

using namespace VSTGUI;

const int blocks[8][2] = {{18, 1}, {44, 1}, {18, 41}, {44, 41},
{18, 21}, {44, 21}, {89, 11}, {89, 31}};

Expand Down
20 changes: 10 additions & 10 deletions src/common/gui/CEffectSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
#pragma once
#include "vstcontrols.h"

class CEffectSettings : public CControl
class CEffectSettings : public VSTGUI::CControl
{
public:
CEffectSettings(const CRect& size, IControlListener* listener, long tag, int current);
virtual void draw(CDrawContext* dc);
virtual CMouseEventResult
onMouseDown(CPoint& where,
const CButtonState& buttons); ///< called when a mouse down event occurs
virtual CMouseEventResult
onMouseUp(CPoint& where, const CButtonState& buttons); ///< called when a mouse up event occurs
CEffectSettings(const VSTGUI::CRect& size, VSTGUI::IControlListener* listener, long tag, int current);
virtual void draw(VSTGUI::CDrawContext* dc);
virtual VSTGUI::CMouseEventResult
onMouseDown(VSTGUI::CPoint& where,
const VSTGUI::CButtonState& buttons); ///< called when a mouse down event occurs
virtual VSTGUI::CMouseEventResult
onMouseUp(VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons); ///< called when a mouse up event occurs

int current;
CBitmap *bg, *labels;
VSTGUI::CBitmap *bg, *labels;
int type[8], bypass, disabled;

void set_type(int id, int t)
Expand Down Expand Up @@ -46,5 +46,5 @@ class CEffectSettings : public CControl
return current;
}

CLASS_METHODS(CEffectSettings, CControl)
CLASS_METHODS(CEffectSettings, VSTGUI::CControl)
};
4 changes: 3 additions & 1 deletion src/common/gui/CHSwitch2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "CHSwitch2.h"
#include <vt_dsp/basic_dsp.h>

using namespace VSTGUI;

void CHSwitch2::draw(CDrawContext* dc)
{
if (getBackground())
Expand Down Expand Up @@ -104,4 +106,4 @@ CMouseEventResult CHSwitch2::onMouseMoved(CPoint& where, const CButtonState& but
return kMouseEventHandled;
}
return kMouseEventNotHandled;
}
}
32 changes: 16 additions & 16 deletions src/common/gui/CHSwitch2.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#pragma once
#include "vstcontrols.h"

class CHSwitch2 : public CHorizontalSwitch
class CHSwitch2 : public VSTGUI::CHorizontalSwitch
{
public:
CHSwitch2(const CRect& size,
IControlListener* listener,
CHSwitch2(const VSTGUI::CRect& size,
VSTGUI::IControlListener* listener,
long tag,
long subPixmaps, // number of subPixmaps
long heightOfOneImage, // pixel
long rows,
long columns,
CBitmap* background,
CPoint& offset,
VSTGUI::CBitmap* background,
VSTGUI::CPoint& offset,
bool dragable = false)
: CHorizontalSwitch(
size, listener, tag, subPixmaps, heightOfOneImage, subPixmaps, background, offset)
Expand All @@ -30,14 +30,14 @@ class CHSwitch2 : public CHorizontalSwitch
int imgoffset;
bool dragable;

virtual void draw(CDrawContext* dc);
virtual CMouseEventResult
onMouseDown(CPoint& where,
const CButtonState& buttons); ///< called when a mouse down event occurs
virtual CMouseEventResult
onMouseUp(CPoint& where, const CButtonState& buttons); ///< called when a mouse up event occurs
virtual CMouseEventResult
onMouseMoved(CPoint& where,
const CButtonState& buttons); ///< called when a mouse move event occurs
CLASS_METHODS(CHSwitch2, CControl)
};
virtual void draw(VSTGUI::CDrawContext* dc);
virtual VSTGUI::CMouseEventResult
onMouseDown(VSTGUI::CPoint& where,
const VSTGUI::CButtonState& buttons); ///< called when a mouse down event occurs
virtual VSTGUI::CMouseEventResult
onMouseUp(VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons); ///< called when a mouse up event occurs
virtual VSTGUI::CMouseEventResult
onMouseMoved(VSTGUI::CPoint& where,
const VSTGUI::CButtonState& buttons); ///< called when a mouse move event occurs
CLASS_METHODS(CHSwitch2, VSTGUI::CControl)
};
2 changes: 2 additions & 0 deletions src/common/gui/CLFOGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "CLFOGui.h"
#include "LfoModulationSource.h"

using namespace VSTGUI;

extern CFontRef surge_minifont;
extern CFontRef surge_patchfont;

Expand Down
Loading

0 comments on commit eb31ce4

Please sign in to comment.