Browse Source

Minor tweaks to help support mingw, and to avoid namespace issues with assertions.

tags/2021-05-28
jules 13 years ago
parent
commit
83b35eba25
13 changed files with 67 additions and 52 deletions
  1. +1
    -1
      modules/juce_audio_formats/format/juce_AudioFormatManager.cpp
  2. +3
    -1
      modules/juce_audio_formats/juce_audio_formats.cpp
  3. +12
    -0
      modules/juce_audio_formats/juce_audio_formats.h
  4. +11
    -14
      modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h
  5. +1
    -1
      modules/juce_core/juce_core.cpp
  6. +1
    -1
      modules/juce_core/logging/juce_Logger.cpp
  7. +3
    -1
      modules/juce_core/native/juce_BasicNativeHeaders.h
  8. +7
    -3
      modules/juce_core/native/juce_win32_Files.cpp
  9. +1
    -1
      modules/juce_core/system/juce_PlatformDefs.h
  10. +1
    -1
      modules/juce_core/system/juce_StandardHeader.h
  11. +19
    -16
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp
  12. +3
    -3
      modules/juce_gui_extra/native/juce_win32_ActiveXComponent.cpp
  13. +4
    -9
      modules/juce_gui_extra/native/juce_win32_SystemTrayIcon.cpp

+ 1
- 1
modules/juce_audio_formats/format/juce_AudioFormatManager.cpp View File

@@ -71,7 +71,7 @@ void AudioFormatManager::registerBasicFormats()
#if JUCE_MAC || JUCE_IOS
registerFormat (new CoreAudioFormat(), false);
#elif JUCE_WINDOWS
#elif JUCE_USE_WINDOWS_MEDIA_FORMAT
registerFormat (new WindowsMediaAudioFormat(), false);
#elif JUCE_USE_MP3AUDIOFORMAT
// The software MP3 decoder is only used as a default format if


+ 3
- 1
modules/juce_audio_formats/juce_audio_formats.cpp View File

@@ -80,7 +80,9 @@
#endif
#endif
#include <wmsdk.h>
#if JUCE_USE_WINDOWS_MEDIA_FORMAT
#include <wmsdk.h>
#endif
#endif
//==============================================================================


+ 12
- 0
modules/juce_audio_formats/juce_audio_formats.h View File

@@ -63,6 +63,18 @@
#define JUCE_USE_MP3AUDIOFORMAT 0
#endif
/** Config: JUCE_USE_WINDOWS_MEDIA_FORMAT
Enables the Windows Media SDK codecs.
*/
#ifndef JUCE_USE_WINDOWS_MEDIA_FORMAT
#define JUCE_USE_WINDOWS_MEDIA_FORMAT 1
#endif
#if ! JUCE_MSVC
#undef JUCE_USE_WINDOWS_MEDIA_FORMAT
#define JUCE_USE_WINDOWS_MEDIA_FORMAT 0
#endif
//=============================================================================
namespace juce
{


+ 11
- 14
modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h View File

@@ -85,8 +85,7 @@ public:
NamedValueSet properties;
//==============================================================================
/** A convenient typedef for referring to a pointer to a node object.
*/
/** A convenient typedef for referring to a pointer to a node object. */
typedef ReferenceCountedObjectPtr <Node> Ptr;
private:
@@ -96,9 +95,9 @@ public:
const ScopedPointer<AudioProcessor> processor;
bool isPrepared;
Node (uint32 nodeId, AudioProcessor* processor) noexcept;
Node (uint32 nodeId, AudioProcessor*) noexcept;
void prepare (double sampleRate, int blockSize, AudioProcessorGraph* graph);
void prepare (double sampleRate, int blockSize, AudioProcessorGraph*);
void unprepare();
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Node);
@@ -161,15 +160,13 @@ public:
int getNumNodes() const { return nodes.size(); }
/** Returns a pointer to one of the nodes in the graph.
This will return 0 if the index is out of range.
This will return nullptr if the index is out of range.
@see getNodeForId
*/
Node* getNode (const int index) const { return nodes [index]; }
/** Searches the graph for a node with the given ID number and returns it.
If no such node was found, this returns 0.
If no such node was found, this returns nullptr.
@see getNode
*/
Node* getNodeForId (const uint32 nodeId) const;
@@ -202,7 +199,7 @@ public:
/** Searches for a connection between some specified channels.
If no such connection is found, this returns 0.
If no such connection is found, this returns nullptr.
*/
const Connection* getConnectionBetween (uint32 sourceNodeId,
int sourceChannelIndex,
@@ -307,7 +304,7 @@ public:
/** Returns the mode of this processor. */
IODeviceType getType() const { return type; }
/** Returns the parent graph to which this processor belongs, or 0 if it
/** Returns the parent graph to which this processor belongs, or nullptr if it
hasn't yet been added to one. */
AudioProcessorGraph* getParentGraph() const { return graph; }
@@ -321,11 +318,11 @@ public:
~AudioGraphIOProcessor();
const String getName() const;
void fillInPluginDescription (PluginDescription& d) const;
void fillInPluginDescription (PluginDescription&) const;
void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
void releaseResources();
void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
void processBlock (AudioSampleBuffer&, MidiBuffer&);
const String getInputChannelName (int channelIndex) const;
const String getOutputChannelName (int channelIndex) const;
@@ -353,7 +350,7 @@ public:
void setStateInformation (const void* data, int sizeInBytes);
/** @internal */
void setParentGraph (AudioProcessorGraph* graph);
void setParentGraph (AudioProcessorGraph*);
private:
const IODeviceType type;
@@ -369,7 +366,7 @@ public:
void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock);
void releaseResources();
void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
void processBlock (AudioSampleBuffer&, MidiBuffer&);
const String getInputChannelName (int channelIndex) const;
const String getOutputChannelName (int channelIndex) const;


