1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 00:19:27 +02:00

Round 8 of wx3 changes

VST control working on Windows...further changes will be required
This commit is contained in:
Leland Lucius 2015-07-16 14:30:04 -05:00
parent 805f0e29d1
commit ac4c4faadc
12 changed files with 160 additions and 51 deletions

View File

@ -876,7 +876,7 @@
2897F6F80AB3DB5A003C20C5 /* ToolsToolBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2897F6EC0AB3DB5A003C20C5 /* ToolsToolBar.cpp */; };
2897F6F90AB3DB5A003C20C5 /* TranscriptionToolBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2897F6EE0AB3DB5A003C20C5 /* TranscriptionToolBar.cpp */; };
2897F6FE0AB3DCD0003C20C5 /* Grabber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2897F6FC0AB3DCD0003C20C5 /* Grabber.cpp */; };
289D127A1B44D57F00B5B6AA /* VSTControlMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 289D12791B44D57F00B5B6AA /* VSTControlMac.mm */; };
289D127A1B44D57F00B5B6AA /* VSTControlOSX.mm in Sources */ = {isa = PBXBuildFile; fileRef = 289D12791B44D57F00B5B6AA /* VSTControlOSX.mm */; };
289E750A1006D0BD00CEF79B /* MixerBoard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 289E75081006D0BD00CEF79B /* MixerBoard.cpp */; };
289F9C7E0AC671BB00797DC1 /* DeviceToolBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 289F9C7C0AC671BB00797DC1 /* DeviceToolBar.cpp */; };
28A4E2AC0F60319300E9E7F2 /* fftext.c in Sources */ = {isa = PBXBuildFile; fileRef = 28A4E2A40F60319300E9E7F2 /* fftext.c */; };
@ -2607,8 +2607,8 @@
2897F6FC0AB3DCD0003C20C5 /* Grabber.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = Grabber.cpp; sourceTree = "<group>"; tabWidth = 3; };
2897F6FD0AB3DCD0003C20C5 /* Grabber.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = Grabber.h; sourceTree = "<group>"; tabWidth = 3; };
289D12771B44D57F00B5B6AA /* VSTControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VSTControl.h; path = VST/VSTControl.h; sourceTree = "<group>"; };
289D12781B44D57F00B5B6AA /* VSTControlMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VSTControlMac.h; path = VST/VSTControlMac.h; sourceTree = "<group>"; };
289D12791B44D57F00B5B6AA /* VSTControlMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = VSTControlMac.mm; path = VST/VSTControlMac.mm; sourceTree = "<group>"; };
289D12781B44D57F00B5B6AA /* VSTControlOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VSTControlOSX.h; path = VST/VSTControlOSX.h; sourceTree = "<group>"; };
289D12791B44D57F00B5B6AA /* VSTControlOSX.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = VSTControlOSX.mm; path = VST/VSTControlOSX.mm; sourceTree = "<group>"; };
289E75081006D0BD00CEF79B /* MixerBoard.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = MixerBoard.cpp; sourceTree = "<group>"; tabWidth = 3; };
289E75091006D0BD00CEF79B /* MixerBoard.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = MixerBoard.h; sourceTree = "<group>"; tabWidth = 3; };
289F9C7C0AC671BB00797DC1 /* DeviceToolBar.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceToolBar.cpp; sourceTree = "<group>"; tabWidth = 3; };
@ -5302,8 +5302,8 @@
isa = PBXGroup;
children = (
289D12771B44D57F00B5B6AA /* VSTControl.h */,
289D12781B44D57F00B5B6AA /* VSTControlMac.h */,
289D12791B44D57F00B5B6AA /* VSTControlMac.mm */,
289D12781B44D57F00B5B6AA /* VSTControlOSX.h */,
289D12791B44D57F00B5B6AA /* VSTControlOSX.mm */,
28B97B850FBF771A0076CF28 /* VSTEffect.cpp */,
28B97B860FBF771A0076CF28 /* VSTEffect.h */,
2885BFF10FC108F800128165 /* aeffectx.h */,
@ -7584,7 +7584,7 @@
2888496F131B6CF600B59735 /* tr.po in Sources */,
28884970131B6CF600B59735 /* uk.po in Sources */,
28884971131B6CF600B59735 /* vi.po in Sources */,
289D127A1B44D57F00B5B6AA /* VSTControlMac.mm in Sources */,
289D127A1B44D57F00B5B6AA /* VSTControlOSX.mm in Sources */,
28884972131B6CF600B59735 /* zh_TW.po in Sources */,
28884973131B6CF600B59735 /* zh.po in Sources */,
EDF3B7B01588C0D50032D35F /* Paulstretch.cpp in Sources */,

View File

