Browse Source

Refactored VST plugin win32 hooks, and added mouse-wheel hooking to VST3. Also added a VC2010 project to the audio demo plugin.

tags/2021-05-28
jules 11 years ago
parent
commit
8d834b29a1
10 changed files with 4639 additions and 50 deletions
  1. +4
    -2
      extras/audio plugin demo/Builds/MacOSX/JuceDemoPlugin.xcodeproj/project.pbxproj
  2. +1
    -0
      extras/audio plugin demo/Builds/VisualStudio2005/JuceDemoPlugin.vcproj
  3. +1
    -0
      extras/audio plugin demo/Builds/VisualStudio2008/JuceDemoPlugin.vcproj
  4. +1657
    -0
      extras/audio plugin demo/Builds/VisualStudio2010/JuceDemoPlugin.vcxproj
  5. +2810
    -0
      extras/audio plugin demo/Builds/VisualStudio2010/JuceDemoPlugin.vcxproj.filters
  6. +30
    -0
      extras/audio plugin demo/Builds/VisualStudio2010/resources.rc
  7. +25
    -1
      extras/audio plugin demo/JuceDemoPlugin.jucer
  8. +5
    -47
      modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  9. +5
    -0
      modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
  10. +101
    -0
      modules/juce_audio_plugin_client/utility/juce_WindowsHooks.h

+ 4
- 2
extras/audio plugin demo/Builds/MacOSX/JuceDemoPlugin.xcodeproj/project.pbxproj View File