+ 1
- 1
modules/juce_core/juce_core.cpp View File

@@ -54,7 +54,7 @@
#include <ws2tcpip.h>
#if JUCE_MINGW
#include <wspiapi.h>
#include <ws2spi.h>
#endif
#else


+ 1
- 1
modules/juce_core/logging/juce_Logger.cpp View File

@@ -54,7 +54,7 @@ void Logger::writeToLog (const String& message)
}
#if JUCE_LOG_ASSERTIONS
void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) noexcept
void JUCE_API logAssertion (const char* filename, const int lineNum) noexcept
{
String m ("JUCE Assertion failure in ");
m << filename << ", line " << lineNum;


+ 3
- 1
modules/juce_core/native/juce_BasicNativeHeaders.h View File

@@ -102,7 +102,9 @@
#include <shlwapi.h>
#include <mmsystem.h>
#if ! JUCE_MINGW
#if JUCE_MINGW
#include <basetyps.h>
#else
#include <crtdbg.h>
#include <comutil.h>
#endif


+ 7
- 3
modules/juce_core/native/juce_win32_Files.cpp View File

@@ -704,16 +704,20 @@ bool Process::openDocument (const String& fileName, const String& parameters)
void File::revealToUser() const
{
#pragma warning (push)
#pragma warning (disable: 4090) // (alignment warning)
#if JUCE_MINGW
jassertfalse; // not supported in MinGW..
#else
#pragma warning (push)
#pragma warning (disable: 4090) // (alignment warning)
ITEMIDLIST* const itemIDList = ILCreateFromPath (fullPath.toWideCharPointer());
#pragma warning (pop)
#pragma warning (pop)
if (itemIDList != nullptr)
{
SHOpenFolderAndSelectItems (itemIDList, 0, nullptr, 0);
ILFree (itemIDList);
}
#endif
}
//==============================================================================


+ 1
- 1
modules/juce_core/system/juce_PlatformDefs.h View File

@@ -52,7 +52,7 @@
// Debugging and assertion macros
#if JUCE_LOG_ASSERTIONS
#define juce_LogCurrentAssertion juce_LogAssertion (__FILE__, __LINE__);
#define juce_LogCurrentAssertion juce::logAssertion (__FILE__, __LINE__);
#elif JUCE_DEBUG
#define juce_LogCurrentAssertion std::cerr << "JUCE Assertion failure in " << __FILE__ << ", line " << __LINE__ << std::endl;
#else


+ 1
- 1
modules/juce_core/system/juce_StandardHeader.h View File

@@ -154,7 +154,7 @@ BEGIN_JUCE_NAMESPACE
extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger();
#if JUCE_LOG_ASSERTIONS
extern JUCE_API void juce_LogAssertion (const char* filename, int lineNum) noexcept;
extern JUCE_API void logAssertion (const char* filename, int lineNum) noexcept;
#endif
#include "../memory/juce_Memory.h"


+ 19
- 16
modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -27,14 +27,19 @@
// these are in the windows SDK, but need to be repeated here for GCC..
#ifndef GET_APPCOMMAND_LPARAM
#define FAPPCOMMAND_MASK 0xF000
#define GET_APPCOMMAND_LPARAM(lParam) ((short) (HIWORD (lParam) & ~FAPPCOMMAND_MASK))
#define FAPPCOMMAND_MASK 0xF000
#define APPCOMMAND_MEDIA_NEXTTRACK 11
#define APPCOMMAND_MEDIA_PREVIOUSTRACK 12
#define APPCOMMAND_MEDIA_STOP 13
#define APPCOMMAND_MEDIA_PLAY_PAUSE 14
#endif
#ifndef WM_APPCOMMAND
#define WM_APPCOMMAND 0x0319
#endif
extern void juce_repeatLastProcessPriority();
extern void juce_CheckCurrentlyFocusedTopLevelWindow(); // in juce_TopLevelWindow.cpp
extern bool juce_IsRunningInWine();
@@ -44,21 +49,22 @@ extern CheckEventBlockedByModalComps isEventBlockedByModalComps;
static bool shouldDeactivateTitleBar = true;
void* getUser32Function (const char* functionName) // (NB: this function also used from other modules)
{
HMODULE user32Mod = GetModuleHandleA ("user32.dll");
jassert (user32Mod != 0);
return static_cast <void*> (GetProcAddress (user32Mod, functionName));
}
//==============================================================================
typedef BOOL (WINAPI* UpdateLayeredWinFunc) (HWND, HDC, POINT*, SIZE*, HDC, POINT*, COLORREF, BLENDFUNCTION*, DWORD);
static UpdateLayeredWinFunc updateLayeredWindow = nullptr;
bool Desktop::canUseSemiTransparentWindows() noexcept
{
if (updateLayeredWindow == 0)
{
if (! juce_IsRunningInWine())
{
HMODULE user32Mod = GetModuleHandle (_T("user32.dll"));
jassert (user32Mod != 0);
updateLayeredWindow = (UpdateLayeredWinFunc) GetProcAddress (user32Mod, "UpdateLayeredWindow");
}
}
if (updateLayeredWindow == nullptr && ! juce_IsRunningInWine())
updateLayeredWindow = (UpdateLayeredWinFunc) getUser32Function ("UpdateLayeredWindow");
return updateLayeredWindow != 0;
}
@@ -103,12 +109,9 @@ static bool canUseMultiTouch()
{
hasCheckedForMultiTouch = true;
HMODULE user32Mod = GetModuleHandle (_T("user32.dll"));
jassert (user32Mod != 0);
registerTouchWindow = (RegisterTouchWindowFunc) GetProcAddress (user32Mod, "RegisterTouchWindow");
getTouchInputInfo = (GetTouchInputInfoFunc) GetProcAddress (user32Mod, "GetTouchInputInfo");
closeTouchInputHandle = (CloseTouchInputHandleFunc) GetProcAddress (user32Mod, "CloseTouchInputHandle");
registerTouchWindow = (RegisterTouchWindowFunc) getUser32Function ("RegisterTouchWindow");
getTouchInputInfo = (GetTouchInputInfoFunc) getUser32Function ("GetTouchInputInfo");
closeTouchInputHandle = (CloseTouchInputHandleFunc) getUser32Function ("CloseTouchInputHandle");
}
return registerTouchWindow != nullptr;


+ 3
- 3
modules/juce_gui_extra/native/juce_win32_ActiveXComponent.cpp View File

@@ -99,7 +99,7 @@ namespace ActiveXHelpers
If you don't call AddRef then others crash (e.g. QuickTime).. Bit of a catch-22, so letting it leak is probably preferable.
*/
if (lplpFrame != nullptr) { frame->AddRef(); *lplpFrame = frame; }
if (lplpDoc != nullptr) *lplpDoc = 0;
if (lplpDoc != nullptr) *lplpDoc = nullptr;
lpFrameInfo->fMDIApp = FALSE;
lpFrameInfo->hwndFrame = window;
lpFrameInfo->haccel = 0;
@@ -146,7 +146,7 @@ namespace ActiveXHelpers
JUCE_COMRESULT SaveObject() { return E_NOTIMPL; }
JUCE_COMRESULT GetMoniker (DWORD, DWORD, IMoniker**) { return E_NOTIMPL; }
JUCE_COMRESULT GetContainer (LPOLECONTAINER* ppContainer) { *ppContainer = 0; return E_NOINTERFACE; }
JUCE_COMRESULT GetContainer (LPOLECONTAINER* ppContainer) { *ppContainer = nullptr; return E_NOINTERFACE; }
JUCE_COMRESULT ShowObject() { return S_OK; }
JUCE_COMRESULT OnShowWindow (BOOL) { return E_NOTIMPL; }
JUCE_COMRESULT RequestNewObjectLayout() { return E_NOTIMPL; }
@@ -190,7 +190,7 @@ namespace ActiveXHelpers
case WM_MBUTTONUP:
case WM_RBUTTONUP:
peer->handleMouseEvent (0, Point<int> (GET_X_LPARAM (lParam) + activeXRect.left - peerRect.left,
GET_Y_LPARAM (lParam) + activeXRect.top - peerRect.top),
GET_Y_LPARAM (lParam) + activeXRect.top - peerRect.top),
ModifierKeys::getCurrentModifiersRealtime(),
getMouseEventTime());
break;


+ 4
- 9
modules/juce_gui_extra/native/juce_win32_SystemTrayIcon.cpp View File

@@ -23,9 +23,12 @@
==============================================================================
*/
// (these functions are from juce_win32_Windowing.cpp)
extern void* getUser32Function (const char*);
namespace IconConverters
{
extern HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY);
extern HICON createHICONFromImage (const Image&, BOOL isIcon, int hotspotX, int hotspotY);
}
//==============================================================================
@@ -185,14 +188,6 @@ private:
const DWORD taskbarCreatedMessage;
enum { WM_TRAYNOTIFY = WM_USER + 100 };
static void* getUser32Function (const char* functionName)
{
HMODULE user32Mod = GetModuleHandle (_T("user32.dll"));
jassert (user32Mod != 0);
return GetProcAddress (user32Mod, functionName);
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Pimpl);
};


Loading…
Cancel
Save