Browse Source

Update to latest juce

tags/1.9.4
falkTX 10 years ago
parent
commit
2c470a9aab
58 changed files with 401 additions and 250 deletions
  1. +2
    -2
      data/copy-juce-carla
  2. +2
    -2
      source/backend/engine/CarlaEngine.cpp
  3. +1
    -3
      source/backend/plugin/Lv2Plugin.cpp
  4. +0
    -1
      source/backend/plugin/NativePlugin.cpp
  5. +36
    -3
      source/backend/standalone/CarlaStandalone.cpp
  6. +18
    -8
      source/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.cpp
  7. +13
    -9
      source/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h
  8. +11
    -11
      source/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp
  9. +0
    -1
      source/modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp
  10. +1
    -2
      source/modules/juce_audio_basics/sources/juce_ChannelRemappingAudioSource.cpp
  11. +1
    -3
      source/modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp
  12. +0
    -2
      source/modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp
  13. +4
    -4
      source/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp
  14. +4
    -4
      source/modules/juce_audio_basics/synthesisers/juce_Synthesiser.h
  15. +0
    -1
      source/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp
  16. +1
    -2
      source/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp
  17. +2
    -4
      source/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp
  18. +44
    -44
      source/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp
  19. +0
    -1
      source/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp
  20. +1
    -1
      source/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp
  21. +2
    -3
      source/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp
  22. +9
    -7
      source/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
  23. +4
    -4
      source/modules/juce_audio_processors/format_types/juce_VST3Common.h
  24. +1
    -0
      source/modules/juce_audio_processors/format_types/juce_VST3Headers.h
  25. +8
    -8
      source/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp
  26. +4
    -0
      source/modules/juce_audio_processors/processors/juce_AudioPluginInstance.h
  27. +0
    -2
      source/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp
  28. +18
    -18
      source/modules/juce_core/containers/juce_HashMap.h
  29. +3
    -3
      source/modules/juce_core/files/juce_File.cpp
  30. +20
    -20
      source/modules/juce_core/misc/juce_WindowsRegistry.h
  31. +12
    -7
      source/modules/juce_core/native/juce_linux_SystemStats.cpp
  32. +1
    -1
      source/modules/juce_core/native/juce_mac_Network.mm
  33. +5
    -1
      source/modules/juce_core/native/juce_mac_Threads.mm
  34. +17
    -17
      source/modules/juce_core/native/juce_win32_Registry.cpp
  35. +7
    -1
      source/modules/juce_core/native/juce_win32_Threads.cpp
  36. +1
    -0
      source/modules/juce_core/network/juce_URL.h
  37. +1
    -1
      source/modules/juce_core/system/juce_StandardHeader.h
  38. +3
    -0
      source/modules/juce_core/text/juce_StringRef.h
  39. +1
    -0
      source/modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp
  40. +1
    -1
      source/modules/juce_core/zip/juce_ZipFile.cpp
  41. +25
    -17
      source/modules/juce_graphics/fonts/juce_Font.cpp
  42. +1
    -1
      source/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp
  43. +7
    -4
      source/modules/juce_graphics/native/juce_RenderingHelpers.h
  44. +10
    -3
      source/modules/juce_gui_basics/components/juce_Desktop.cpp
  45. +1
    -0
      source/modules/juce_gui_basics/components/juce_Desktop.h
  46. +16
    -0
      source/modules/juce_gui_basics/native/juce_ios_Windowing.mm
  47. +5
    -2
      source/modules/juce_gui_basics/native/juce_linux_FileChooser.cpp
  48. +4
    -0
      source/modules/juce_gui_basics/native/juce_mac_FileChooser.mm
  49. +4
    -8
      source/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm
  50. +4
    -0
      source/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp
  51. +2
    -1
      source/modules/juce_gui_basics/native/juce_win32_Windowing.cpp
  52. +18
    -6
      source/modules/juce_gui_basics/widgets/juce_ComboBox.cpp
  53. +8
    -1
      source/modules/juce_gui_basics/widgets/juce_ComboBox.h
  54. +0
    -1
      source/modules/juce_gui_basics/widgets/juce_Slider.h
  55. +3
    -3
      source/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.h
  56. +4
    -1
      source/modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.h
  57. +18
    -0
      source/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm
  58. +12
    -0
      source/utils/CarlaString.hpp

+ 2
- 2
data/copy-juce-carla View File

@@ -2,8 +2,8 @@


set -e set -e


JUCE_MODULES_DIR="/home/falktx/FOSS/GIT-mine/DISTRHO/libs/juce/source/modules/"
CARLA_MODULES_DIR="/home/falktx/FOSS/GIT-mine/Carla/source/modules/"
JUCE_MODULES_DIR="/home/falktx/Personal/FOSS/GIT/distrho/DISTRHO/libs/juce/source/modules/"
CARLA_MODULES_DIR="/home/falktx/Personal/FOSS/GIT/falktx/Carla/source/modules/"


MODULES=("juce_audio_basics juce_audio_devices juce_audio_formats juce_audio_processors juce_core juce_data_structures juce_events juce_graphics juce_gui_basics juce_gui_extra") MODULES=("juce_audio_basics juce_audio_devices juce_audio_formats juce_audio_processors juce_core juce_data_structures juce_events juce_graphics juce_gui_basics juce_gui_extra")




+ 2
- 2
source/backend/engine/CarlaEngine.cpp View File

@@ -1728,7 +1728,7 @@ bool CarlaEngine::loadProject(const char* const filename)
if (pData->options.processMode != ENGINE_PROCESS_MODE_PATCHBAY) if (pData->options.processMode != ENGINE_PROCESS_MODE_PATCHBAY)
{ {
if (std::getenv("LADISH_APP_NAME") != nullptr || std::getenv("NSM_URL") != nullptr) if (std::getenv("LADISH_APP_NAME") != nullptr || std::getenv("NSM_URL") != nullptr)
return;
return true;
} }


// now connections // now connections
@@ -1818,7 +1818,7 @@ bool CarlaEngine::saveProject(const char* const filename)
if (pData->options.processMode != ENGINE_PROCESS_MODE_PATCHBAY) if (pData->options.processMode != ENGINE_PROCESS_MODE_PATCHBAY)
{ {
if (std::getenv("LADISH_APP_NAME") != nullptr || std::getenv("NSM_URL") != nullptr) if (std::getenv("LADISH_APP_NAME") != nullptr || std::getenv("NSM_URL") != nullptr)
return;
return true;
} }


if (const char* const* patchbayConns = getPatchbayConnections()) if (const char* const* patchbayConns = getPatchbayConnections())


+ 1
- 3
source/backend/plugin/Lv2Plugin.cpp View File

@@ -24,10 +24,8 @@


#ifdef WANT_LV2 #ifdef WANT_LV2


// need this first for juce headers
#include "CarlaMathUtils.hpp"

#include "CarlaLv2Utils.hpp" #include "CarlaLv2Utils.hpp"
#include "CarlaMathUtils.hpp"
#include "CarlaPluginUi.hpp" #include "CarlaPluginUi.hpp"
#include "Lv2AtomQueue.hpp" #include "Lv2AtomQueue.hpp"




+ 0
- 1
source/backend/plugin/NativePlugin.cpp View File

@@ -21,7 +21,6 @@
#ifdef WANT_NATIVE #ifdef WANT_NATIVE


#include "CarlaMathUtils.hpp" #include "CarlaMathUtils.hpp"

#include "CarlaNative.h" #include "CarlaNative.h"


#include <QtCore/QStringList> #include <QtCore/QStringList>


+ 36
- 3
source/backend/standalone/CarlaStandalone.cpp View File

@@ -200,6 +200,12 @@ static CarlaBackendStandalone gStandalone;
#define NSM_API_VERSION_MAJOR 1 #define NSM_API_VERSION_MAJOR 1
#define NSM_API_VERSION_MINOR 2 #define NSM_API_VERSION_MINOR 2


#ifdef HAVE_X11
# define NSM_CLIENT_FEATURES ":switch:optional-gui:"
#else
# define NSM_CLIENT_FEATURES ":switch:"
#endif

class CarlaNSM class CarlaNSM
{ {
public: public:
@@ -241,14 +247,14 @@ public:
lo_server_add_method(fOscServer, "/reply", "ssss", _reply_handler, this); lo_server_add_method(fOscServer, "/reply", "ssss", _reply_handler, this);
lo_server_add_method(fOscServer, "/nsm/client/open", "sss", _open_handler, this); lo_server_add_method(fOscServer, "/nsm/client/open", "sss", _open_handler, this);
lo_server_add_method(fOscServer, "/nsm/client/save", "", _save_handler, this); lo_server_add_method(fOscServer, "/nsm/client/save", "", _save_handler, this);
lo_server_add_method(fOscServer, "/nsm/client/show_optional_gui", "", _show_gui_handler, this);
lo_server_add_method(fOscServer, "/nsm/client/hide_optional_gui", "", _hide_gui_handler, this);
// /nsm/client/session_is_loaded // /nsm/client/session_is_loaded
// /nsm/client/show_optional_gui
// /nsm/client/hide_optional_gui
} }


#ifndef BUILD_ANSI_TEST #ifndef BUILD_ANSI_TEST
lo_send_from(addr, fOscServer, LO_TT_IMMEDIATE, "/nsm/server/announce", "sssiii", lo_send_from(addr, fOscServer, LO_TT_IMMEDIATE, "/nsm/server/announce", "sssiii",
"Carla", ":switch:", initName, NSM_API_VERSION_MAJOR, NSM_API_VERSION_MINOR, pid); // optional-gui:
"Carla", NSM_CLIENT_FEATURES, initName, NSM_API_VERSION_MAJOR, NSM_API_VERSION_MINOR, pid);
#endif #endif


lo_address_free(addr); lo_address_free(addr);
@@ -356,6 +362,23 @@ protected:
#endif #endif
} }


int handleShowHideGui(const bool show)
{
CARLA_SAFE_ASSERT_RETURN(fOscServer != nullptr, 0);
CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0);
//CARLA_SAFE_ASSERT_RETURN(gStandalone.frontendWinId != 0, 0);
carla_debug("CarlaNSM::handleShowHideGui(%s)", bool2str(show));

#ifdef HAVE_X11
#endif

#ifndef BUILD_ANSI_TEST
lo_send_from(lo_message_get_source(msg), fOscServer, LO_TT_IMMEDIATE, show ? "/nsm/client/gui_is_shown" : "/nsm/client/gui_is_hidden", "");
#endif

return 0;
}

private: private:
lo_server fOscServer; lo_server fOscServer;
CarlaString fProjectPath; CarlaString fProjectPath;
@@ -382,6 +405,16 @@ private:
return handlePtr->handleSave(path, types, argv, argc, msg); return handlePtr->handleSave(path, types, argv, argc, msg);
} }


static int _show_gui_handler(const char*, const char*, lo_arg**, int, lo_message, void* data)
{
return handlePtr->handleShowHideGui(true);
}

static int _hide_gui_handler(const char*, const char*, lo_arg**, int, lo_message, void* data)
{
return handlePtr->handleShowHideGui(false);
}

#undef handlePtr #undef handlePtr


CARLA_PREVENT_HEAP_ALLOCATION CARLA_PREVENT_HEAP_ALLOCATION


+ 18
- 8
source/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.cpp View File