@ -12,6 +12,7 @@
#define AUDACITY_VSTCONTROL_H
#include <wx/control.h>
#include <wx/panel.h>
#include "aeffectx.h"
@ -27,6 +28,8 @@ class VSTControlBase : public wxControl
public:
VSTControlBase()
{
mParent = NULL;
mLink = NULL;
}
virtual ~VSTControlBase()
@ -37,8 +40,8 @@ public:
{
mParent = parent;
mLink = link;
if (!wxControl::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxEmptyString))
if (!wxControl::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxDefaultValidator, wxEmptyString))
{
return false;
}
@ -51,8 +54,8 @@ protected:
VSTEffectLink *mLink;
};
#if defined(__WXMAC__)
#include "VSTControlMac.h"
#if defined(__WXOSX__)
#include "VSTControlOSX.h"
#elif defined(__WXMSW__)
#include "VSTControlMSW.h"
#elif defined(__WXGTK__)

View File

@ -0,0 +1,69 @@
/**********************************************************************
Audacity: A Digital Audio Editor
VSTControlMSW.mm
Leland Lucius
**********************************************************************/
#include <wx/dynlib.h>
#include <wx/sizer.h>
#include "VSTControl.h"
BEGIN_EVENT_TABLE(VSTControl, VSTControlBase)
EVT_SIZE(VSTControl::OnSize)
END_EVENT_TABLE()
VSTControl::VSTControl()
: VSTControlBase()
{
}
VSTControl::~VSTControl()
{
}
bool VSTControl::Create(wxWindow *parent, VSTEffectLink *link)
{
if (!VSTControlBase::Create(parent, link))
{
return false;
}
VstRect *rect;
// Some effects like to have us get their rect before opening them.
mLink->callDispatcher(effEditGetRect, 0, 0, &rect, 0.0);
// Get the native handle
mHwnd = GetHWND();
// Ask the effect to add its GUI
mLink->callDispatcher(effEditOpen, 0, 0, mHwnd, 0.0);
// Get the final bounds of the effect GUI
mLink->callDispatcher(effEditGetRect, 0, 0, &rect, 0.0);
// Add the effect host window to the layout
SetMinSize(wxSize(rect->right - rect->left, rect->bottom - rect->top));
// Must get the size again since SetPeer() could cause it to change
SetInitialSize(GetMinSize());
return true;
}
void VSTControl::OnSize(wxSizeEvent & evt)
{
evt.Skip();
wxSize sz = GetSize();
wxSize s1 = evt.GetSize();
evt.Skip();
return;
}

View File

@ -0,0 +1,39 @@
/**********************************************************************
Audacity: A Digital Audio Editor
VSTControlMSW.h
Leland Lucius
**********************************************************************/
#ifndef AUDACITY_VSTCONTROLMSW_H
#define AUDACITY_VSTCONTROLMSW_H
#include <Windows.h>
#include <wx/control.h>
#include "aeffectx.h"
class VSTControl : public VSTControlBase
{
public:
VSTControl();
~VSTControl();
bool Create(wxWindow *parent, VSTEffectLink *link);
void OnSize(wxSizeEvent & evt);
private:
HANDLE mHwnd;
wxSize mLastMin;
bool mSettingSize;
DECLARE_EVENT_TABLE();
};
#endif

View File

@ -2,7 +2,7 @@
Audacity: A Digital Audio Editor
VSTControlMac.mm
VSTControlOSX.mm
Leland Lucius
@ -74,14 +74,13 @@ VSTControlImpl::~VSTControlImpl()
{
}
BEGIN_EVENT_TABLE(VSTControl, wxControl)
BEGIN_EVENT_TABLE(VSTControl, VSTControlBase)
EVT_SIZE(VSTControl::OnSize)
END_EVENT_TABLE()
VSTControl::VSTControl()
: VSTControlBase()
{
mLink = NULL;
mVSTView = nil;
mView = nil;

View File

@ -41,6 +41,13 @@
#if defined(__WXMAC__)
#include <dlfcn.h>
#elif defined(__WXMSW__)
#include <wx/dynlib.h>
#include <wx/msw/seh.h>
#include <shlwapi.h>
#pragma comment(lib, "shlwapi")
#else
// Includes for GTK are later since they cause conflicts with our class names
#endif
#include <wx/app.h>
@ -2796,8 +2803,6 @@ void VSTEffect::BuildFancy()
// Turn the power on...some effects need this when the editor is open
PowerOn();
OSStatus result;
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
wxPanel *container = new wxPanel(mParent, wxID_ANY);
@ -2822,14 +2827,14 @@ void VSTEffect::BuildFancy()
return;
}
if (!mControl->Create(mParent, this))
if (!mControl->Create(container, this))
{
return;
}
wxBoxSizer *innerSizer = new wxBoxSizer(wxVERTICAL);
innerSizer->Add(mControl, 1, wxEXPAND);
innerSizer->Add(mControl, 0, wxALIGN_CENTER);
container->SetSizer(innerSizer);
mParent->SetMinSize(wxDefaultSize);
@ -3014,14 +3019,17 @@ void VSTEffect::RefreshParameters(int skip)
void VSTEffect::OnSizeWindow(wxCommandEvent & evt)
{
if (!mContainer)
if (!mControl)
{
return;
}
// This really needs some work. We shouldn't know anything about the parent...
mContainer->SetMinSize(evt.GetInt(), (int) evt.GetExtraLong());
mParent->SetMinSize(mContainer->GetMinSize());
mControl->SetMinSize(wxSize(evt.GetInt(), (int) evt.GetExtraLong()));
mControl->SetSize(wxSize(evt.GetInt(), (int) evt.GetExtraLong()));
mParent->SetMinSize(wxDefaultSize);
mDialog->SetMinSize(wxDefaultSize);
// mParent->SetMinSize(mControl->GetMinSize());
mDialog->Layout();
mDialog->Fit();
}