@@ -511,6 +511,7 @@
7D5CFA5B4C64986B875C71DC = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_XmlDocument.cpp"; path = "../../../../modules/juce_core/xml/juce_XmlDocument.cpp"; sourceTree = "SOURCE_ROOT"; };
7DC4334C7DA62856B8E70B25 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_AudioFormatWriter.cpp"; path = "../../../../modules/juce_audio_formats/format/juce_AudioFormatWriter.cpp"; sourceTree = "SOURCE_ROOT"; };
7E1239926CC4A760AE07FF37 = {isa = PBXFileReference; lastKnownFileType = file; name = "juce_module_info"; path = "../../../../modules/juce_data_structures/juce_module_info"; sourceTree = "SOURCE_ROOT"; };
7E588E8934AFA6EA5C58C133 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_WindowsHooks.h"; path = "../../../../modules/juce_audio_plugin_client/utility/juce_WindowsHooks.h"; sourceTree = "SOURCE_ROOT"; };
7EC813E6F2E7303438F82090 = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
7F38C9D398788039FD8CAF23 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_DirectWriteTypeface.cpp"; path = "../../../../modules/juce_graphics/native/juce_win32_DirectWriteTypeface.cpp"; sourceTree = "SOURCE_ROOT"; };
7F4472B4691BF3FED1C2025C = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_PopupMenu.h"; path = "../../../../modules/juce_gui_basics/menus/juce_PopupMenu.h"; sourceTree = "SOURCE_ROOT"; };
@@ -668,7 +669,6 @@
ABC394D5E03B690404E80E1E = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_MessageManager.mm"; path = "../../../../modules/juce_events/native/juce_mac_MessageManager.mm"; sourceTree = "SOURCE_ROOT"; };
ABCB715245090A15092108D5 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioDeviceManager.h"; path = "../../../../modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.h"; sourceTree = "SOURCE_ROOT"; };
ABE98156B2F8FBDAE1B7CF88 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_QuickTimeAudioFormat.cpp"; path = "../../../../modules/juce_audio_formats/codecs/juce_QuickTimeAudioFormat.cpp"; sourceTree = "SOURCE_ROOT"; };
AC5452F5122E3A4B670B5185 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioThumbnail.h"; path = "../../../../modules/juce_audio_utils/gui/juce_AudioThumbnail.h"; sourceTree = "SOURCE_ROOT"; };
ACAD736DA78EA0A66BF1CE29 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_TopLevelWindow.cpp"; path = "../../../../modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp"; sourceTree = "SOURCE_ROOT"; };
ACB591F236B9E8054BF9ECB9 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DialogWindow.cpp"; path = "../../../../modules/juce_gui_basics/windows/juce_DialogWindow.cpp"; sourceTree = "SOURCE_ROOT"; };
AD33682668F35136E9195684 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_MidiMessage.h"; path = "../../../../modules/juce_audio_basics/midi/juce_MidiMessage.h"; sourceTree = "SOURCE_ROOT"; };
@@ -690,6 +690,7 @@
AAEC41BFA57E45EBF94ED3C1 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DrawableImage.cpp"; path = "../../../../modules/juce_gui_basics/drawables/juce_DrawableImage.cpp"; sourceTree = "SOURCE_ROOT"; };
AB10327C69AAE4AACCFC81EB = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DrawableText.cpp"; path = "../../../../modules/juce_gui_basics/drawables/juce_DrawableText.cpp"; sourceTree = "SOURCE_ROOT"; };
AB9AD07EF899B75AC4CF01DA = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CAMutex.h; path = Extras/CoreAudio/PublicUtility/CAMutex.h; sourceTree = "DEVELOPER_DIR"; };
AC5452F5122E3A4B670B5185 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioThumbnail.h"; path = "../../../../modules/juce_audio_utils/gui/juce_AudioThumbnail.h"; sourceTree = "SOURCE_ROOT"; };
ACC4E765AD4BF1D025FB4E83 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_Network.cpp"; path = "../../../../modules/juce_core/native/juce_linux_Network.cpp"; sourceTree = "SOURCE_ROOT"; };
ACD46CD092A8EC640448BD70 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_BufferingAudioSource.cpp"; path = "../../../../modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp"; sourceTree = "SOURCE_ROOT"; };
ACDF0E99B316A7C266F6EFFD = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_LAMEEncoderAudioFormat.cpp"; path = "../../../../modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp"; sourceTree = "SOURCE_ROOT"; };
@@ -1145,7 +1146,8 @@
2FADC0AA0043A3C87DF25E0D,
3C6E8B705C53294638807FC4,
841B6783475386C5471CA039,
8C0D1A1E000E47D09B771963, ); name = utility; sourceTree = "<group>"; };
8C0D1A1E000E47D09B771963,
7E588E8934AFA6EA5C58C133, ); name = utility; sourceTree = "<group>"; };
09C66663E0BF7CD43C73C7E6 = {isa = PBXGroup; children = (
E96D0837CDD1CE8B768E4077,
4E83A3689ABB09F285F6FB2C,


+ 1
- 0
extras/audio plugin demo/Builds/VisualStudio2005/JuceDemoPlugin.vcproj View File

@@ -872,6 +872,7 @@
<File RelativePath="..\..\..\..\modules\juce_audio_plugin_client\utility\juce_IncludeModuleHeaders.h"/>
<File RelativePath="..\..\..\..\modules\juce_audio_plugin_client\utility\juce_IncludeSystemHeaders.h"/>
<File RelativePath="..\..\..\..\modules\juce_audio_plugin_client\utility\juce_PluginHostType.h"/>
<File RelativePath="..\..\..\..\modules\juce_audio_plugin_client\utility\juce_WindowsHooks.h"/>
</Filter>
<File RelativePath="..\..\..\..\modules\juce_audio_plugin_client\juce_module_info">
<FileConfiguration Name="Debug|Win32"


+ 1
- 0
extras/audio plugin demo/Builds/VisualStudio2008/JuceDemoPlugin.vcproj View File

@@ -872,6 +872,7 @@
<File RelativePath="..\..\..\..\modules\juce_audio_plugin_client\utility\juce_IncludeModuleHeaders.h"/>
<File RelativePath="..\..\..\..\modules\juce_audio_plugin_client\utility\juce_IncludeSystemHeaders.h"/>
<File RelativePath="..\..\..\..\modules\juce_audio_plugin_client\utility\juce_PluginHostType.h"/>
<File RelativePath="..\..\..\..\modules\juce_audio_plugin_client\utility\juce_WindowsHooks.h"/>
</Filter>
<File RelativePath="..\..\..\..\modules\juce_audio_plugin_client\juce_module_info">
<FileConfiguration Name="Debug|Win32"


+ 1657
- 0
extras/audio plugin demo/Builds/VisualStudio2010/JuceDemoPlugin.vcxproj
File diff suppressed because it is too large
View File


+ 2810
- 0
extras/audio plugin demo/Builds/VisualStudio2010/JuceDemoPlugin.vcxproj.filters
File diff suppressed because it is too large
View File


+ 30
- 0
extras/audio plugin demo/Builds/VisualStudio2010/resources.rc View File

@@ -0,0 +1,30 @@
#ifdef JUCE_USER_DEFINED_RC_FILE
#include JUCE_USER_DEFINED_RC_FILE
#else
#undef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Raw Material Software Ltd.\0"
VALUE "FileDescription", "JuceDemoPlugin\0"
VALUE "FileVersion", "1.0.0\0"
VALUE "ProductName", "JuceDemoPlugin\0"
VALUE "ProductVersion", "1.0.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 65001
END
END
#endif

+ 25
- 1
extras/audio plugin demo/JuceDemoPlugin.jucer View File

@@ -61,7 +61,8 @@
</MODULEPATHS>
</VS2005>
<VS2008 targetFolder="Builds/VisualStudio2008" vstFolder="c:\SDKs\vstsdk2.4"
rtasFolder="c:\SDKs\PT_80_SDK" libraryType="1" aaxFolder="c:\SDKs\AAX">
rtasFolder="c:\SDKs\PT_80_SDK" libraryType="1" aaxFolder="c:\SDKs\AAX"
vst3Folder="c:\SDKs\VST3 SDK">
<CONFIGURATIONS>
<CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="JuceDemoPlugin"
winWarningLevel="4" generateManifest="1"/>
@@ -83,6 +84,29 @@
<MODULEPATH id="juce_audio_basics" path="../../modules"/>
</MODULEPATHS>
</VS2008>
<VS2010 targetFolder="Builds/VisualStudio2010" vstFolder="c:\SDKs\vstsdk2.4"
vst3Folder="c:\SDKs\VST3 SDK">
<CONFIGURATIONS>
<CONFIGURATION name="Debug" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
isDebug="1" optimisation="1" targetName="JuceDemoPlugin"/>
<CONFIGURATION name="Release" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
isDebug="0" optimisation="2" targetName="JuceDemoPlugin"/>
</CONFIGURATIONS>
<MODULEPATHS>
<MODULEPATH id="juce_gui_extra" path="../../modules"/>
<MODULEPATH id="juce_gui_basics" path="../../modules"/>
<MODULEPATH id="juce_graphics" path="../../modules"/>
<MODULEPATH id="juce_events" path="../../modules"/>
<MODULEPATH id="juce_data_structures" path="../../modules"/>
<MODULEPATH id="juce_core" path="../../modules"/>
<MODULEPATH id="juce_audio_utils" path="../../modules"/>
<MODULEPATH id="juce_audio_processors" path="../../modules"/>
<MODULEPATH id="juce_audio_plugin_client" path="../../modules"/>
<MODULEPATH id="juce_audio_formats" path="../../modules"/>
<MODULEPATH id="juce_audio_devices" path="../../modules"/>
<MODULEPATH id="juce_audio_basics" path="../../modules"/>
</MODULEPATHS>
</VS2010>
<LINUX_MAKE targetFolder="Builds/Linux" vstFolder="~/SDKs/vstsdk2.4" rtasFolder="~/SDKs/PT_80_SDK">
<CONFIGURATIONS>
<CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="JuceDemoPlugin"


+ 5
- 47
modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp View File

@@ -96,6 +96,7 @@
#include "../utility/juce_IncludeModuleHeaders.h"
#include "../utility/juce_FakeMouseMoveGenerator.h"
#include "../utility/juce_WindowsHooks.h"
#ifdef _MSC_VER
#pragma pack (pop)
@@ -168,48 +169,7 @@ namespace
return w;
}
//==============================================================================
static HHOOK mouseWheelHook = 0;
static int mouseHookUsers = 0;
LRESULT CALLBACK mouseWheelHookCallback (int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode >= 0 && wParam == WM_MOUSEWHEEL)
{
// using a local copy of this struct to support old mingw libraries
struct MOUSEHOOKSTRUCTEX_ : public MOUSEHOOKSTRUCT { DWORD mouseData; };
const MOUSEHOOKSTRUCTEX_& hs = *(MOUSEHOOKSTRUCTEX_*) lParam;
if (Component* const comp = Desktop::getInstance().findComponentAt (Point<int> (hs.pt.x, hs.pt.y)))
if (comp->getWindowHandle() != 0)
return PostMessage ((HWND) comp->getWindowHandle(), WM_MOUSEWHEEL,
hs.mouseData & 0xffff0000, (hs.pt.x & 0xffff) | (hs.pt.y << 16));
}
return CallNextHookEx (mouseWheelHook, nCode, wParam, lParam);
}
void registerMouseWheelHook()
{
if (mouseHookUsers++ == 0)
mouseWheelHook = SetWindowsHookEx (WH_MOUSE, mouseWheelHookCallback,
(HINSTANCE) Process::getCurrentModuleInstanceHandle(),
GetCurrentThreadId());
}
void unregisterMouseWheelHook()
{
if (--mouseHookUsers == 0 && mouseWheelHook != 0)
{
UnhookWindowsHookEx (mouseWheelHook);
mouseWheelHook = 0;
}
}
#if JUCE_WINDOWS
static bool messageThreadIsDefinitelyCorrect = false;
#endif
}
//==============================================================================
@@ -1301,17 +1261,11 @@ public:
#if JUCE_WINDOWS
if (! getHostType().isReceptor())
addMouseListener (this, true);
registerMouseWheelHook();
#endif
}
~EditorCompWrapper()
{
#if JUCE_WINDOWS
unregisterMouseWheelHook();
#endif
deleteAllChildren(); // note that we can't use a ScopedPointer because the editor may
// have been transferred to another parent which takes over ownership.
}
@@ -1402,6 +1356,10 @@ public:
JuceVSTWrapper& wrapper;
FakeMouseMoveGenerator fakeMouseGenerator;
#if JUCE_WINDOWS
WindowsHooks hooks;
#endif
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (EditorCompWrapper)
};