@@ -22,13 +22,20 @@
============================================================================== ==============================================================================
*/ */
AudioSampleBuffer::AudioSampleBuffer() noexcept
: numChannels (0), size (0), allocatedBytes (0),
channels (static_cast<float**> (preallocatedChannelSpace)),
isClear (false)
{
}
AudioSampleBuffer::AudioSampleBuffer (const int numChans, AudioSampleBuffer::AudioSampleBuffer (const int numChans,
const int numSamples) noexcept const int numSamples) noexcept
: numChannels (numChans), : numChannels (numChans),
size (numSamples) size (numSamples)
{ {
jassert (numSamples >= 0); jassert (numSamples >= 0);
jassert (numChans > 0);
jassert (numChans >= 0);
allocateData(); allocateData();
} }
@@ -63,7 +70,7 @@ void AudioSampleBuffer::allocateData()
const size_t channelListSize = sizeof (float*) * (size_t) (numChannels + 1); const size_t channelListSize = sizeof (float*) * (size_t) (numChannels + 1);
allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (float) + channelListSize + 32; allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (float) + channelListSize + 32;
allocatedData.malloc (allocatedBytes); allocatedData.malloc (allocatedBytes);
channels = reinterpret_cast <float**> (allocatedData.getData());
channels = reinterpret_cast<float**> (allocatedData.getData());
float* chan = (float*) (allocatedData + channelListSize); float* chan = (float*) (allocatedData + channelListSize);
for (int i = 0; i < numChannels; ++i) for (int i = 0; i < numChannels; ++i)
@@ -83,7 +90,8 @@ AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo,
size (numSamples), size (numSamples),
allocatedBytes (0) allocatedBytes (0)
{ {
jassert (numChans > 0);
jassert (dataToReferTo != nullptr);
jassert (numChans >= 0);
allocateChannels (dataToReferTo, 0); allocateChannels (dataToReferTo, 0);
} }
@@ -96,7 +104,8 @@ AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo,
allocatedBytes (0), allocatedBytes (0),
isClear (false) isClear (false)
{ {
jassert (numChans > 0);
jassert (dataToReferTo != nullptr);
jassert (numChans >= 0);
allocateChannels (dataToReferTo, startSample); allocateChannels (dataToReferTo, startSample);
} }
@@ -104,7 +113,8 @@ void AudioSampleBuffer::setDataToReferTo (float** dataToReferTo,
const int newNumChannels, const int newNumChannels,
const int newNumSamples) noexcept const int newNumSamples) noexcept
{ {
jassert (newNumChannels > 0);
jassert (dataToReferTo != nullptr);
jassert (newNumChannels >= 0);
allocatedBytes = 0; allocatedBytes = 0;
allocatedData.free(); allocatedData.free();
@@ -121,12 +131,12 @@ void AudioSampleBuffer::allocateChannels (float* const* const dataToReferTo, int
// (try to avoid doing a malloc here, as that'll blow up things like Pro-Tools) // (try to avoid doing a malloc here, as that'll blow up things like Pro-Tools)
if (numChannels < (int) numElementsInArray (preallocatedChannelSpace)) if (numChannels < (int) numElementsInArray (preallocatedChannelSpace))
{ {
channels = static_cast <float**> (preallocatedChannelSpace);
channels = static_cast<float**> (preallocatedChannelSpace);
} }
else else
{ {
allocatedData.malloc ((size_t) numChannels + 1, sizeof (float*)); allocatedData.malloc ((size_t) numChannels + 1, sizeof (float*));
channels = reinterpret_cast <float**> (allocatedData.getData());
channels = reinterpret_cast<float**> (allocatedData.getData());
} }
for (int i = 0; i < numChannels; ++i) for (int i = 0; i < numChannels; ++i)
@@ -171,7 +181,7 @@ void AudioSampleBuffer::setSize (const int newNumChannels,
const bool clearExtraSpace, const bool clearExtraSpace,
const bool avoidReallocating) noexcept const bool avoidReallocating) noexcept
{ {
jassert (newNumChannels > 0);
jassert (newNumChannels >= 0);
jassert (newNumSamples >= 0); jassert (newNumSamples >= 0);
if (newNumSamples != size || newNumChannels != numChannels) if (newNumSamples != size || newNumChannels != numChannels)


+ 13
- 9
source/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h View File

@@ -34,6 +34,10 @@
class JUCE_API AudioSampleBuffer class JUCE_API AudioSampleBuffer
{ {
public: public:
//==============================================================================
/** Creates an empty buffer with 0 channels and 0 length. */
AudioSampleBuffer() noexcept;
//============================================================================== //==============================================================================
/** Creates a buffer with a specified number of channels and samples. /** Creates a buffer with a specified number of channels and samples.
@@ -93,12 +97,12 @@ public:
using an external data buffer, in which case boths buffers will just point to the same using an external data buffer, in which case boths buffers will just point to the same
shared block of data. shared block of data.
*/ */
AudioSampleBuffer (const AudioSampleBuffer& other) noexcept;
AudioSampleBuffer (const AudioSampleBuffer&) noexcept;
/** Copies another buffer onto this one. /** Copies another buffer onto this one.
This buffer's size will be changed to that of the other buffer. This buffer's size will be changed to that of the other buffer.
*/ */
AudioSampleBuffer& operator= (const AudioSampleBuffer& other) noexcept;
AudioSampleBuffer& operator= (const AudioSampleBuffer&) noexcept;
/** Destructor. /** Destructor.
This will free any memory allocated by the buffer. This will free any memory allocated by the buffer.
@@ -493,14 +497,14 @@ public:
//============================================================================== //==============================================================================
#ifndef DOXYGEN #ifndef DOXYGEN
// Note that these methods have now been replaced by getReadPointer() and getWritePointer() // Note that these methods have now been replaced by getReadPointer() and getWritePointer()
JUCE_DEPRECATED (const float* getSampleData (int channel) const) { return getReadPointer (channel); }
JUCE_DEPRECATED (const float* getSampleData (int channel, int index) const) { return getReadPointer (channel, index); }
JUCE_DEPRECATED (float* getSampleData (int channel)) { return getWritePointer (channel); }
JUCE_DEPRECATED (float* getSampleData (int channel, int index)) { return getWritePointer (channel, index); }
JUCE_DEPRECATED_WITH_BODY (const float* getSampleData (int channel) const, { return getReadPointer (channel); })
JUCE_DEPRECATED_WITH_BODY (const float* getSampleData (int channel, int index) const, { return getReadPointer (channel, index); })
JUCE_DEPRECATED_WITH_BODY (float* getSampleData (int channel), { return getWritePointer (channel); })
JUCE_DEPRECATED_WITH_BODY (float* getSampleData (int channel, int index), { return getWritePointer (channel, index); })
// These have been replaced by getArrayOfReadPointers() and getArrayOfWritePointers() // These have been replaced by getArrayOfReadPointers() and getArrayOfWritePointers()
JUCE_DEPRECATED (const float** getArrayOfChannels() const) { return getArrayOfReadPointers(); }
JUCE_DEPRECATED (float** getArrayOfChannels()) { return getArrayOfWritePointers(); }
JUCE_DEPRECATED_WITH_BODY (const float** getArrayOfChannels() const, { return getArrayOfReadPointers(); })
JUCE_DEPRECATED_WITH_BODY (float** getArrayOfChannels(), { return getArrayOfWritePointers(); })
#endif #endif
private: private:
@@ -513,7 +517,7 @@ private:
bool isClear; bool isClear;
void allocateData(); void allocateData();
void allocateChannels (float* const* dataToReferTo, int offset);
void allocateChannels (float* const*, int offset);
JUCE_LEAK_DETECTOR (AudioSampleBuffer) JUCE_LEAK_DETECTOR (AudioSampleBuffer)
}; };


+ 11
- 11
source/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp View File

@@ -53,8 +53,8 @@ namespace FloatVectorHelpers
static forcedinline ParallelType load1 (Type v) noexcept { return _mm_load1_ps (&v); } static forcedinline ParallelType load1 (Type v) noexcept { return _mm_load1_ps (&v); }
static forcedinline ParallelType loadA (const Type* v) noexcept { return _mm_load_ps (v); } static forcedinline ParallelType loadA (const Type* v) noexcept { return _mm_load_ps (v); }
static forcedinline ParallelType loadU (const Type* v) noexcept { return _mm_loadu_ps (v); } static forcedinline ParallelType loadU (const Type* v) noexcept { return _mm_loadu_ps (v); }
static forcedinline void storeA (Type* dest, ParallelType a) noexcept { return _mm_store_ps (dest, a); }
static forcedinline void storeU (Type* dest, ParallelType a) noexcept { return _mm_storeu_ps (dest, a); }
static forcedinline void storeA (Type* dest, ParallelType a) noexcept { _mm_store_ps (dest, a); }
static forcedinline void storeU (Type* dest, ParallelType a) noexcept { _mm_storeu_ps (dest, a); }
static forcedinline ParallelType add (ParallelType a, ParallelType b) noexcept { return _mm_add_ps (a, b); } static forcedinline ParallelType add (ParallelType a, ParallelType b) noexcept { return _mm_add_ps (a, b); }
static forcedinline ParallelType sub (ParallelType a, ParallelType b) noexcept { return _mm_sub_ps (a, b); } static forcedinline ParallelType sub (ParallelType a, ParallelType b) noexcept { return _mm_sub_ps (a, b); }
@@ -75,8 +75,8 @@ namespace FloatVectorHelpers
static forcedinline ParallelType load1 (Type v) noexcept { return _mm_load1_pd (&v); } static forcedinline ParallelType load1 (Type v) noexcept { return _mm_load1_pd (&v); }
static forcedinline ParallelType loadA (const Type* v) noexcept { return _mm_load_pd (v); } static forcedinline ParallelType loadA (const Type* v) noexcept { return _mm_load_pd (v); }
static forcedinline ParallelType loadU (const Type* v) noexcept { return _mm_loadu_pd (v); } static forcedinline ParallelType loadU (const Type* v) noexcept { return _mm_loadu_pd (v); }
static forcedinline void storeA (Type* dest, ParallelType a) noexcept { return _mm_store_pd (dest, a); }
static forcedinline void storeU (Type* dest, ParallelType a) noexcept { return _mm_storeu_pd (dest, a); }
static forcedinline void storeA (Type* dest, ParallelType a) noexcept { _mm_store_pd (dest, a); }
static forcedinline void storeU (Type* dest, ParallelType a) noexcept { _mm_storeu_pd (dest, a); }
static forcedinline ParallelType add (ParallelType a, ParallelType b) noexcept { return _mm_add_pd (a, b); } static forcedinline ParallelType add (ParallelType a, ParallelType b) noexcept { return _mm_add_pd (a, b); }
static forcedinline ParallelType sub (ParallelType a, ParallelType b) noexcept { return _mm_sub_pd (a, b); } static forcedinline ParallelType sub (ParallelType a, ParallelType b) noexcept { return _mm_sub_pd (a, b); }
@@ -134,8 +134,8 @@ namespace FloatVectorHelpers
static forcedinline ParallelType load1 (Type v) noexcept { return vld1q_dup_f32 (&v); } static forcedinline ParallelType load1 (Type v) noexcept { return vld1q_dup_f32 (&v); }
static forcedinline ParallelType loadA (const Type* v) noexcept { return vld1q_f32 (v); } static forcedinline ParallelType loadA (const Type* v) noexcept { return vld1q_f32 (v); }
static forcedinline ParallelType loadU (const Type* v) noexcept { return vld1q_f32 (v); } static forcedinline ParallelType loadU (const Type* v) noexcept { return vld1q_f32 (v); }
static forcedinline void storeA (Type* dest, ParallelType a) noexcept { return vst1q_f32 (dest, a); }
static forcedinline void storeU (Type* dest, ParallelType a) noexcept { return vst1q_f32 (dest, a); }
static forcedinline void storeA (Type* dest, ParallelType a) noexcept { vst1q_f32 (dest, a); }
static forcedinline void storeU (Type* dest, ParallelType a) noexcept { vst1q_f32 (dest, a); }
static forcedinline ParallelType add (ParallelType a, ParallelType b) noexcept { return vaddq_f32 (a, b); } static forcedinline ParallelType add (ParallelType a, ParallelType b) noexcept { return vaddq_f32 (a, b); }
static forcedinline ParallelType sub (ParallelType a, ParallelType b) noexcept { return vsubq_f32 (a, b); } static forcedinline ParallelType sub (ParallelType a, ParallelType b) noexcept { return vsubq_f32 (a, b); }
@@ -156,8 +156,8 @@ namespace FloatVectorHelpers
static forcedinline ParallelType load1 (Type v) noexcept { return v; } static forcedinline ParallelType load1 (Type v) noexcept { return v; }
static forcedinline ParallelType loadA (const Type* v) noexcept { return *v; } static forcedinline ParallelType loadA (const Type* v) noexcept { return *v; }
static forcedinline ParallelType loadU (const Type* v) noexcept { return *v; } static forcedinline ParallelType loadU (const Type* v) noexcept { return *v; }
static forcedinline void storeA (Type* dest, ParallelType a) noexcept { return *dest = a; }
static forcedinline void storeU (Type* dest, ParallelType a) noexcept { return *dest = a; }
static forcedinline void storeA (Type* dest, ParallelType a) noexcept { *dest = a; }
static forcedinline void storeU (Type* dest, ParallelType a) noexcept { *dest = a; }
static forcedinline ParallelType add (ParallelType a, ParallelType b) noexcept { return a + b; } static forcedinline ParallelType add (ParallelType a, ParallelType b) noexcept { return a + b; }
static forcedinline ParallelType sub (ParallelType a, ParallelType b) noexcept { return a - b; } static forcedinline ParallelType sub (ParallelType a, ParallelType b) noexcept { return a - b; }
@@ -549,9 +549,9 @@ void FloatVectorOperations::negate (double* dest, const double* src, int num) no
void JUCE_CALLTYPE FloatVectorOperations::convertFixedToFloat (float* dest, const int* src, float multiplier, int num) noexcept void JUCE_CALLTYPE FloatVectorOperations::convertFixedToFloat (float* dest, const int* src, float multiplier, int num) noexcept
{ {
#if JUCE_USE_ARM_NEON #if JUCE_USE_ARM_NEON
JUCE_PERFORM_NEON_OP_SRC_DEST (dest[i] = src[i] * multiplier,
vmulq_n_f32 (vcvtq_f32_s32 (vld1q_s32 (src)), multiplier),
JUCE_LOAD_NONE)
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = src[i] * multiplier,
vmulq_n_f32 (vcvtq_f32_s32 (vld1q_s32 (src)), multiplier),
JUCE_LOAD_NONE, JUCE_INCREMENT_SRC_DEST, )
#else #else
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = src[i] * multiplier, JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = src[i] * multiplier,
Mode::mul (mult, _mm_cvtepi32_ps (_mm_loadu_si128 ((const __m128i*) src))), Mode::mul (mult, _mm_cvtepi32_ps (_mm_loadu_si128 ((const __m128i*) src))),


+ 0
- 1
source/modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp View File

@@ -31,7 +31,6 @@ BufferingAudioSource::BufferingAudioSource (PositionableAudioSource* s,
backgroundThread (thread), backgroundThread (thread),
numberOfSamplesToBuffer (jmax (1024, bufferSizeSamples)), numberOfSamplesToBuffer (jmax (1024, bufferSizeSamples)),
numberOfChannels (numChannels), numberOfChannels (numChannels),
buffer (numChannels, 0),
bufferValidStart (0), bufferValidStart (0),
bufferValidEnd (0), bufferValidEnd (0),
nextPlayPos (0), nextPlayPos (0),


+ 1
- 2
source/modules/juce_audio_basics/sources/juce_ChannelRemappingAudioSource.cpp View File

@@ -25,8 +25,7 @@
ChannelRemappingAudioSource::ChannelRemappingAudioSource (AudioSource* const source_, ChannelRemappingAudioSource::ChannelRemappingAudioSource (AudioSource* const source_,
const bool deleteSourceWhenDeleted) const bool deleteSourceWhenDeleted)
: source (source_, deleteSourceWhenDeleted), : source (source_, deleteSourceWhenDeleted),
requiredNumberOfChannels (2),
buffer (2, 16)
requiredNumberOfChannels (2)
{ {
remappedInfo.buffer = &buffer; remappedInfo.buffer = &buffer;
remappedInfo.startSample = 0; remappedInfo.startSample = 0;


+ 1
- 3
source/modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp View File

@@ -23,9 +23,7 @@
*/ */
MixerAudioSource::MixerAudioSource() MixerAudioSource::MixerAudioSource()
: tempBuffer (2, 0),
currentSampleRate (0.0),
bufferSizeExpected (0)
: currentSampleRate (0.0), bufferSizeExpected (0)
{ {
} }


+ 0
- 2
source/modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp View File

@@ -28,14 +28,12 @@ ResamplingAudioSource::ResamplingAudioSource (AudioSource* const inputSource,
: input (inputSource, deleteInputWhenDeleted), : input (inputSource, deleteInputWhenDeleted),
ratio (1.0), ratio (1.0),
lastRatio (1.0), lastRatio (1.0),
buffer (numChannels_, 0),
bufferPos (0), bufferPos (0),
sampsInBuffer (0), sampsInBuffer (0),
subSampleOffset (0), subSampleOffset (0),
numChannels (numChannels_) numChannels (numChannels_)
{ {
jassert (input != nullptr); jassert (input != nullptr);
zeromem (coefficients, sizeof (coefficients)); zeromem (coefficients, sizeof (coefficients));
} }


+ 4
- 4
source/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp View File

@@ -90,10 +90,10 @@ void Synthesiser::clearVoices()
voices.clear(); voices.clear();
} }
void Synthesiser::addVoice (SynthesiserVoice* const newVoice)
SynthesiserVoice* Synthesiser::addVoice (SynthesiserVoice* const newVoice)
{ {
const ScopedLock sl (lock); const ScopedLock sl (lock);
voices.add (newVoice);
return voices.add (newVoice);
} }
void Synthesiser::removeVoice (const int index) void Synthesiser::removeVoice (const int index)
@@ -108,10 +108,10 @@ void Synthesiser::clearSounds()
sounds.clear(); sounds.clear();
} }
void Synthesiser::addSound (const SynthesiserSound::Ptr& newSound)
SynthesiserSound* Synthesiser::addSound (const SynthesiserSound::Ptr& newSound)
{ {
const ScopedLock sl (lock); const ScopedLock sl (lock);
sounds.add (newSound);
return sounds.add (newSound);
} }
void Synthesiser::removeSound (const int index) void Synthesiser::removeSound (const int index)


+ 4
- 4
source/modules/juce_audio_basics/synthesisers/juce_Synthesiser.h View File

@@ -294,7 +294,7 @@ public:
it later on when no longer needed. The caller should not retain a pointer to the it later on when no longer needed. The caller should not retain a pointer to the
voice. voice.
*/ */
void addVoice (SynthesiserVoice* newVoice);
SynthesiserVoice* addVoice (SynthesiserVoice* newVoice);
/** Deletes one of the voices. */ /** Deletes one of the voices. */
void removeVoice (int index); void removeVoice (int index);
@@ -311,10 +311,10 @@ public:
/** Adds a new sound to the synthesiser. /** Adds a new sound to the synthesiser.
The object passed in is reference counted, so will be deleted when it is removed
from the synthesiser, and when no voices are still using it.
The object passed in is reference counted, so will be deleted when the
synthesiser and all voices are no longer using it.
*/ */
void addSound (const SynthesiserSound::Ptr& newSound);
SynthesiserSound* addSound (const SynthesiserSound::Ptr& newSound);
/** Removes and deletes one of the sounds. */ /** Removes and deletes one of the sounds. */
void removeSound (int index); void removeSound (int index);


+ 0
- 1
source/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp View File

@@ -95,7 +95,6 @@ AudioDeviceManager::AudioDeviceManager()
useInputNames (false), useInputNames (false),
inputLevel (0), inputLevel (0),
testSoundPosition (0), testSoundPosition (0),
tempBuffer (2, 2),
cpuUsageMs (0), cpuUsageMs (0),
timeToCpuScale (0) timeToCpuScale (0)
{ {


+ 1
- 2
source/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp View File

@@ -1026,8 +1026,7 @@ public:
AudioIODeviceCombiner (const String& deviceName) AudioIODeviceCombiner (const String& deviceName)
: AudioIODevice (deviceName, "CoreAudio"), : AudioIODevice (deviceName, "CoreAudio"),
Thread (deviceName), callback (nullptr), Thread (deviceName), callback (nullptr),
currentSampleRate (0), currentBufferSize (0), active (false),
fifos (1, 1)
currentSampleRate (0), currentBufferSize (0), active (false)
{ {
} }


+ 2
- 4
source/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp View File

@@ -731,8 +731,6 @@ public:
isStarted (false), isStarted (false),
bufferSizeSamples (0), bufferSizeSamples (0),
sampleRate (0.0), sampleRate (0.0),
inputBuffers (1, 1),
outputBuffers (1, 1),
callback (nullptr) callback (nullptr)
{ {
if (outputDeviceIndex_ >= 0) if (outputDeviceIndex_ >= 0)
@@ -871,8 +869,8 @@ private:
bool isStarted; bool isStarted;
String lastError; String lastError;
OwnedArray <DSoundInternalInChannel> inChans;
OwnedArray <DSoundInternalOutChannel> outChans;
OwnedArray<DSoundInternalInChannel> inChans;
OwnedArray<DSoundInternalOutChannel> outChans;
WaitableEvent startEvent; WaitableEvent startEvent;
int bufferSizeSamples; int bufferSizeSamples;


+ 44
- 44
source/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp View File

@@ -316,7 +316,7 @@ String getDeviceID (IMMDevice* const device)
EDataFlow getDataFlow (const ComSmartPtr<IMMDevice>& device) EDataFlow getDataFlow (const ComSmartPtr<IMMDevice>& device)
{ {
EDataFlow flow = eRender; EDataFlow flow = eRender;
ComSmartPtr <IMMEndpoint> endPoint;
ComSmartPtr<IMMEndpoint> endPoint;
if (check (device.QueryInterface (endPoint))) if (check (device.QueryInterface (endPoint)))
(void) check (endPoint->GetDataFlow (&flow)); (void) check (endPoint->GetDataFlow (&flow));
@@ -338,7 +338,7 @@ void copyWavFormat (WAVEFORMATEXTENSIBLE& dest, const WAVEFORMATEX* const src) n
class WASAPIDeviceBase class WASAPIDeviceBase
{ {
public: public:
WASAPIDeviceBase (const ComSmartPtr <IMMDevice>& d, const bool exclusiveMode)
WASAPIDeviceBase (const ComSmartPtr<IMMDevice>& d, const bool exclusiveMode)
: device (d), : device (d),
sampleRate (0), sampleRate (0),
defaultSampleRate (0), defaultSampleRate (0),
@@ -352,7 +352,7 @@ public:
{ {
clientEvent = CreateEvent (0, false, false, _T("JuceWASAPI")); clientEvent = CreateEvent (0, false, false, _T("JuceWASAPI"));
ComSmartPtr <IAudioClient> tempClient (createClient());
ComSmartPtr<IAudioClient> tempClient (createClient());
if (tempClient == nullptr) if (tempClient == nullptr)
return; return;
@@ -453,17 +453,17 @@ public:
} }
//============================================================================== //==============================================================================
ComSmartPtr <IMMDevice> device;
ComSmartPtr <IAudioClient> client;
ComSmartPtr<IMMDevice> device;
ComSmartPtr<IAudioClient> client;
double sampleRate, defaultSampleRate; double sampleRate, defaultSampleRate;
int numChannels, actualNumChannels; int numChannels, actualNumChannels;
int minBufferSize, defaultBufferSize, latencySamples; int minBufferSize, defaultBufferSize, latencySamples;
DWORD mixFormatChannelMask; DWORD mixFormatChannelMask;
const bool useExclusiveMode; const bool useExclusiveMode;
Array <double> rates;
Array<double> rates;
HANDLE clientEvent; HANDLE clientEvent;
BigInteger channels; BigInteger channels;
Array <int> channelMaps;
Array<int> channelMaps;
UINT32 actualBufferSize; UINT32 actualBufferSize;
int bytesPerSample; int bytesPerSample;
bool sampleRateHasChanged; bool sampleRateHasChanged;
@@ -472,7 +472,7 @@ public:
private: private:
//============================================================================== //==============================================================================
class SessionEventCallback : public ComBaseClassHelper <IAudioSessionEvents>
class SessionEventCallback : public ComBaseClassHelper<IAudioSessionEvents>
{ {
public: public:
SessionEventCallback (WASAPIDeviceBase& d) : owner (d) {} SessionEventCallback (WASAPIDeviceBase& d) : owner (d) {}
@@ -498,8 +498,8 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SessionEventCallback) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SessionEventCallback)
}; };
ComSmartPtr <IAudioSessionControl> audioSessionControl;
ComSmartPtr <SessionEventCallback> sessionEventCallback;
ComSmartPtr<IAudioSessionControl> audioSessionControl;
ComSmartPtr<SessionEventCallback> sessionEventCallback;
void createSessionEventCallback() void createSessionEventCallback()
{ {
@@ -525,16 +525,13 @@ private:
} }
//============================================================================== //==============================================================================
const ComSmartPtr <IAudioClient> createClient()
ComSmartPtr<IAudioClient> createClient()
{ {
ComSmartPtr <IAudioClient> client;
ComSmartPtr<IAudioClient> client;
if (device != nullptr) if (device != nullptr)
{
HRESULT hr = device->Activate (__uuidof (IAudioClient), CLSCTX_INPROC_SERVER,
nullptr, (void**) client.resetAndGetPointerAddress());
logFailure (hr);
}
logFailure (device->Activate (__uuidof (IAudioClient), CLSCTX_INPROC_SERVER,
nullptr, (void**) client.resetAndGetPointerAddress()));
return client; return client;
} }
@@ -607,7 +604,7 @@ private:
class WASAPIInputDevice : public WASAPIDeviceBase class WASAPIInputDevice : public WASAPIDeviceBase
{ {
public: public:
WASAPIInputDevice (const ComSmartPtr <IMMDevice>& d, const bool exclusiveMode)
WASAPIInputDevice (const ComSmartPtr<IMMDevice>& d, const bool exclusiveMode)
: WASAPIDeviceBase (d, exclusiveMode), : WASAPIDeviceBase (d, exclusiveMode),
reservoir (1, 1) reservoir (1, 1)
{ {
@@ -635,11 +632,11 @@ public:
reservoir.reset(); reservoir.reset();
} }
template <class SourceType>
template<class SourceType>
void updateFormatWithType (SourceType*) void updateFormatWithType (SourceType*)
{ {
typedef AudioData::Pointer <AudioData::Float32, AudioData::NativeEndian, AudioData::NonInterleaved, AudioData::NonConst> NativeType;
converter = new AudioData::ConverterInstance <AudioData::Pointer <SourceType, AudioData::LittleEndian, AudioData::Interleaved, AudioData::Const>, NativeType> (actualNumChannels, 1);
typedef AudioData::Pointer<AudioData::Float32, AudioData::NativeEndian, AudioData::NonInterleaved, AudioData::NonConst> NativeType;
converter = new AudioData::ConverterInstance<AudioData::Pointer<SourceType, AudioData::LittleEndian, AudioData::Interleaved, AudioData::Const>, NativeType> (actualNumChannels, 1);
} }
void updateFormat (bool isFloat) void updateFormat (bool isFloat)
@@ -712,10 +709,10 @@ public:
} }
} }
ComSmartPtr <IAudioCaptureClient> captureClient;
ComSmartPtr<IAudioCaptureClient> captureClient;
MemoryBlock reservoir; MemoryBlock reservoir;
int reservoirSize, reservoirCapacity; int reservoirSize, reservoirCapacity;
ScopedPointer <AudioData::Converter> converter;
ScopedPointer<AudioData::Converter> converter;
private: private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WASAPIInputDevice) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WASAPIInputDevice)
@@ -725,7 +722,7 @@ private:
class WASAPIOutputDevice : public WASAPIDeviceBase class WASAPIOutputDevice : public WASAPIDeviceBase
{ {
public: public:
WASAPIOutputDevice (const ComSmartPtr <IMMDevice>& d, const bool exclusiveMode)
WASAPIOutputDevice (const ComSmartPtr<IMMDevice>& d, const bool exclusiveMode)
: WASAPIDeviceBase (d, exclusiveMode) : WASAPIDeviceBase (d, exclusiveMode)
{ {
} }
@@ -747,11 +744,11 @@ public:
renderClient = nullptr; renderClient = nullptr;
} }
template <class DestType>
template<class DestType>
void updateFormatWithType (DestType*) void updateFormatWithType (DestType*)
{ {
typedef AudioData::Pointer <AudioData::Float32, AudioData::NativeEndian, AudioData::NonInterleaved, AudioData::Const> NativeType;
converter = new AudioData::ConverterInstance <NativeType, AudioData::Pointer <DestType, AudioData::LittleEndian, AudioData::Interleaved, AudioData::NonConst> > (1, actualNumChannels);
typedef AudioData::Pointer<AudioData::Float32, AudioData::NativeEndian, AudioData::NonInterleaved, AudioData::Const> NativeType;
converter = new AudioData::ConverterInstance<NativeType, AudioData::Pointer<DestType, AudioData::LittleEndian, AudioData::Interleaved, AudioData::NonConst> > (1, actualNumChannels);
} }
void updateFormat (bool isFloat) void updateFormat (bool isFloat)
@@ -801,8 +798,8 @@ public:
} }
} }
ComSmartPtr <IAudioRenderClient> renderClient;
ScopedPointer <AudioData::Converter> converter;
ComSmartPtr<IAudioRenderClient> renderClient;
ScopedPointer<AudioData::Converter> converter;
private: private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WASAPIOutputDevice) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WASAPIOutputDevice)
@@ -839,7 +836,7 @@ public:
bool initialise() bool initialise()
{ {
latencyIn = latencyOut = 0; latencyIn = latencyOut = 0;
Array <double> ratesIn, ratesOut;
Array<double> ratesIn, ratesOut;
if (createDevices()) if (createDevices())
{ {
@@ -1087,7 +1084,7 @@ public:
const ScopedLock sl (startStopLock); const ScopedLock sl (startStopLock);
if (isStarted) if (isStarted)
callback->audioDeviceIOCallback (const_cast <const float**> (inputBuffers), numInputBuffers,
callback->audioDeviceIOCallback (const_cast<const float**> (inputBuffers), numInputBuffers,
outputBuffers, numOutputBuffers, bufferSize); outputBuffers, numOutputBuffers, bufferSize);
else else
outs.clear(); outs.clear();
@@ -1095,7 +1092,7 @@ public:
if (outputDevice != nullptr) if (outputDevice != nullptr)
{ {
outputDevice->copyBuffers (const_cast <const float**> (outputBuffers), numOutputBuffers, bufferSize, *this);
outputDevice->copyBuffers (const_cast<const float**> (outputBuffers), numOutputBuffers, bufferSize, *this);
if (outputDevice->sampleRateHasChanged) if (outputDevice->sampleRateHasChanged)
{ {
@@ -1124,8 +1121,8 @@ private:
double defaultSampleRate; double defaultSampleRate;
int minBufferSize, defaultBufferSize; int minBufferSize, defaultBufferSize;
int latencyIn, latencyOut; int latencyIn, latencyOut;
Array <double> sampleRates;
Array <int> bufferSizes;
Array<double> sampleRates;
Array<int> bufferSizes;
// Active state... // Active state...
bool isOpen_, isStarted; bool isOpen_, isStarted;
@@ -1141,11 +1138,11 @@ private:
//============================================================================== //==============================================================================
bool createDevices() bool createDevices()
{ {
ComSmartPtr <IMMDeviceEnumerator> enumerator;
ComSmartPtr<IMMDeviceEnumerator> enumerator;
if (! check (enumerator.CoCreateInstance (__uuidof (MMDeviceEnumerator)))) if (! check (enumerator.CoCreateInstance (__uuidof (MMDeviceEnumerator))))
return false; return false;
ComSmartPtr <IMMDeviceCollection> deviceCollection;
ComSmartPtr<IMMDeviceCollection> deviceCollection;
if (! check (enumerator->EnumAudioEndpoints (eAll, DEVICE_STATE_ACTIVE, deviceCollection.resetAndGetPointerAddress()))) if (! check (enumerator->EnumAudioEndpoints (eAll, DEVICE_STATE_ACTIVE, deviceCollection.resetAndGetPointerAddress())))
return false; return false;
@@ -1155,7 +1152,7 @@ private:
for (UINT32 i = 0; i < numDevices; ++i) for (UINT32 i = 0; i < numDevices; ++i)
{ {
ComSmartPtr <IMMDevice> device;
ComSmartPtr<IMMDevice> device;
if (! check (deviceCollection->Item (i, device.resetAndGetPointerAddress()))) if (! check (deviceCollection->Item (i, device.resetAndGetPointerAddress())))
continue; continue;
@@ -1255,9 +1252,12 @@ public:
int getIndexOfDevice (AudioIODevice* device, bool asInput) const int getIndexOfDevice (AudioIODevice* device, bool asInput) const
{ {
jassert (hasScanned); // need to call scanForDevices() before doing this jassert (hasScanned); // need to call scanForDevices() before doing this
WASAPIAudioIODevice* const d = dynamic_cast <WASAPIAudioIODevice*> (device);
return d == nullptr ? -1 : (asInput ? inputDeviceIds.indexOf (d->inputDeviceId)
: outputDeviceIds.indexOf (d->outputDeviceId));
if (WASAPIAudioIODevice* const d = dynamic_cast<WASAPIAudioIODevice*> (device))
return asInput ? inputDeviceIds.indexOf (d->inputDeviceId)
: outputDeviceIds.indexOf (d->outputDeviceId);
return -1;
} }
bool hasSeparateInputsAndOutputs() const { return true; } bool hasSeparateInputsAndOutputs() const { return true; }
@@ -1301,7 +1301,7 @@ private:
{ {
public: public:
ChangeNotificationClient (WASAPIAudioIODeviceType& d) ChangeNotificationClient (WASAPIAudioIODeviceType& d)
: ComBaseClassHelper <IMMNotificationClient> (0), device (d) {}
: ComBaseClassHelper<IMMNotificationClient> (0), device (d) {}
HRESULT STDMETHODCALLTYPE OnDeviceAdded (LPCWSTR) { return notify(); } HRESULT STDMETHODCALLTYPE OnDeviceAdded (LPCWSTR) { return notify(); }
HRESULT STDMETHODCALLTYPE OnDeviceRemoved (LPCWSTR) { return notify(); } HRESULT STDMETHODCALLTYPE OnDeviceRemoved (LPCWSTR) { return notify(); }
@@ -1360,7 +1360,7 @@ private:
const String defaultRenderer (getDefaultEndpoint (enumerator, false)); const String defaultRenderer (getDefaultEndpoint (enumerator, false));
const String defaultCapture (getDefaultEndpoint (enumerator, true)); const String defaultCapture (getDefaultEndpoint (enumerator, true));
ComSmartPtr <IMMDeviceCollection> deviceCollection;
ComSmartPtr<IMMDeviceCollection> deviceCollection;
UINT32 numDevices = 0; UINT32 numDevices = 0;
if (! (check (enumerator->EnumAudioEndpoints (eAll, DEVICE_STATE_ACTIVE, deviceCollection.resetAndGetPointerAddress())) if (! (check (enumerator->EnumAudioEndpoints (eAll, DEVICE_STATE_ACTIVE, deviceCollection.resetAndGetPointerAddress()))
@@ -1369,7 +1369,7 @@ private:
for (UINT32 i = 0; i < numDevices; ++i) for (UINT32 i = 0; i < numDevices; ++i)
{ {
ComSmartPtr <IMMDevice> device;
ComSmartPtr<IMMDevice> device;
if (! check (deviceCollection->Item (i, device.resetAndGetPointerAddress()))) if (! check (deviceCollection->Item (i, device.resetAndGetPointerAddress())))
continue; continue;
@@ -1381,7 +1381,7 @@ private:
String name; String name;
{ {
ComSmartPtr <IPropertyStore> properties;
ComSmartPtr<IPropertyStore> properties;
if (! check (device->OpenPropertyStore (STGM_READ, properties.resetAndGetPointerAddress()))) if (! check (device->OpenPropertyStore (STGM_READ, properties.resetAndGetPointerAddress())))
continue; continue;


+ 0
- 1
source/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp View File

@@ -26,7 +26,6 @@ AudioSourcePlayer::AudioSourcePlayer()
: source (nullptr), : source (nullptr),
sampleRate (0), sampleRate (0),
bufferSize (0), bufferSize (0),
tempBuffer (2, 8),
lastGain (1.0f), lastGain (1.0f),
gain (1.0f) gain (1.0f)
{ {


+ 1
- 1
source/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp View File

@@ -49,6 +49,7 @@ namespace FlacNamespace
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wshadow" #pragma clang diagnostic ignored "-Wshadow"
#pragma clang diagnostic ignored "-Wdeprecated-register"
#endif #endif
#if JUCE_INTEL #if JUCE_INTEL
@@ -104,7 +105,6 @@ class FlacReader : public AudioFormatReader
public: public:
FlacReader (InputStream* const in) FlacReader (InputStream* const in)
: AudioFormatReader (in, flacFormatName), : AudioFormatReader (in, flacFormatName),
reservoir (2, 0),
reservoirStart (0), reservoirStart (0),
samplesInReservoir (0), samplesInReservoir (0),
scanningForLength (false) scanningForLength (false)


+ 2
- 3
source/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp View File

@@ -40,6 +40,7 @@ namespace OggVorbisNamespace
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wshadow" #pragma clang diagnostic ignored "-Wshadow"
#pragma clang diagnostic ignored "-Wdeprecated-register"
#endif #endif
#include "oggvorbis/vorbisenc.h" #include "oggvorbis/vorbisenc.h"
@@ -106,7 +107,6 @@ class OggReader : public AudioFormatReader
public: public:
OggReader (InputStream* const inp) OggReader (InputStream* const inp)
: AudioFormatReader (inp, oggFormatName), : AudioFormatReader (inp, oggFormatName),
reservoir (2, 4096),
reservoirStart (0), reservoirStart (0),
samplesInReservoir (0) samplesInReservoir (0)
{ {
@@ -140,8 +140,7 @@ public:
bitsPerSample = 16; bitsPerSample = 16;
sampleRate = info->rate; sampleRate = info->rate;
reservoir.setSize ((int) numChannels,
(int) jmin (lengthInSamples, (int64) reservoir.getNumSamples()));
reservoir.setSize ((int) numChannels, (int) jmin (lengthInSamples, (int64) 4096));
} }
} }


+ 9
- 7
source/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm View File

@@ -523,14 +523,16 @@ public:
for (int i = 0; i < numOutputBusses; ++i) for (int i = 0; i < numOutputBusses; ++i)
{ {
AudioBufferList* const abl = getAudioBufferListForBus(i);
abl->mNumberBuffers = numOutputBusChannels;
for (int j = 0; j < numOutputBusChannels; ++j)
if (AudioBufferList* const abl = getAudioBufferListForBus(i))
{ {
abl->mBuffers[j].mNumberChannels = 1;
abl->mBuffers[j].mDataByteSize = sizeof (float) * numSamples;
abl->mBuffers[j].mData = buffer.getWritePointer (i * numOutputBusChannels + j);
abl->mNumberBuffers = numOutputBusChannels;
for (int j = 0; j < numOutputBusChannels; ++j)
{
abl->mBuffers[j].mNumberChannels = 1;
abl->mBuffers[j].mDataByteSize = sizeof (float) * numSamples;
abl->mBuffers[j].mData = buffer.getWritePointer (i * numOutputBusChannels + j);
}
} }
} }


+ 4
- 4
source/modules/juce_audio_processors/format_types/juce_VST3Common.h View File

@@ -43,16 +43,16 @@ static bool doUIDsMatch (const Steinberg::TUID a, const Steinberg::TUID b) noexc
return std::memcmp (a, b, sizeof (Steinberg::TUID)) == 0; return std::memcmp (a, b, sizeof (Steinberg::TUID)) == 0;
} }
#define TEST_FOR_AND_RETURN_IF_VALID(ClassType) \
if (doUIDsMatch (iid, ClassType::iid)) \
#define TEST_FOR_AND_RETURN_IF_VALID(iidToTest, ClassType) \
if (doUIDsMatch (iidToTest, ClassType::iid)) \
{ \ { \
addRef(); \ addRef(); \
*obj = dynamic_cast<ClassType*> (this); \ *obj = dynamic_cast<ClassType*> (this); \
return Steinberg::kResultOk; \ return Steinberg::kResultOk; \
} }
#define TEST_FOR_COMMON_BASE_AND_RETURN_IF_VALID(CommonClassType, SourceClassType) \
if (doUIDsMatch (iid, CommonClassType::iid)) \
#define TEST_FOR_COMMON_BASE_AND_RETURN_IF_VALID(iidToTest, CommonClassType, SourceClassType) \
if (doUIDsMatch (iidToTest, CommonClassType::iid)) \
{ \ { \
addRef(); \ addRef(); \
*obj = (CommonClassType*) static_cast<SourceClassType*> (this); \ *obj = (CommonClassType*) static_cast<SourceClassType*> (this); \


+ 1
- 0
source/modules/juce_audio_processors/format_types/juce_VST3Headers.h View File

@@ -43,6 +43,7 @@
#pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Woverloaded-virtual" #pragma clang diagnostic ignored "-Woverloaded-virtual"
#pragma clang diagnostic ignored "-Wshadow" #pragma clang diagnostic ignored "-Wshadow"
#pragma clang diagnostic ignored "-Wdeprecated-register"
#endif #endif
/* These files come with the Steinberg VST3 SDK - to get them, you'll need to /* These files come with the Steinberg VST3 SDK - to get them, you'll need to


+ 8
- 8
source/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp View File

@@ -534,14 +534,14 @@ public:
return kResultOk; return kResultOk;
} }
TEST_FOR_AND_RETURN_IF_VALID (Vst::IComponentHandler)
TEST_FOR_AND_RETURN_IF_VALID (Vst::IComponentHandler2)
TEST_FOR_AND_RETURN_IF_VALID (Vst::IComponentHandler3)
TEST_FOR_AND_RETURN_IF_VALID (Vst::IContextMenuTarget)
TEST_FOR_AND_RETURN_IF_VALID (Vst::IHostApplication)
TEST_FOR_AND_RETURN_IF_VALID (Vst::IParamValueQueue)
TEST_FOR_AND_RETURN_IF_VALID (Vst::IUnitHandler)
TEST_FOR_COMMON_BASE_AND_RETURN_IF_VALID (FUnknown, Vst::IComponentHandler)
TEST_FOR_AND_RETURN_IF_VALID (iid, Vst::IComponentHandler)
TEST_FOR_AND_RETURN_IF_VALID (iid, Vst::IComponentHandler2)
TEST_FOR_AND_RETURN_IF_VALID (iid, Vst::IComponentHandler3)
TEST_FOR_AND_RETURN_IF_VALID (iid, Vst::IContextMenuTarget)
TEST_FOR_AND_RETURN_IF_VALID (iid, Vst::IHostApplication)
TEST_FOR_AND_RETURN_IF_VALID (iid, Vst::IParamValueQueue)
TEST_FOR_AND_RETURN_IF_VALID (iid, Vst::IUnitHandler)
TEST_FOR_COMMON_BASE_AND_RETURN_IF_VALID (iid, FUnknown, Vst::IComponentHandler)
*obj = nullptr; *obj = nullptr;
return kNotImplemented; return kNotImplemented;


+ 4
- 0
source/modules/juce_audio_processors/processors/juce_AudioPluginInstance.h View File

@@ -33,6 +33,10 @@
This derives from the AudioProcessor class, and adds some extra functionality This derives from the AudioProcessor class, and adds some extra functionality
that helps when wrapping dynamically loaded plugins. that helps when wrapping dynamically loaded plugins.
This class is not needed when writing plugins, and you should never need to derive
your own sub-classes from it. The plugin hosting classes use it internally and will
return AudioPluginInstance objects which wrap external plugins.
@see AudioProcessor, AudioPluginFormat @see AudioProcessor, AudioPluginFormat
*/ */
class JUCE_API AudioPluginInstance : public AudioProcessor class JUCE_API AudioPluginInstance : public AudioProcessor


+ 0
- 2
source/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp View File

@@ -923,9 +923,7 @@ void AudioProcessorGraph::Node::setParentGraph (AudioProcessorGraph* const graph
//============================================================================== //==============================================================================
AudioProcessorGraph::AudioProcessorGraph() AudioProcessorGraph::AudioProcessorGraph()
: lastNodeId (0), : lastNodeId (0),
renderingBuffers (1, 1),
currentAudioInputBuffer (nullptr), currentAudioInputBuffer (nullptr),
currentAudioOutputBuffer (1, 1),
currentMidiInputBuffer (nullptr) currentMidiInputBuffer (nullptr)
{ {
} }


+ 18
- 18
source/modules/juce_core/containers/juce_HashMap.h View File

@@ -117,7 +117,7 @@ public:
HashFunctionType hashFunction = HashFunctionType()) HashFunctionType hashFunction = HashFunctionType())
: hashFunctionToUse (hashFunction), totalNumItems (0) : hashFunctionToUse (hashFunction), totalNumItems (0)
{ {
slots.insertMultiple (0, nullptr, numberOfSlots);
hashSlots.insertMultiple (0, nullptr, numberOfSlots);
} }
/** Destructor. */ /** Destructor. */
@@ -135,9 +135,9 @@ public:
{ {
const ScopedLockType sl (getLock()); const ScopedLockType sl (getLock());
for (int i = slots.size(); --i >= 0;)
for (int i = hashSlots.size(); --i >= 0;)
{ {
HashEntry* h = slots.getUnchecked(i);
HashEntry* h = hashSlots.getUnchecked(i);
while (h != nullptr) while (h != nullptr)
{ {
@@ -145,7 +145,7 @@ public:
h = h->nextEntry; h = h->nextEntry;
} }
slots.set (i, nullptr);
hashSlots.set (i, nullptr);
} }
totalNumItems = 0; totalNumItems = 0;
@@ -166,7 +166,7 @@ public:
{ {
const ScopedLockType sl (getLock()); const ScopedLockType sl (getLock());
for (const HashEntry* entry = slots.getUnchecked (generateHashFor (keyToLookFor)); entry != nullptr; entry = entry->nextEntry)
for (const HashEntry* entry = hashSlots.getUnchecked (generateHashFor (keyToLookFor)); entry != nullptr; entry = entry->nextEntry)
if (entry->key == keyToLookFor) if (entry->key == keyToLookFor)
return entry->value; return entry->value;
@@ -179,7 +179,7 @@ public:
{ {
const ScopedLockType sl (getLock()); const ScopedLockType sl (getLock());
for (const HashEntry* entry = slots.getUnchecked (generateHashFor (keyToLookFor)); entry != nullptr; entry = entry->nextEntry)
for (const HashEntry* entry = hashSlots.getUnchecked (generateHashFor (keyToLookFor)); entry != nullptr; entry = entry->nextEntry)
if (entry->key == keyToLookFor) if (entry->key == keyToLookFor)
return true; return true;
@@ -192,7 +192,7 @@ public:
const ScopedLockType sl (getLock()); const ScopedLockType sl (getLock());
for (int i = getNumSlots(); --i >= 0;) for (int i = getNumSlots(); --i >= 0;)
for (const HashEntry* entry = slots.getUnchecked(i); entry != nullptr; entry = entry->nextEntry)
for (const HashEntry* entry = hashSlots.getUnchecked(i); entry != nullptr; entry = entry->nextEntry)
if (entry->value == valueToLookFor) if (entry->value == valueToLookFor)
return true; return true;
@@ -209,7 +209,7 @@ public:
const ScopedLockType sl (getLock()); const ScopedLockType sl (getLock());
const int hashIndex = generateHashFor (newKey); const int hashIndex = generateHashFor (newKey);
HashEntry* const firstEntry = slots.getUnchecked (hashIndex);
HashEntry* const firstEntry = hashSlots.getUnchecked (hashIndex);
for (HashEntry* entry = firstEntry; entry != nullptr; entry = entry->nextEntry) for (HashEntry* entry = firstEntry; entry != nullptr; entry = entry->nextEntry)
{ {
@@ -220,7 +220,7 @@ public:
} }
} }
slots.set (hashIndex, new HashEntry (newKey, newValue, firstEntry));
hashSlots.set (hashIndex, new HashEntry (newKey, newValue, firstEntry));
++totalNumItems; ++totalNumItems;
if (totalNumItems > (getNumSlots() * 3) / 2) if (totalNumItems > (getNumSlots() * 3) / 2)
@@ -232,7 +232,7 @@ public:
{ {
const ScopedLockType sl (getLock()); const ScopedLockType sl (getLock());
const int hashIndex = generateHashFor (keyToRemove); const int hashIndex = generateHashFor (keyToRemove);
HashEntry* entry = slots.getUnchecked (hashIndex);
HashEntry* entry = hashSlots.getUnchecked (hashIndex);
HashEntry* previous = nullptr; HashEntry* previous = nullptr;
while (entry != nullptr) while (entry != nullptr)
@@ -246,7 +246,7 @@ public:
if (previous != nullptr) if (previous != nullptr)
previous->nextEntry = entry; previous->nextEntry = entry;
else else
slots.set (hashIndex, entry);
hashSlots.set (hashIndex, entry);
--totalNumItems; --totalNumItems;
} }
@@ -265,7 +265,7 @@ public:
for (int i = getNumSlots(); --i >= 0;) for (int i = getNumSlots(); --i >= 0;)
{ {
HashEntry* entry = slots.getUnchecked(i);
HashEntry* entry = hashSlots.getUnchecked(i);
HashEntry* previous = nullptr; HashEntry* previous = nullptr;
while (entry != nullptr) while (entry != nullptr)
@@ -279,7 +279,7 @@ public:
if (previous != nullptr) if (previous != nullptr)
previous->nextEntry = entry; previous->nextEntry = entry;
else else
slots.set (i, entry);
hashSlots.set (i, entry);
--totalNumItems; --totalNumItems;
} }
@@ -301,7 +301,7 @@ public:
HashMap newTable (newNumberOfSlots); HashMap newTable (newNumberOfSlots);
for (int i = getNumSlots(); --i >= 0;) for (int i = getNumSlots(); --i >= 0;)
for (const HashEntry* entry = slots.getUnchecked(i); entry != nullptr; entry = entry->nextEntry)
for (const HashEntry* entry = hashSlots.getUnchecked(i); entry != nullptr; entry = entry->nextEntry)
newTable.set (entry->key, entry->value); newTable.set (entry->key, entry->value);
swapWith (newTable); swapWith (newTable);
@@ -313,7 +313,7 @@ public:
*/ */
inline int getNumSlots() const noexcept inline int getNumSlots() const noexcept
{ {
return slots.size();
return hashSlots.size();
} }
//============================================================================== //==============================================================================
@@ -324,7 +324,7 @@ public:
const ScopedLockType lock1 (getLock()); const ScopedLockType lock1 (getLock());
const typename OtherHashMapType::ScopedLockType lock2 (otherHashMap.getLock()); const typename OtherHashMapType::ScopedLockType lock2 (otherHashMap.getLock());
slots.swapWith (otherHashMap.slots);
hashSlots.swapWith (otherHashMap.hashSlots);
std::swap (totalNumItems, otherHashMap.totalNumItems); std::swap (totalNumItems, otherHashMap.totalNumItems);
} }
@@ -400,7 +400,7 @@ public:
if (index >= hashMap.getNumSlots()) if (index >= hashMap.getNumSlots())
return false; return false;
entry = hashMap.slots.getUnchecked (index++);
entry = hashMap.hashSlots.getUnchecked (index++);
} }
return true; return true;
@@ -437,7 +437,7 @@ private:
friend class Iterator; friend class Iterator;
HashFunctionType hashFunctionToUse; HashFunctionType hashFunctionToUse;
Array <HashEntry*> slots;
Array<HashEntry*> hashSlots;
int totalNumItems; int totalNumItems;
TypeOfCriticalSectionToUse lock; TypeOfCriticalSectionToUse lock;


+ 3
- 3
source/modules/juce_core/files/juce_File.cpp View File

@@ -355,7 +355,7 @@ File File::getChildFile (StringRef relativePath) const
if (isAbsolutePath (relativePath)) if (isAbsolutePath (relativePath))
return File (String (relativePath.text)); return File (String (relativePath.text));
if (relativePath.text[0] != '.')
if (relativePath[0] != '.')
return File (addTrailingSeparator (fullPath) + relativePath); return File (addTrailingSeparator (fullPath) + relativePath);
String path (fullPath); String path (fullPath);
@@ -368,11 +368,11 @@ File File::getChildFile (StringRef relativePath) const
while (relativePath[0] == '.') while (relativePath[0] == '.')
{ {
const juce_wchar secondChar = relativePath.text[1];
const juce_wchar secondChar = relativePath[1];
if (secondChar == '.') if (secondChar == '.')
{ {
const juce_wchar thirdChar = relativePath.text[2];
const juce_wchar thirdChar = relativePath[2];
if (thirdChar == 0 || thirdChar == separator) if (thirdChar == 0 || thirdChar == separator)
{ {


+ 20
- 20
source/modules/juce_core/misc/juce_WindowsRegistry.h View File

@@ -35,7 +35,7 @@
Contains some static helper functions for manipulating the MS Windows registry Contains some static helper functions for manipulating the MS Windows registry
(Only available on Windows, of course!) (Only available on Windows, of course!)
*/ */
class WindowsRegistry
class JUCE_API WindowsRegistry
{ {
public: public:
/** These values can be used to specify whether the 32- or 64-bit registry should be used. /** These values can be used to specify whether the 32- or 64-bit registry should be used.
@@ -59,48 +59,48 @@ public:
The path is a string for the entire path of a value in the registry, The path is a string for the entire path of a value in the registry,
e.g. "HKEY_CURRENT_USER\Software\foo\bar" e.g. "HKEY_CURRENT_USER\Software\foo\bar"
*/ */
static String getValue (const String& regValuePath,
const String& defaultValue = String::empty,
WoW64Mode mode = WoW64_Default);
static String JUCE_CALLTYPE getValue (const String& regValuePath,
const String& defaultValue = String::empty,
WoW64Mode mode = WoW64_Default);
/** Reads a binary block from the registry. /** Reads a binary block from the registry.
The path is a string for the entire path of a value in the registry, The path is a string for the entire path of a value in the registry,
e.g. "HKEY_CURRENT_USER\Software\foo\bar" e.g. "HKEY_CURRENT_USER\Software\foo\bar"
@returns a DWORD indicating the type of the key. @returns a DWORD indicating the type of the key.
*/ */
static uint32 getBinaryValue (const String& regValuePath, MemoryBlock& resultData, WoW64Mode mode = WoW64_Default);
static uint32 JUCE_CALLTYPE getBinaryValue (const String& regValuePath, MemoryBlock& resultData, WoW64Mode mode = WoW64_Default);
/** Sets a registry value as a string. /** Sets a registry value as a string.
This will take care of creating any groups needed to get to the given registry value. This will take care of creating any groups needed to get to the given registry value.
*/ */
static bool setValue (const String& regValuePath, const String& value, WoW64Mode mode = WoW64_Default);
static bool JUCE_CALLTYPE setValue (const String& regValuePath, const String& value, WoW64Mode mode = WoW64_Default);
/** Sets a registry value as a DWORD. /** Sets a registry value as a DWORD.
This will take care of creating any groups needed to get to the given registry value. This will take care of creating any groups needed to get to the given registry value.
*/ */
static bool setValue (const String& regValuePath, uint32 value, WoW64Mode mode = WoW64_Default);
static bool JUCE_CALLTYPE setValue (const String& regValuePath, uint32 value, WoW64Mode mode = WoW64_Default);
/** Sets a registry value as a QWORD. /** Sets a registry value as a QWORD.
This will take care of creating any groups needed to get to the given registry value. This will take care of creating any groups needed to get to the given registry value.
*/ */
static bool setValue (const String& regValuePath, uint64 value, WoW64Mode mode = WoW64_Default);
static bool JUCE_CALLTYPE setValue (const String& regValuePath, uint64 value, WoW64Mode mode = WoW64_Default);
/** Sets a registry value as a binary block. /** Sets a registry value as a binary block.
This will take care of creating any groups needed to get to the given registry value. This will take care of creating any groups needed to get to the given registry value.
*/ */
static bool setValue (const String& regValuePath, const MemoryBlock& value, WoW64Mode mode = WoW64_Default);
static bool JUCE_CALLTYPE setValue (const String& regValuePath, const MemoryBlock& value, WoW64Mode mode = WoW64_Default);
/** Returns true if the given value exists in the registry. */ /** Returns true if the given value exists in the registry. */
static bool valueExists (const String& regValuePath, WoW64Mode mode = WoW64_Default);
static bool JUCE_CALLTYPE valueExists (const String& regValuePath, WoW64Mode mode = WoW64_Default);
/** Returns true if the given key exists in the registry. */ /** Returns true if the given key exists in the registry. */
static bool keyExists (const String& regValuePath, WoW64Mode mode = WoW64_Default);
static bool JUCE_CALLTYPE keyExists (const String& regValuePath, WoW64Mode mode = WoW64_Default);
/** Deletes a registry value. */ /** Deletes a registry value. */
static void deleteValue (const String& regValuePath, WoW64Mode mode = WoW64_Default);
static void JUCE_CALLTYPE deleteValue (const String& regValuePath, WoW64Mode mode = WoW64_Default);
/** Deletes a registry key (which is registry-talk for 'folder'). */ /** Deletes a registry key (which is registry-talk for 'folder'). */
static void deleteKey (const String& regKeyPath, WoW64Mode mode = WoW64_Default);
static void JUCE_CALLTYPE deleteKey (const String& regKeyPath, WoW64Mode mode = WoW64_Default);
/** Creates a file association in the registry. /** Creates a file association in the registry.
@@ -119,13 +119,13 @@ public:
association in HKEY_CURRENT_USER. association in HKEY_CURRENT_USER.
@param mode the WoW64 mode to use for choosing the database @param mode the WoW64 mode to use for choosing the database
*/ */
static bool registerFileAssociation (const String& fileExtension,
const String& symbolicDescription,
const String& fullDescription,
const File& targetExecutable,
int iconResourceNumber,
bool registerForCurrentUserOnly,
WoW64Mode mode = WoW64_Default);
static bool JUCE_CALLTYPE registerFileAssociation (const String& fileExtension,
const String& symbolicDescription,
const String& fullDescription,
const File& targetExecutable,
int iconResourceNumber,
bool registerForCurrentUserOnly,
WoW64Mode mode = WoW64_Default);
// DEPRECATED: use the other methods with a WoW64Mode parameter of WoW64_64bit instead. // DEPRECATED: use the other methods with a WoW64Mode parameter of WoW64_64bit instead.
JUCE_DEPRECATED (static String getValueWow64 (const String&, const String& defaultValue = String::empty)); JUCE_DEPRECATED (static String getValueWow64 (const String&, const String& defaultValue = String::empty));


+ 12
- 7
source/modules/juce_core/native/juce_linux_SystemStats.cpp View File

@@ -42,11 +42,6 @@ String SystemStats::getOperatingSystemName()
return "Linux"; return "Linux";
} }
String SystemStats::getDeviceDescription()
{
return String();
}
bool SystemStats::isOperatingSystem64Bit() bool SystemStats::isOperatingSystem64Bit()
{ {
#if JUCE_64BIT #if JUCE_64BIT
@@ -66,16 +61,26 @@ namespace LinuxStatsHelpers
File ("/proc/cpuinfo").readLines (lines); File ("/proc/cpuinfo").readLines (lines);
for (int i = lines.size(); --i >= 0;) // (NB - it's important that this runs in reverse order) for (int i = lines.size(); --i >= 0;) // (NB - it's important that this runs in reverse order)
if (lines[i].startsWithIgnoreCase (key))
if (lines[i].upToFirstOccurrenceOf (":", false, false).trim().equalsIgnoreCase (key))
return lines[i].fromFirstOccurrenceOf (":", false, false).trim(); return lines[i].fromFirstOccurrenceOf (":", false, false).trim();
return String(); return String();
} }
} }
String SystemStats::getDeviceDescription()
{
return LinuxStatsHelpers::getCpuInfo ("Hardware");
}
String SystemStats::getCpuVendor() String SystemStats::getCpuVendor()
{ {
return LinuxStatsHelpers::getCpuInfo ("vendor_id");
String v (LinuxStatsHelpers::getCpuInfo ("vendor_id"));
if (v.isEmpty())
v = LinuxStatsHelpers::getCpuInfo ("model name");
return v;
} }
int SystemStats::getCpuSpeedInMegaherz() int SystemStats::getCpuSpeedInMegaherz()


+ 1
- 1
source/modules/juce_core/native/juce_mac_Network.mm View File

@@ -270,7 +270,7 @@ private:
addMethod (@selector (connection:didReceiveResponse:), didReceiveResponse, "v@:@@"); addMethod (@selector (connection:didReceiveResponse:), didReceiveResponse, "v@:@@");
addMethod (@selector (connection:didFailWithError:), didFailWithError, "v@:@@"); addMethod (@selector (connection:didFailWithError:), didFailWithError, "v@:@@");
addMethod (@selector (connection:didReceiveData:), didReceiveData, "v@:@@"); addMethod (@selector (connection:didReceiveData:), didReceiveData, "v@:@@");
addMethod (@selector (connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:totalBytesExpectedToWrite:),
addMethod (@selector (connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:),
connectionDidSendBodyData, "v@:@iii"); connectionDidSendBodyData, "v@:@iii");
addMethod (@selector (connectionDidFinishLoading:), connectionDidFinishLoading, "v@:@"); addMethod (@selector (connectionDidFinishLoading:), connectionDidFinishLoading, "v@:@");
addMethod (@selector (connection:willSendRequest:redirectResponse:), willSendRequest, "@@:@@"); addMethod (@selector (connection:willSendRequest:redirectResponse:), willSendRequest, "@@:@@");


+ 5
- 1
source/modules/juce_core/native/juce_mac_Threads.mm View File

@@ -31,13 +31,17 @@
live in juce_posix_SharedCode.h! live in juce_posix_SharedCode.h!
*/ */
#if JUCE_IOS
bool isIOSAppActive = true;
#endif
//============================================================================== //==============================================================================
JUCE_API bool JUCE_CALLTYPE Process::isForegroundProcess() JUCE_API bool JUCE_CALLTYPE Process::isForegroundProcess()
{ {
#if JUCE_MAC #if JUCE_MAC
return [NSApp isActive]; return [NSApp isActive];
#else #else
return true; // xxx change this if more than one app is ever possible on iOS!
return isIOSAppActive;
#endif #endif
} }


+ 17
- 17
source/modules/juce_core/native/juce_win32_Registry.cpp View File

@@ -144,48 +144,48 @@ struct RegistryKeyWrapper
JUCE_DECLARE_NON_COPYABLE (RegistryKeyWrapper) JUCE_DECLARE_NON_COPYABLE (RegistryKeyWrapper)
}; };
uint32 WindowsRegistry::getBinaryValue (const String& regValuePath, MemoryBlock& result, WoW64Mode mode)
uint32 JUCE_CALLTYPE WindowsRegistry::getBinaryValue (const String& regValuePath, MemoryBlock& result, WoW64Mode mode)
{ {
return RegistryKeyWrapper::getBinaryValue (regValuePath, result, (DWORD) mode); return RegistryKeyWrapper::getBinaryValue (regValuePath, result, (DWORD) mode);
} }
String WindowsRegistry::getValue (const String& regValuePath, const String& defaultValue, WoW64Mode mode)
String JUCE_CALLTYPE WindowsRegistry::getValue (const String& regValuePath, const String& defaultValue, WoW64Mode mode)
{ {
return RegistryKeyWrapper::getValue (regValuePath, defaultValue, (DWORD) mode); return RegistryKeyWrapper::getValue (regValuePath, defaultValue, (DWORD) mode);
} }
bool WindowsRegistry::setValue (const String& regValuePath, const String& value, WoW64Mode mode)
bool JUCE_CALLTYPE WindowsRegistry::setValue (const String& regValuePath, const String& value, WoW64Mode mode)
{ {
return RegistryKeyWrapper::setValue (regValuePath, REG_SZ, value.toWideCharPointer(), return RegistryKeyWrapper::setValue (regValuePath, REG_SZ, value.toWideCharPointer(),
CharPointer_UTF16::getBytesRequiredFor (value.getCharPointer()), mode); CharPointer_UTF16::getBytesRequiredFor (value.getCharPointer()), mode);
} }
bool WindowsRegistry::setValue (const String& regValuePath, const uint32 value, WoW64Mode mode)
bool JUCE_CALLTYPE WindowsRegistry::setValue (const String& regValuePath, const uint32 value, WoW64Mode mode)
{ {
return RegistryKeyWrapper::setValue (regValuePath, REG_DWORD, &value, sizeof (value), (DWORD) mode); return RegistryKeyWrapper::setValue (regValuePath, REG_DWORD, &value, sizeof (value), (DWORD) mode);
} }
bool WindowsRegistry::setValue (const String& regValuePath, const uint64 value, WoW64Mode mode)
bool JUCE_CALLTYPE WindowsRegistry::setValue (const String& regValuePath, const uint64 value, WoW64Mode mode)
{ {
return RegistryKeyWrapper::setValue (regValuePath, REG_QWORD, &value, sizeof (value), (DWORD) mode); return RegistryKeyWrapper::setValue (regValuePath, REG_QWORD, &value, sizeof (value), (DWORD) mode);
} }
bool WindowsRegistry::setValue (const String& regValuePath, const MemoryBlock& value, WoW64Mode mode)
bool JUCE_CALLTYPE WindowsRegistry::setValue (const String& regValuePath, const MemoryBlock& value, WoW64Mode mode)
{ {
return RegistryKeyWrapper::setValue (regValuePath, REG_BINARY, value.getData(), value.getSize(), (DWORD) mode); return RegistryKeyWrapper::setValue (regValuePath, REG_BINARY, value.getData(), value.getSize(), (DWORD) mode);
} }
bool WindowsRegistry::valueExists (const String& regValuePath, WoW64Mode mode)
bool JUCE_CALLTYPE WindowsRegistry::valueExists (const String& regValuePath, WoW64Mode mode)
{ {
return RegistryKeyWrapper::valueExists (regValuePath, (DWORD) mode); return RegistryKeyWrapper::valueExists (regValuePath, (DWORD) mode);
} }
bool WindowsRegistry::keyExists (const String& regValuePath, WoW64Mode mode)
bool JUCE_CALLTYPE WindowsRegistry::keyExists (const String& regValuePath, WoW64Mode mode)
{ {
return RegistryKeyWrapper::keyExists (regValuePath, (DWORD) mode); return RegistryKeyWrapper::keyExists (regValuePath, (DWORD) mode);
} }
void WindowsRegistry::deleteValue (const String& regValuePath, WoW64Mode mode)
void JUCE_CALLTYPE WindowsRegistry::deleteValue (const String& regValuePath, WoW64Mode mode)
{ {
const RegistryKeyWrapper key (regValuePath, true, (DWORD) mode); const RegistryKeyWrapper key (regValuePath, true, (DWORD) mode);
@@ -193,7 +193,7 @@ void WindowsRegistry::deleteValue (const String& regValuePath, WoW64Mode mode)
RegDeleteValue (key.key, key.wideCharValueName); RegDeleteValue (key.key, key.wideCharValueName);
} }
void WindowsRegistry::deleteKey (const String& regKeyPath, WoW64Mode mode)
void JUCE_CALLTYPE WindowsRegistry::deleteKey (const String& regKeyPath, WoW64Mode mode)
{ {
const RegistryKeyWrapper key (regKeyPath, true, (DWORD) mode); const RegistryKeyWrapper key (regKeyPath, true, (DWORD) mode);
@@ -201,13 +201,13 @@ void WindowsRegistry::deleteKey (const String& regKeyPath, WoW64Mode mode)
RegDeleteKey (key.key, key.wideCharValueName); RegDeleteKey (key.key, key.wideCharValueName);
} }
bool WindowsRegistry::registerFileAssociation (const String& fileExtension,
const String& symbolicDescription,
const String& fullDescription,
const File& targetExecutable,
const int iconResourceNumber,
const bool registerForCurrentUserOnly,
WoW64Mode mode)
bool JUCE_CALLTYPE WindowsRegistry::registerFileAssociation (const String& fileExtension,
const String& symbolicDescription,
const String& fullDescription,
const File& targetExecutable,
const int iconResourceNumber,
const bool registerForCurrentUserOnly,
WoW64Mode mode)
{ {
const char* const root = registerForCurrentUserOnly ? "HKEY_CURRENT_USER\\Software\\Classes\\" const char* const root = registerForCurrentUserOnly ? "HKEY_CURRENT_USER\\Software\\Classes\\"
: "HKEY_CLASSES_ROOT\\"; : "HKEY_CLASSES_ROOT\\";


+ 7
- 1
source/modules/juce_core/native/juce_win32_Threads.cpp View File

@@ -555,7 +555,13 @@ bool ChildProcess::start (const String& command, int streamFlags)
bool ChildProcess::start (const StringArray& args, int streamFlags) bool ChildProcess::start (const StringArray& args, int streamFlags)
{ {
return start (args.joinIntoString (" "), streamFlags);
String escaped;
for (int i = 0; i < args.size(); ++i)
escaped << args[i].replace ("\"", "\\\"")
.replace (" ", "\\ ") << ' ';
return start (escaped.trim(), streamFlags);
} }
//============================================================================== //==============================================================================


+ 1
- 0
source/modules/juce_core/network/juce_URL.h View File

@@ -360,6 +360,7 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Upload) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Upload)
}; };
friend struct ContainerDeletePolicy<Upload>;
ReferenceCountedArray<Upload> filesToUpload; ReferenceCountedArray<Upload> filesToUpload;
URL (const String&, int); URL (const String&, int);


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

@@ -36,7 +36,7 @@
*/ */
#define JUCE_MAJOR_VERSION 3 #define JUCE_MAJOR_VERSION 3
#define JUCE_MINOR_VERSION 0 #define JUCE_MINOR_VERSION 0
#define JUCE_BUILDNUMBER 4
#define JUCE_BUILDNUMBER 5
/** Current Juce version number. /** Current Juce version number.


+ 3
- 0
source/modules/juce_core/text/juce_StringRef.h View File

@@ -101,6 +101,9 @@ public:
/** Returns the number of characters in the string. */ /** Returns the number of characters in the string. */
int length() const noexcept { return (int) text.length(); } int length() const noexcept { return (int) text.length(); }
/** Retrieves a character by index. */
juce_wchar operator[] (int index) const noexcept { return text[index]; }
/** Compares this StringRef with a String. */ /** Compares this StringRef with a String. */
bool operator== (const String& s) const noexcept { return text.compare (s.getCharPointer()) == 0; } bool operator== (const String& s) const noexcept { return text.compare (s.getCharPointer()) == 0; }
/** Compares this StringRef with a String. */ /** Compares this StringRef with a String. */


+ 1
- 0
source/modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp View File

@@ -38,6 +38,7 @@ namespace zlibNamespace
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wshadow" #pragma clang diagnostic ignored "-Wshadow"
#pragma clang diagnostic ignored "-Wdeprecated-register"
#endif #endif
#undef OS_CODE #undef OS_CODE


+ 1
- 1
source/modules/juce_core/zip/juce_ZipFile.cpp View File

@@ -452,7 +452,7 @@ public:
bool writeData (OutputStream& target, const int64 overallStartPosition) bool writeData (OutputStream& target, const int64 overallStartPosition)
{ {
MemoryOutputStream compressedData;
MemoryOutputStream compressedData ((size_t) file.getSize());
if (compressionLevel > 0) if (compressionLevel > 0)
{ {


+ 25
- 17
source/modules/juce_graphics/fonts/juce_Font.cpp View File

@@ -317,29 +317,37 @@ void Font::checkTypefaceSuitability()
} }
//============================================================================== //==============================================================================
const String& Font::getDefaultSansSerifFontName()
struct FontPlaceholderNames
{ {
static const String name ("<Sans-Serif>");
return name;
}
FontPlaceholderNames()
: sans ("<Sans-Serif>"),
serif ("<Serif>"),
mono ("<Monospaced>"),
regular ("<Regular>")
{
}
const String& Font::getDefaultSerifFontName()
{
static const String name ("<Serif>");
return name;
}
String sans, serif, mono, regular;
};
const String& Font::getDefaultMonospacedFontName()
const FontPlaceholderNames& getFontPlaceholderNames()
{ {
static const String name ("<Monospaced>");
return name;
static FontPlaceholderNames names;
return names;
} }
const String& Font::getDefaultStyle()
{
static const String style ("<Regular>");
return style;
}
#if JUCE_MSVC
// This is a workaround for the lack of thread-safety in MSVC's handling of function-local
// statics - if multiple threads all try to create the first Font object at the same time,
// it can cause a race-condition in creating these placeholder strings.
struct FontNamePreloader { FontNamePreloader() { getFontPlaceholderNames(); } };
static FontNamePreloader fnp;
#endif
const String& Font::getDefaultSansSerifFontName() { return getFontPlaceholderNames().sans; }
const String& Font::getDefaultSerifFontName() { return getFontPlaceholderNames().serif; }
const String& Font::getDefaultMonospacedFontName() { return getFontPlaceholderNames().mono; }
const String& Font::getDefaultStyle() { return getFontPlaceholderNames().regular; }
const String& Font::getTypefaceName() const noexcept { return font->typefaceName; } const String& Font::getTypefaceName() const noexcept { return font->typefaceName; }
const String& Font::getTypefaceStyle() const noexcept { return font->typefaceStyle; } const String& Font::getTypefaceStyle() const noexcept { return font->typefaceStyle; }


+ 1
- 1
source/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp View File

@@ -37,9 +37,9 @@ namespace jpeglibNamespace
#if JUCE_CLANG #if JUCE_CLANG
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wdeprecated-register"
#endif #endif
#define JPEG_INTERNALS #define JPEG_INTERNALS
#undef FAR #undef FAR
#include "jpglib/jpeglib.h" #include "jpglib/jpeglib.h"


+ 7
- 4
source/modules/juce_graphics/native/juce_RenderingHelpers.h View File

@@ -225,10 +225,13 @@ private:
hits.set (0); hits.set (0);
misses.set (0); misses.set (0);
return glyphs.getLast();
} }
return findLeastRecentlyUsedGlyph();
if (CachedGlyphType* g = findLeastRecentlyUsedGlyph())
return g;
addNewGlyphSlots (32);
return glyphs.getLast();
} }
void addNewGlyphSlots (int num) void addNewGlyphSlots (int num)
@@ -241,8 +244,8 @@ private:
CachedGlyphType* findLeastRecentlyUsedGlyph() const noexcept CachedGlyphType* findLeastRecentlyUsedGlyph() const noexcept
{ {
CachedGlyphType* oldest = glyphs.getLast();
int oldestCounter = oldest->lastAccessCount;
CachedGlyphType* oldest = nullptr;
int oldestCounter = std::numeric_limits<int>::max();
for (int i = glyphs.size() - 1; --i >= 0;) for (int i = glyphs.size() - 1; --i >= 0;)
{ {


+ 10
- 3
source/modules/juce_gui_basics/components/juce_Desktop.cpp View File

@@ -26,6 +26,7 @@ Desktop::Desktop()
: mouseSources (new MouseInputSource::SourceList()), : mouseSources (new MouseInputSource::SourceList()),
mouseClickCounter (0), mouseWheelCounter (0), mouseClickCounter (0), mouseWheelCounter (0),
kioskModeComponent (nullptr), kioskModeComponent (nullptr),
kioskModeReentrant (false),
allowedOrientations (allOrientations), allowedOrientations (allOrientations),
masterScaleFactor ((float) getDefaultMasterScale()) masterScaleFactor ((float) getDefaultMasterScale())
{ {
@@ -340,15 +341,21 @@ void Desktop::Displays::refresh()
//============================================================================== //==============================================================================
void Desktop::setKioskModeComponent (Component* componentToUse, const bool allowMenusAndBars) void Desktop::setKioskModeComponent (Component* componentToUse, const bool allowMenusAndBars)
{ {
if (kioskModeReentrant)
return;
const ScopedValueSetter<bool> setter (kioskModeReentrant, true, false);
if (kioskModeComponent != componentToUse) if (kioskModeComponent != componentToUse)
{ {
// agh! Don't delete or remove a component from the desktop while it's still the kiosk component! // agh! Don't delete or remove a component from the desktop while it's still the kiosk component!
jassert (kioskModeComponent == nullptr || ComponentPeer::getPeerFor (kioskModeComponent) != nullptr); jassert (kioskModeComponent == nullptr || ComponentPeer::getPeerFor (kioskModeComponent) != nullptr);
if (kioskModeComponent != nullptr)
if (Component* const oldKioskComp = kioskModeComponent)
{ {
setKioskComponent (kioskModeComponent, false, allowMenusAndBars);
kioskModeComponent->setBounds (kioskComponentOriginalBounds);
kioskModeComponent = nullptr; // (to make sure that isKioskMode() returns false when resizing the old one)
setKioskComponent (oldKioskComp, false, allowMenusAndBars);
oldKioskComp->setBounds (kioskComponentOriginalBounds);
} }
kioskModeComponent = componentToUse; kioskModeComponent = componentToUse;


+ 1
- 0
source/modules/juce_gui_basics/components/juce_Desktop.h View File

@@ -426,6 +426,7 @@ private:
Component* kioskModeComponent; Component* kioskModeComponent;
Rectangle<int> kioskComponentOriginalBounds; Rectangle<int> kioskComponentOriginalBounds;
bool kioskModeReentrant;
int allowedOrientations; int allowedOrientations;
float masterScaleFactor; float masterScaleFactor;


+ 16
- 0
source/modules/juce_gui_basics/native/juce_ios_Windowing.mm View File

@@ -22,6 +22,8 @@
============================================================================== ==============================================================================
*/ */
extern bool isIOSAppActive;
} // (juce namespace) } // (juce namespace)
@interface JuceAppStartupDelegate : NSObject <UIApplicationDelegate> @interface JuceAppStartupDelegate : NSObject <UIApplicationDelegate>
@@ -32,6 +34,8 @@
- (void) applicationWillTerminate: (UIApplication*) application; - (void) applicationWillTerminate: (UIApplication*) application;
- (void) applicationDidEnterBackground: (UIApplication*) application; - (void) applicationDidEnterBackground: (UIApplication*) application;
- (void) applicationWillEnterForeground: (UIApplication*) application; - (void) applicationWillEnterForeground: (UIApplication*) application;
- (void) applicationDidBecomeActive: (UIApplication*) application;
- (void) applicationWillResignActive: (UIApplication*) application;
@end @end
@@ -68,6 +72,18 @@
app->resumed(); app->resumed();
} }
- (void) applicationDidBecomeActive: (UIApplication*) application
{
(void) application;
isIOSAppActive = true;
}
- (void) applicationWillResignActive: (UIApplication*) application
{
(void) application;
isIOSAppActive = false;
}
@end @end
namespace juce namespace juce


+ 5
- 2
source/modules/juce_gui_basics/native/juce_linux_FileChooser.cpp View File

@@ -34,8 +34,12 @@ static bool exeIsAvailable (const char* const executable)
bool FileChooser::isPlatformDialogAvailable() bool FileChooser::isPlatformDialogAvailable()
{ {
#if JUCE_DISABLE_NATIVE_FILECHOOSERS
return false;
#else
static bool canUseNativeBox = exeIsAvailable ("zenity") || exeIsAvailable ("kdialog"); static bool canUseNativeBox = exeIsAvailable ("zenity") || exeIsAvailable ("kdialog");
return canUseNativeBox; return canUseNativeBox;
#endif
} }
void FileChooser::showPlatformDialog (Array<File>& results, void FileChooser::showPlatformDialog (Array<File>& results,
@@ -98,6 +102,7 @@ void FileChooser::showPlatformDialog (Array<File>& results,
args.add (startPath); args.add (startPath);
args.add (filters.replaceCharacter (';', ' ')); args.add (filters.replaceCharacter (';', ' '));
args.add ("2>/dev/null");
} }
else else
{ {
@@ -131,8 +136,6 @@ void FileChooser::showPlatformDialog (Array<File>& results,
args.add ("--filename=" + file.getFileName()); args.add ("--filename=" + file.getFileName());
} }
args.add ("2>/dev/null");
ChildProcess child; ChildProcess child;
if (child.start (args, ChildProcess::wantStdOut)) if (child.start (args, ChildProcess::wantStdOut))


+ 4
- 0
source/modules/juce_gui_basics/native/juce_mac_FileChooser.mm View File

@@ -198,7 +198,11 @@ void FileChooser::showPlatformDialog (Array<File>& results,
bool FileChooser::isPlatformDialogAvailable() bool FileChooser::isPlatformDialogAvailable()
{ {
#if JUCE_DISABLE_NATIVE_FILECHOOSERS
return false;
#else
return true; return true;
#endif
} }
#else #else


+ 4
- 8
source/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -476,7 +476,7 @@ public:
void toBehind (ComponentPeer* other) override void toBehind (ComponentPeer* other) override
{ {
NSViewComponentPeer* const otherPeer = dynamic_cast <NSViewComponentPeer*> (other);
NSViewComponentPeer* const otherPeer = dynamic_cast<NSViewComponentPeer*> (other);
jassert (otherPeer != nullptr); // wrong type of window? jassert (otherPeer != nullptr); // wrong type of window?
if (otherPeer != nullptr) if (otherPeer != nullptr)
@@ -487,7 +487,7 @@ public:
positioned: NSWindowBelow positioned: NSWindowBelow
relativeTo: otherPeer->view]; relativeTo: otherPeer->view];
} }
else
else if (component.isVisible())
{ {
[window orderWindow: NSWindowBelow [window orderWindow: NSWindowBelow
relativeTo: [otherPeer->window windowNumber]]; relativeTo: [otherPeer->window windowNumber]];
@@ -898,11 +898,7 @@ public:
NSRect constrainRect (NSRect r) NSRect constrainRect (NSRect r)
{ {
if (constrainer != nullptr
#if defined (MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
&& ([window styleMask] & NSFullScreenWindowMask) == 0
#endif
)
if (constrainer != nullptr && ! isKioskMode())
{ {
Rectangle<int> pos (convertToRectInt (flippedScreenRect (r))); Rectangle<int> pos (convertToRectInt (flippedScreenRect (r)));
Rectangle<int> original (convertToRectInt (flippedScreenRect ([window frame]))); Rectangle<int> original (convertToRectInt (flippedScreenRect ([window frame])));
@@ -1600,7 +1596,7 @@ private:
static NSRect firstRectForCharacterRange (id self, SEL, NSRange) static NSRect firstRectForCharacterRange (id self, SEL, NSRange)
{ {
if (NSViewComponentPeer* const owner = getOwner (self)) if (NSViewComponentPeer* const owner = getOwner (self))
if (Component* const comp = dynamic_cast <Component*> (owner->findCurrentTextInputTarget()))
if (Component* const comp = dynamic_cast<Component*> (owner->findCurrentTextInputTarget()))
return flippedScreenRect (makeNSRect (comp->getScreenBounds())); return flippedScreenRect (makeNSRect (comp->getScreenBounds()));
return NSZeroRect; return NSZeroRect;


+ 4
- 0
source/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp View File

@@ -120,7 +120,11 @@ namespace FileChooserHelpers
//============================================================================== //==============================================================================
bool FileChooser::isPlatformDialogAvailable() bool FileChooser::isPlatformDialogAvailable()
{ {
#if JUCE_DISABLE_NATIVE_FILECHOOSERS
return false;
#else
return true; return true;
#endif
} }
void FileChooser::showPlatformDialog (Array<File>& results, const String& title_, const File& currentFileOrDirectory, void FileChooser::showPlatformDialog (Array<File>& results, const String& title_, const File& currentFileOrDirectory,


+ 2
- 1
source/modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -2135,7 +2135,8 @@ private:
bool isConstrainedNativeWindow() const bool isConstrainedNativeWindow() const
{ {
return constrainer != nullptr return constrainer != nullptr
&& (styleFlags & (windowHasTitleBar | windowIsResizable)) == (windowHasTitleBar | windowIsResizable);
&& (styleFlags & (windowHasTitleBar | windowIsResizable)) == (windowHasTitleBar | windowIsResizable)
&& ! isKioskMode();
} }
Rectangle<int> getCurrentScaledBounds (float scale) const Rectangle<int> getCurrentScaledBounds (float scale) const


+ 18
- 6
source/modules/juce_gui_basics/widgets/juce_ComboBox.cpp View File

@@ -44,6 +44,8 @@ ComboBox::ComboBox (const String& name)
isButtonDown (false), isButtonDown (false),
separatorPending (false), separatorPending (false),
menuActive (false), menuActive (false),
scrollWheelEnabled (false),
mouseWheelAccumulator (0),
noChoicesMessage (TRANS("(no choices)")) noChoicesMessage (TRANS("(no choices)"))
{ {
setRepaintsOnMouseActivity (true); setRepaintsOnMouseActivity (true);
@@ -579,14 +581,24 @@ void ComboBox::mouseUp (const MouseEvent& e2)
void ComboBox::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel) void ComboBox::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
{ {
#if 0
// NB: this is far too irritating if enabled, because on scrollable pages containing
// comboboxes (e.g. introjucer settings pages), you can easily nudge them when trying to scroll
if (! menuActive && wheel.deltaY != 0)
nudgeSelectedItem (wheel.deltaY > 0 ? -1 : 1);
if (! menuActive && scrollWheelEnabled && e.eventComponent == this && wheel.deltaY != 0)
{
const int oldPos = (int) mouseWheelAccumulator;
mouseWheelAccumulator += wheel.deltaY * 5.0f;
const int delta = oldPos - (int) mouseWheelAccumulator;
if (delta != 0)
nudgeSelectedItem (delta);
}
else else
#endif
{
Component::mouseWheelMove (e, wheel); Component::mouseWheelMove (e, wheel);
}
}
void ComboBox::setScrollWheelEnabled (bool enabled) noexcept
{
scrollWheelEnabled = enabled;
} }
//============================================================================== //==============================================================================


+ 8
- 1
source/modules/juce_gui_basics/widgets/juce_ComboBox.h View File

@@ -313,6 +313,12 @@ public:
/** Gives the ComboBox a tooltip. */ /** Gives the ComboBox a tooltip. */
void setTooltip (const String& newTooltip) override; void setTooltip (const String& newTooltip) override;
/** This can be used to allow the scroll-wheel to nudge the chosen item.
By default it's disabled, and I'd recommend leaving it disabled if there's any
chance that the control might be inside a scrollable list or viewport.
*/
void setScrollWheelEnabled (bool enabled) noexcept;
//============================================================================== //==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the combo box. /** A set of colour IDs to use to change the colour of various aspects of the combo box.
@@ -410,7 +416,8 @@ private:
OwnedArray <ItemInfo> items; OwnedArray <ItemInfo> items;
Value currentId; Value currentId;
int lastCurrentId; int lastCurrentId;
bool isButtonDown, separatorPending, menuActive;
bool isButtonDown, separatorPending, menuActive, scrollWheelEnabled;
float mouseWheelAccumulator;
ListenerList <Listener> listeners; ListenerList <Listener> listeners;
ScopedPointer<Label> label; ScopedPointer<Label> label;
String textWhenNothingSelected, noChoicesMessage; String textWhenNothingSelected, noChoicesMessage;


+ 0
- 1
source/modules/juce_gui_basics/widgets/juce_Slider.h View File

@@ -620,7 +620,6 @@ public:
void setPopupMenuEnabled (bool menuEnabled); void setPopupMenuEnabled (bool menuEnabled);
/** This can be used to stop the mouse scroll-wheel from moving the slider. /** This can be used to stop the mouse scroll-wheel from moving the slider.
By default it's enabled. By default it's enabled.
*/ */
void setScrollWheelEnabled (bool enabled); void setScrollWheelEnabled (bool enabled);


+ 3
- 3
source/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.h View File

@@ -134,9 +134,9 @@ public:
bool deleteBackwards (bool moveInWholeWordSteps); bool deleteBackwards (bool moveInWholeWordSteps);
bool deleteForwards (bool moveInWholeWordSteps); bool deleteForwards (bool moveInWholeWordSteps);
bool deleteWhitespaceBackwardsToTabStop(); bool deleteWhitespaceBackwardsToTabStop();
bool copyToClipboard();
bool cutToClipboard();
bool pasteFromClipboard();
virtual bool copyToClipboard();
virtual bool cutToClipboard();
virtual bool pasteFromClipboard();
bool undo(); bool undo();
bool redo(); bool redo();


+ 4
- 1
source/modules/juce_gui_extra/misc/juce_SystemTrayIconComponent.h View File

@@ -30,7 +30,10 @@
//============================================================================== //==============================================================================
/** /**
On Windows and Linux only, this component sits in the taskbar tray as a small icon.
This component sits in the taskbar tray as a small icon.
(NB: The exact behaviour of this class will differ between OSes, and it
isn't fully implemented for all OSes)
To use it, just create one of these components, but don't attempt to make it To use it, just create one of these components, but don't attempt to make it
visible, add it to a parent, or put it on the desktop. visible, add it to a parent, or put it on the desktop.


+ 18
- 0
source/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm View File

@@ -34,6 +34,7 @@ struct DownloadClickDetectorClass : public ObjCClass <NSObject>
decidePolicyForNavigationAction, "v@:@@@@@"); decidePolicyForNavigationAction, "v@:@@@@@");
addMethod (@selector (webView:didFinishLoadForFrame:), didFinishLoadForFrame, "v@:@@"); addMethod (@selector (webView:didFinishLoadForFrame:), didFinishLoadForFrame, "v@:@@");
addMethod (@selector (webView:willCloseFrame:), willCloseFrame, "v@:@@"); addMethod (@selector (webView:willCloseFrame:), willCloseFrame, "v@:@@");
addMethod (@selector (webView:runOpenPanelForFileButtonWithResultListener:allowMultipleFiles:), runOpenPanel, "v@:@@", @encode (BOOL));
registerClass(); registerClass();
} }
@@ -66,6 +67,21 @@ private:
{ {
getOwner (self)->windowCloseRequest(); getOwner (self)->windowCloseRequest();
} }
static void runOpenPanel (id, SEL, WebView*, id<WebOpenPanelResultListener> resultListener, BOOL allowMultipleFiles)
{
FileChooser chooser (TRANS("Select the file you want to upload..."),
File::getSpecialLocation (File::userHomeDirectory), "*");
if (allowMultipleFiles ? chooser.browseForMultipleFilesToOpen()
: chooser.browseForFileToOpen())
{
const Array<File>& files = chooser.getResults();
for (int i = 0; i < files.size(); ++i)
[resultListener chooseFilename: juceStringToNS (files.getReference(i).getFullPathName())];
}
}
}; };
#else #else
@@ -146,6 +162,7 @@ public:
DownloadClickDetectorClass::setOwner (clickListener, owner); DownloadClickDetectorClass::setOwner (clickListener, owner);
[webView setPolicyDelegate: clickListener]; [webView setPolicyDelegate: clickListener];
[webView setFrameLoadDelegate: clickListener]; [webView setFrameLoadDelegate: clickListener];
[webView setUIDelegate: clickListener];
#else #else
webView = [[UIWebView alloc] initWithFrame: CGRectMake (0, 0, 1.0f, 1.0f)]; webView = [[UIWebView alloc] initWithFrame: CGRectMake (0, 0, 1.0f, 1.0f)];
setView (webView); setView (webView);
@@ -162,6 +179,7 @@ public:
#if JUCE_MAC #if JUCE_MAC
[webView setPolicyDelegate: nil]; [webView setPolicyDelegate: nil];
[webView setFrameLoadDelegate: nil]; [webView setFrameLoadDelegate: nil];
[webView setUIDelegate: nil];
[clickListener release]; [clickListener release];
#else #else
webView.delegate = nil; webView.delegate = nil;


+ 12
- 0
source/utils/CarlaString.hpp View File

@@ -558,6 +558,18 @@ public:
return fBuffer; return fBuffer;
} }


char operator[](const size_t pos) const noexcept
{
if (pos < fBufferLen)
return fBuffer[pos];

carla_safe_assert("pos < fBufferLen", __FILE__, __LINE__);

static char fallback;
fallback = '\0';
return fallback;
}

char& operator[](const size_t pos) noexcept char& operator[](const size_t pos) noexcept
{ {
if (pos < fBufferLen) if (pos < fBufferLen)


Loading…
Cancel
Save