View File

@ -315,36 +315,8 @@ private:
wxString mChunk;
long mXMLVersion;
VstPatchChunkInfo mXMLInfo;
#if defined(__WXMAC__)
static pascal OSStatus OverlayEventHandler(EventHandlerCallRef handler, EventRef event, void *data);
OSStatus OnOverlayEvent(EventHandlerCallRef handler, EventRef event);
static pascal OSStatus WindowEventHandler(EventHandlerCallRef handler, EventRef event, void *data);
OSStatus OnWindowEvent(EventHandlerCallRef handler, EventRef event);
static pascal OSStatus TrackingEventHandler(EventHandlerCallRef handler, EventRef event, void *data);
OSStatus OnTrackingEvent(EventRef event);
WindowRef mOverlayRef;
EventHandlerUPP mOverlayEventHandlerUPP;
EventHandlerRef mOverlayEventHandlerRef;
WindowRef mWindowRef;
WindowRef mPreviousRef;
EventHandlerUPP mWindowEventHandlerUPP;
EventHandlerRef mWindowEventHandlerRef;
EventHandlerUPP mTrackingHandlerUPP;
EventHandlerRef mRootTrackingHandlerRef;
EventHandlerRef mViewTrackingHandlerRef;
EventHandlerRef mSubviewTrackingHandlerRef;
EventHandlerRef mOverlayRootTrackingHandlerRef;
EventHandlerRef mOverlayViewTrackingHandlerRef;
#elif defined(__WXMSW__)
HANDLE mHwnd;
#else
#if defined(__WXGTK__)
Display *mXdisp;
Window mXwin;

View File

@ -377,4 +377,15 @@ enum VstPlugCategory
kPlugCategMaxCount // 12=Marker to count the categories
};
class VstRect
{
public:
short top;
short left;
short bottom;
short right;
} ;
#endif

View File

@ -144,6 +144,7 @@
<ClCompile Include="..\..\..\src\effects\EffectRack.cpp" />
<ClCompile Include="..\..\..\src\effects\NoiseReduction.cpp" />
<ClCompile Include="..\..\..\src\effects\Phaser.cpp" />
<ClCompile Include="..\..\..\src\effects\VST\VSTControlMSW.cpp" />
<ClCompile Include="..\..\..\src\Envelope.cpp" />
<ClCompile Include="..\..\..\src\FFmpeg.cpp" />
<ClCompile Include="..\..\..\src\FFT.cpp" />
@ -414,6 +415,7 @@
<ClInclude Include="..\..\..\src\effects\EffectRack.h" />
<ClInclude Include="..\..\..\src\effects\NoiseReduction.h" />
<ClInclude Include="..\..\..\src\effects\Phaser.h" />
<ClInclude Include="..\..\..\src\effects\VST\VSTControlMSW.h" />
<ClInclude Include="..\..\..\src\import\FormatClassifier.h" />
<ClInclude Include="..\..\..\src\import\ImportGStreamer.h" />
<ClInclude Include="..\..\..\src\import\MultiFormatReader.h" />

View File

@ -837,6 +837,9 @@
<ClCompile Include="..\..\..\src\ViewInfo.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\effects\VST\VSTControlMSW.cpp">
<Filter>src/effects/VST</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\AboutDialog.h">
@ -1673,6 +1676,9 @@
<ClInclude Include="..\..\..\src\AudacityHeaders.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\effects\VST\VSTControlMSW.h">
<Filter>src/effects/VST</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\audacity.ico">

View File

@ -28,7 +28,7 @@
#define USE_SBSMS 1
#define USE_SOUNDTOUCH 1
#define USE_VAMP 1
#define USE_VST 0
#define USE_VST 1
#define USE_MIDI 1 // define this to use portSMF and PortMidi for midi file support
#define INSTALL_PREFIX "."