+ 5
- 0
modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp View File

@@ -32,6 +32,7 @@
#include "../../juce_audio_processors/format_types/juce_VST3Headers.h"
#include "../utility/juce_CheckSettingMacros.h"
#include "../utility/juce_IncludeModuleHeaders.h"
#include "../utility/juce_WindowsHooks.h"
#include "../../juce_audio_processors/format_types/juce_VST3Common.h"
#ifndef JUCE_VST3_CAN_REPLACE_VST2
@@ -542,6 +543,10 @@ private:
bool isNSView;
#endif
#if JUCE_WINDOWS
WindowsHooks hooks;
#endif
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceVST3Editor)
};


+ 101
- 0
modules/juce_audio_plugin_client/utility/juce_WindowsHooks.h View File

@@ -0,0 +1,101 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2013 - Raw Material Software Ltd.
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Details of these licenses can be found at: www.gnu.org/licenses
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
==============================================================================
*/
#if JUCE_WINDOWS
namespace
{
static HHOOK mouseWheelHook = 0;
static int numHookUsers = 0;
struct WindowsHooks
{
WindowsHooks()
{
if (numHookUsers++ == 0)
{
mouseWheelHook = SetWindowsHookEx (WH_MOUSE, mouseWheelHookCallback,
(HINSTANCE) Process::getCurrentModuleInstanceHandle(),
GetCurrentThreadId());
#if 0 // XXX temporary for testing
keyboardHook = SetWindowsHookEx (WH_KEYBOARD, keyboardHookCallback,
(HINSTANCE) Process::getCurrentModuleInstanceHandle(),
GetCurrentThreadId());
#endif
}
}
~WindowsHooks()
{
if (--numHookUsers == 0)
{
if (mouseWheelHook != 0)
{
UnhookWindowsHookEx (mouseWheelHook);
mouseWheelHook = 0;
}
#if 0 // XXX temporary for testing
if (keyboardHook != 0)
{
UnhookWindowsHookEx (keyboardHook);
keyboardHook = 0;
}
#endif
}
}
static LRESULT CALLBACK mouseWheelHookCallback (int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode >= 0 && wParam == WM_MOUSEWHEEL)
{
// using a local copy of this struct to support old mingw libraries
struct MOUSEHOOKSTRUCTEX_ : public MOUSEHOOKSTRUCT { DWORD mouseData; };
const MOUSEHOOKSTRUCTEX_& hs = *(MOUSEHOOKSTRUCTEX_*) lParam;
if (Component* const comp = Desktop::getInstance().findComponentAt (Point<int> (hs.pt.x, hs.pt.y)))
if (comp->getWindowHandle() != 0)
return PostMessage ((HWND) comp->getWindowHandle(), WM_MOUSEWHEEL,
hs.mouseData & 0xffff0000, (hs.pt.x & 0xffff) | (hs.pt.y << 16));
}
return CallNextHookEx (mouseWheelHook, nCode, wParam, lParam);
}
#if 0 // XXX temporary for testing
static LRESULT CALLBACK keyboardHookCallback (int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode >= 0 && nCode == HC_ACTION)
if (passKeyUpDownToPeer (GetFocus(), wParam, (lParam & (1 << 31)) == 0))
return 1;
return CallNextHookEx (keyboardHook, nCode, wParam, lParam);
}
#endif
};
}
#endif

Loading…
Cancel
Save