@@ -22,6 +22,7 @@ | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#include <typeinfo> | |||||
#include "JuceDemoHeader.h" | #include "JuceDemoHeader.h" | ||||
//============================================================================== | //============================================================================== | ||||
@@ -558,19 +559,18 @@ AudioDeviceManager& MainAppWindow::getSharedAudioDeviceManager() | |||||
if (sharedAudioDeviceManager == nullptr) | if (sharedAudioDeviceManager == nullptr) | ||||
{ | { | ||||
sharedAudioDeviceManager = new AudioDeviceManager(); | sharedAudioDeviceManager = new AudioDeviceManager(); | ||||
RuntimePermissions::request ( | |||||
RuntimePermissions::recordAudio, | |||||
[] (bool wasGranted) { | |||||
int numInputChannels = wasGranted ? 2 : 0; | |||||
sharedAudioDeviceManager->initialise (numInputChannels, 2, nullptr, true, String(), nullptr); | |||||
} | |||||
); | |||||
RuntimePermissions::request (RuntimePermissions::recordAudio, runtimPermissionsCallback); | |||||
} | } | ||||
return *sharedAudioDeviceManager; | return *sharedAudioDeviceManager; | ||||
} | } | ||||
void MainAppWindow::runtimPermissionsCallback (bool wasGranted) | |||||
{ | |||||
int numInputChannels = wasGranted ? 2 : 0; | |||||
sharedAudioDeviceManager->initialise (numInputChannels, 2, nullptr, true, String(), nullptr); | |||||
} | |||||
MainAppWindow* MainAppWindow::getMainAppWindow() | MainAppWindow* MainAppWindow::getMainAppWindow() | ||||
{ | { | ||||
for (int i = TopLevelWindow::getNumTopLevelWindows(); --i >= 0;) | for (int i = TopLevelWindow::getNumTopLevelWindows(); --i >= 0;) | ||||
@@ -93,6 +93,9 @@ public: | |||||
}; | }; | ||||
private: | private: | ||||
static void runtimPermissionsCallback (bool wasGranted); | |||||
ScopedPointer<ContentComponent> contentComponent; | ScopedPointer<ContentComponent> contentComponent; | ||||
ScopedPointer<Component> taskbarIcon; | ScopedPointer<Component> taskbarIcon; | ||||
ScopedPointer<BubbleMessageComponent> currentBubbleMessage; | ScopedPointer<BubbleMessageComponent> currentBubbleMessage; | ||||
@@ -204,10 +204,11 @@ namespace FloatVectorHelpers | |||||
typedef float Type; | typedef float Type; | ||||
typedef float32x4_t ParallelType; | typedef float32x4_t ParallelType; | ||||
typedef uint32x4_t IntegerType; | typedef uint32x4_t IntegerType; | ||||
union signMaskUnion { ParallelType f; IntegerType i; }; | |||||
enum { numParallel = 4 }; | enum { numParallel = 4 }; | ||||
static forcedinline IntegerType toint (ParallelType v) noexcept { union { ParallelType f; IntegerType i; } u; u.f = v; return u.i; } | |||||
static forcedinline ParallelType toflt (IntegerType v) noexcept { union { ParallelType f; IntegerType i; } u; u.i = v; return u.f; } | |||||
static forcedinline IntegerType toint (ParallelType v) noexcept { signMaskUnion u; u.f = v; return u.i; } | |||||
static forcedinline ParallelType toflt (IntegerType v) noexcept { signMaskUnion u; u.i = v; return u.f; } | |||||
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); } | ||||
@@ -235,10 +236,11 @@ namespace FloatVectorHelpers | |||||
typedef double Type; | typedef double Type; | ||||
typedef double ParallelType; | typedef double ParallelType; | ||||
typedef uint64 IntegerType; | typedef uint64 IntegerType; | ||||
union signMaskUnion { ParallelType f; IntegerType i; }; | |||||
enum { numParallel = 1 }; | enum { numParallel = 1 }; | ||||
static forcedinline IntegerType toint (ParallelType v) noexcept { union { ParallelType f; IntegerType i; } u; u.f = v; return u.i; } | |||||
static forcedinline ParallelType toflt (IntegerType v) noexcept { union { ParallelType f; IntegerType i; } u; u.i = v; return u.f; } | |||||
static forcedinline IntegerType toint (ParallelType v) noexcept { signMaskUnion u; u.f = v; return u.i; } | |||||
static forcedinline ParallelType toflt (IntegerType v) noexcept { signMaskUnion u; u.i = v; return u.f; } | |||||
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; } | ||||
@@ -346,6 +348,9 @@ namespace FloatVectorHelpers | |||||
#define JUCE_LOAD_SRC1_SRC2_DEST(src1Load, src2Load, dstLoad) const Mode::ParallelType d = dstLoad (dest), s1 = src1Load (src1), s2 = src2Load (src2); | #define JUCE_LOAD_SRC1_SRC2_DEST(src1Load, src2Load, dstLoad) const Mode::ParallelType d = dstLoad (dest), s1 = src1Load (src1), s2 = src2Load (src2); | ||||
#define JUCE_LOAD_SRC_DEST(srcLoad, dstLoad) const Mode::ParallelType d = dstLoad (dest), s = srcLoad (src); | #define JUCE_LOAD_SRC_DEST(srcLoad, dstLoad) const Mode::ParallelType d = dstLoad (dest), s = srcLoad (src); | ||||
union signMask32 { float f; uint32 i; }; | |||||
union signMask64 { double d; uint64 i; }; | |||||
#if JUCE_USE_SSE_INTRINSICS || JUCE_USE_ARM_NEON | #if JUCE_USE_SSE_INTRINSICS || JUCE_USE_ARM_NEON | ||||
template<int typeSize> struct ModeType { typedef BasicOps32 Mode; }; | template<int typeSize> struct ModeType { typedef BasicOps32 Mode; }; | ||||
template<> struct ModeType<8> { typedef BasicOps64 Mode; }; | template<> struct ModeType<8> { typedef BasicOps64 Mode; }; | ||||
@@ -806,7 +811,7 @@ void FloatVectorOperations::abs (float* dest, const float* src, int num) noexcep | |||||
#if JUCE_USE_VDSP_FRAMEWORK | #if JUCE_USE_VDSP_FRAMEWORK | ||||
vDSP_vabs ((float*) src, 1, dest, 1, (vDSP_Length) num); | vDSP_vabs ((float*) src, 1, dest, 1, (vDSP_Length) num); | ||||
#else | #else | ||||
union { float f; uint32 i; } signMask; | |||||
FloatVectorHelpers::signMask32 signMask; | |||||
signMask.i = 0x7fffffffUL; | signMask.i = 0x7fffffffUL; | ||||
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = fabsf (src[i]), Mode::bit_and (s, mask), | JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = fabsf (src[i]), Mode::bit_and (s, mask), | ||||
JUCE_LOAD_SRC, JUCE_INCREMENT_SRC_DEST, | JUCE_LOAD_SRC, JUCE_INCREMENT_SRC_DEST, | ||||
@@ -821,7 +826,7 @@ void FloatVectorOperations::abs (double* dest, const double* src, int num) noexc | |||||
#if JUCE_USE_VDSP_FRAMEWORK | #if JUCE_USE_VDSP_FRAMEWORK | ||||
vDSP_vabsD ((double*) src, 1, dest, 1, (vDSP_Length) num); | vDSP_vabsD ((double*) src, 1, dest, 1, (vDSP_Length) num); | ||||
#else | #else | ||||
union {double d; uint64 i;} signMask; | |||||
FloatVectorHelpers::signMask64 signMask; | |||||
signMask.i = 0x7fffffffffffffffULL; | signMask.i = 0x7fffffffffffffffULL; | ||||
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = fabs (src[i]), Mode::bit_and (s, mask), | JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = fabs (src[i]), Mode::bit_and (s, mask), | ||||
@@ -41,11 +41,14 @@ | |||||
* before #including this file, otherwise SIZE_MAX might not be defined | * before #including this file, otherwise SIZE_MAX might not be defined | ||||
*/ | */ | ||||
#include <limits.h> /* for SIZE_MAX */ | |||||
#if HAVE_STDINT_H | |||||
#include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */ | |||||
#endif | |||||
#include <stdlib.h> /* for size_t, malloc(), etc */ | |||||
// JUCE: removed as JUCE already includes standard headers and including | |||||
// these in FlacNamespace will cause problems | |||||
//#include <limits.h> /* for SIZE_MAX */ | |||||
//#if HAVE_STDINT_H | |||||
//#include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */ | |||||
//#endif | |||||
//#include <stdlib.h> /* for size_t, malloc(), etc */ | |||||
#include "compat.h" | #include "compat.h" | ||||
#ifndef SIZE_MAX | #ifndef SIZE_MAX | ||||
@@ -35,7 +35,10 @@ | |||||
/* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */ | /* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */ | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
#include <assert.h> | |||||
// JUCE: removed as JUCE already includes standard headers and including | |||||
// these in FlacNamespace will cause problems | |||||
//#include <assert.h> | |||||
#define FLAC__ASSERT(x) assert(x) | #define FLAC__ASSERT(x) assert(x) | ||||
#define FLAC__ASSERT_DECLARATION(x) x | #define FLAC__ASSERT_DECLARATION(x) x | ||||
#else | #else | ||||
@@ -34,7 +34,10 @@ | |||||
#define FLAC__CALLBACK_H | #define FLAC__CALLBACK_H | ||||
#include "ordinals.h" | #include "ordinals.h" | ||||
#include <stdlib.h> /* for size_t */ | |||||
// JUCE: removed as JUCE already includes this and including stdlib | |||||
// in FlacNamespace will cause problems | |||||
//#include <stdlib.h> | |||||
/** \file include/FLAC/callback.h | /** \file include/FLAC/callback.h | ||||
* | * | ||||
@@ -39,15 +39,7 @@ | |||||
#ifndef FLAC__SHARE__COMPAT_H | #ifndef FLAC__SHARE__COMPAT_H | ||||
#define FLAC__SHARE__COMPAT_H | #define FLAC__SHARE__COMPAT_H | ||||
#if defined _WIN32 && !defined __CYGWIN__ | |||||
/* where MSVC puts unlink() */ | |||||
# include <io.h> | |||||
#else | |||||
# include <unistd.h> | |||||
#endif | |||||
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ | #if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ | ||||
#include <sys/types.h> /* for off_t */ | |||||
#define FLAC__off_t __int64 /* use this instead of off_t to fix the 2 GB limit */ | #define FLAC__off_t __int64 /* use this instead of off_t to fix the 2 GB limit */ | ||||
#if !defined __MINGW32__ | #if !defined __MINGW32__ | ||||
#define fseeko _fseeki64 | #define fseeko _fseeki64 | ||||
@@ -62,11 +54,6 @@ | |||||
#define FLAC__off_t off_t | #define FLAC__off_t off_t | ||||
#endif | #endif | ||||
#if HAVE_INTTYPES_H | |||||
#define __STDC_FORMAT_MACROS | |||||
#include <inttypes.h> | |||||
#endif | |||||
#if defined(_MSC_VER) | #if defined(_MSC_VER) | ||||
#define strtoll _strtoi64 | #define strtoll _strtoi64 | ||||
#define strtoull _strtoui64 | #define strtoull _strtoui64 | ||||
@@ -95,33 +82,13 @@ | |||||
#define FLAC__STRNCASECMP strncasecmp | #define FLAC__STRNCASECMP strncasecmp | ||||
#endif | #endif | ||||
#if defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ || defined __EMX__ | |||||
#include <io.h> /* for _setmode(), chmod() */ | |||||
#include <fcntl.h> /* for _O_BINARY */ | |||||
#else | |||||
#include <unistd.h> /* for chown(), unlink() */ | |||||
#endif | |||||
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ | |||||
#if defined __BORLANDC__ | |||||
#include <utime.h> /* for utime() */ | |||||
#else | |||||
#include <sys/utime.h> /* for utime() */ | |||||
#endif | |||||
#else | |||||
#include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */ | |||||
#include <utime.h> /* for utime() */ | |||||
#endif | |||||
#if defined _MSC_VER | #if defined _MSC_VER | ||||
# if _MSC_VER >= 1600 | # if _MSC_VER >= 1600 | ||||
/* Visual Studio 2010 has decent C99 support */ | /* Visual Studio 2010 has decent C99 support */ | ||||
# include <stdint.h> | |||||
# define PRIu64 "llu" | # define PRIu64 "llu" | ||||
# define PRId64 "lld" | # define PRId64 "lld" | ||||
# define PRIx64 "llx" | # define PRIx64 "llx" | ||||
# else | # else | ||||
# include <limits.h> | |||||
# ifndef UINT32_MAX | # ifndef UINT32_MAX | ||||
# define UINT32_MAX _UI32_MAX | # define UINT32_MAX _UI32_MAX | ||||
# endif | # endif | ||||
@@ -51,7 +51,9 @@ static inline unsigned short __builtin_bswap16(unsigned short a) | |||||
#elif defined HAVE_BYTESWAP_H /* Linux */ | #elif defined HAVE_BYTESWAP_H /* Linux */ | ||||
#include <byteswap.h> | |||||
// JUCE: removed as JUCE already includes standard headers and including | |||||
// these in FlacNamespace will cause problems | |||||
//#include <byteswap.h> | |||||
#define ENDSWAP_16(x) (bswap_16 (x)) | #define ENDSWAP_16(x) (bswap_16 (x)) | ||||
#define ENDSWAP_32(x) (bswap_32 (x)) | #define ENDSWAP_32(x) (bswap_32 (x)) | ||||
@@ -33,7 +33,6 @@ | |||||
#ifndef FLAC__METADATA_H | #ifndef FLAC__METADATA_H | ||||
#define FLAC__METADATA_H | #define FLAC__METADATA_H | ||||
#include <sys/types.h> /* for off_t */ | |||||
#include "export.h" | #include "export.h" | ||||
#include "callback.h" | #include "callback.h" | ||||
#include "format.h" | #include "format.h" | ||||
@@ -33,7 +33,6 @@ | |||||
#ifndef FLAC__STREAM_DECODER_H | #ifndef FLAC__STREAM_DECODER_H | ||||
#define FLAC__STREAM_DECODER_H | #define FLAC__STREAM_DECODER_H | ||||
#include <stdio.h> /* for FILE */ | |||||
#include "export.h" | #include "export.h" | ||||
#include "format.h" | #include "format.h" | ||||
@@ -33,7 +33,6 @@ | |||||
#ifndef FLAC__STREAM_ENCODER_H | #ifndef FLAC__STREAM_ENCODER_H | ||||
#define FLAC__STREAM_ENCODER_H | #define FLAC__STREAM_ENCODER_H | ||||
#include <stdio.h> /* for FILE */ | |||||
#include "export.h" | #include "export.h" | ||||
#include "format.h" | #include "format.h" | ||||
#include "stream_decoder.h" | #include "stream_decoder.h" | ||||
@@ -38,11 +38,6 @@ | |||||
extern "C" { | extern "C" { | ||||
#endif | #endif | ||||
#include <stdio.h> | |||||
#include <sys/stat.h> | |||||
#include <stdarg.h> | |||||
#include <windows.h> | |||||
int get_utf8_argv(int *argc, char ***argv); | int get_utf8_argv(int *argc, char ***argv); | ||||
int printf_utf8(const char *format, ...); | int printf_utf8(const char *format, ...); | ||||
@@ -24,6 +24,66 @@ | |||||
#if JUCE_USE_FLAC | #if JUCE_USE_FLAC | ||||
} | |||||
#if defined _WIN32 && !defined __CYGWIN__ | |||||
#include <io.h> | |||||
#else | |||||
#include <unistd.h> | |||||
#endif | |||||
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ | |||||
#include <sys/types.h> /* for off_t */ | |||||
#endif | |||||
#if HAVE_INTTYPES_H | |||||
#define __STDC_FORMAT_MACROS | |||||
#include <inttypes.h> | |||||
#endif | |||||
#if defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ || defined __EMX__ | |||||
#include <io.h> /* for _setmode(), chmod() */ | |||||
#include <fcntl.h> /* for _O_BINARY */ | |||||
#else | |||||
#include <unistd.h> /* for chown(), unlink() */ | |||||
#endif | |||||
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ | |||||
#if defined __BORLANDC__ | |||||
#include <utime.h> /* for utime() */ | |||||
#else | |||||
#include <sys/utime.h> /* for utime() */ | |||||
#endif | |||||
#else | |||||
#include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */ | |||||
#include <utime.h> /* for utime() */ | |||||
#endif | |||||
#if defined _MSC_VER | |||||
#if _MSC_VER >= 1600 | |||||
#include <stdint.h> | |||||
#else | |||||
#include <limits.h> | |||||
#endif | |||||
#endif | |||||
#ifdef _WIN32 | |||||
#include <stdio.h> | |||||
#include <sys/stat.h> | |||||
#include <stdarg.h> | |||||
#include <windows.h> | |||||
#endif | |||||
#ifdef DEBUG | |||||
#include <assert.h> | |||||
#endif | |||||
#include <stdlib.h> | |||||
#include <stdio.h> | |||||
namespace juce | |||||
{ | |||||
namespace FlacNamespace | namespace FlacNamespace | ||||
{ | { | ||||
#if JUCE_INCLUDE_FLAC_CODE || ! defined (JUCE_INCLUDE_FLAC_CODE) | #if JUCE_INCLUDE_FLAC_CODE || ! defined (JUCE_INCLUDE_FLAC_CODE) | ||||
@@ -62,7 +122,7 @@ namespace FlacNamespace | |||||
#define FLAC__HAS_X86INTRIN 1 | #define FLAC__HAS_X86INTRIN 1 | ||||
#endif | #endif | ||||
#undef __STDC_LIMIT_MACROS | |||||
#undef __STDC_LIMIT_MACROS | |||||
#define __STDC_LIMIT_MACROS 1 | #define __STDC_LIMIT_MACROS 1 | ||||
#define flac_max jmax | #define flac_max jmax | ||||
#define flac_min jmin | #define flac_min jmin | ||||
@@ -239,7 +239,7 @@ inline void b2Contact::SetEnabled(bool flag) | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_flags &= ~e_enabledFlag; | |||||
m_flags &= ~((unsigned int) e_enabledFlag); | |||||
} | } | ||||
} | } | ||||
@@ -98,7 +98,7 @@ | |||||
#define JUCE_COMPILER_SUPPORTS_STATIC_ASSERT 1 | #define JUCE_COMPILER_SUPPORTS_STATIC_ASSERT 1 | ||||
#endif | #endif | ||||
#ifndef JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL | |||||
#if __has_feature (cxx_override_control) && (! defined (JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL)) | |||||
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1 | #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1 | ||||
#endif | #endif | ||||