| @@ -18,7 +18,7 @@ | |||
| #include "CarlaHost.h" | |||
| #include "CarlaString.hpp" | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| namespace CB = CarlaBackend; | |||
| @@ -29,7 +29,7 @@ | |||
| #include "CarlaOscUtils.hpp" | |||
| #include "CarlaString.hpp" | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| namespace CB = CarlaBackend; | |||
| @@ -25,6 +25,8 @@ | |||
| #include "CarlaThread.hpp" | |||
| #include "LinkedList.hpp" | |||
| #include "water/files/juce_File.h" | |||
| #if defined(HAVE_X11) && ! defined(CARLA_UTILS_CACHED_PLUGINS_ONLY) | |||
| # include <X11/Xlib.h> | |||
| #endif | |||
| @@ -35,7 +35,10 @@ | |||
| #include "jackbridge/JackBridge.hpp" | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| #include "water/streams/juce_MemoryOutputStream.h" | |||
| #include "water/xml/juce_XmlDocument.h" | |||
| #include "water/xml/juce_XmlElement.h" | |||
| using water::Array; | |||
| using water::CharPointer_UTF8; | |||
| @@ -31,7 +31,8 @@ | |||
| # include <xmmintrin.h> | |||
| #endif | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| #include "water/time/juce_Time.h" | |||
| // must be last | |||
| #include "jackbridge/JackBridge.hpp" | |||
| @@ -24,7 +24,9 @@ | |||
| #include "CarlaStringList.hpp" | |||
| #include "CarlaThread.hpp" | |||
| #include "water/water.h" | |||
| #include "water/midi/juce_MidiBuffer.h" | |||
| #include "water/processors/juce_AudioProcessorGraph.h" | |||
| #include "water/text/juce_StringArray.h" | |||
| using water::AudioProcessorGraph; | |||
| using water::AudioSampleBuffer; | |||
| @@ -34,7 +34,10 @@ | |||
| #include "CarlaHost.h" | |||
| #include "CarlaNative.hpp" | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| #include "water/streams/juce_MemoryOutputStream.h" | |||
| #include "water/xml/juce_XmlDocument.h" | |||
| #include "water/xml/juce_XmlElement.h" | |||
| using water::File; | |||
| using water::MemoryOutputStream; | |||
| @@ -25,7 +25,10 @@ | |||
| #include <ctime> | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| #include "water/streams/juce_MemoryOutputStream.h" | |||
| #include "water/xml/juce_XmlDocument.h" | |||
| #include "water/xml/juce_XmlElement.h" | |||
| using water::CharPointer_UTF8; | |||
| using water::File; | |||
| @@ -30,7 +30,9 @@ | |||
| #include <ctime> | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| #include "water/threads/juce_ChildProcess.h" | |||
| #include "water/time/juce_Time.h" | |||
| // --------------------------------------------------------------------------------------------------------------------- | |||
| @@ -27,6 +27,8 @@ | |||
| # include "CarlaThread.hpp" | |||
| #endif | |||
| #include "water/threads/juce_ChildProcess.h" | |||
| using water::ChildProcess; | |||
| using water::String; | |||
| using water::StringArray; | |||
| @@ -22,7 +22,7 @@ | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "water/water.h" | |||
| #include "water/text/juce_StringArray.h" | |||
| #include <fluidsynth.h> | |||
| @@ -28,6 +28,10 @@ | |||
| #include "CarlaShmUtils.hpp" | |||
| #include "CarlaThread.hpp" | |||
| #include "water/text/juce_StringArray.h" | |||
| #include "water/threads/juce_ChildProcess.h" | |||
| #include "water/time/juce_Time.h" | |||
| #include "jackbridge/JackBridge.hpp" | |||
| #include <ctime> | |||
| @@ -37,7 +37,7 @@ extern "C" { | |||
| #include "rtmempool/rtmempool-lv2.h" | |||
| } | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| #include <string> | |||
| #include <vector> | |||
| @@ -31,7 +31,8 @@ | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| #include "water/text/juce_StringArray.h" | |||
| // ----------------------------------------------------------------------- | |||
| @@ -199,7 +200,6 @@ public: | |||
| // ----------------------------------------------------------------------- | |||
| using water::File; | |||
| using water::SharedResourcePointer; | |||
| using water::StringArray; | |||
| CARLA_BACKEND_START_NAMESPACE | |||
| @@ -21,7 +21,7 @@ | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "CarlaNative.h" | |||
| #include "water/water.h" | |||
| #include "water/text/juce_StringArray.h" | |||
| using water::jmax; | |||
| using water::String; | |||
| @@ -27,7 +27,7 @@ | |||
| #include "CarlaLv2Utils.hpp" | |||
| #include "CarlaUtils.h" | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| // --------------------------------------------------------------------------------------------------------------------- | |||
| // -Weffc++ compat ext widget | |||
| @@ -15,6 +15,10 @@ | |||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
| */ | |||
| #ifndef BUILD_BRIDGE | |||
| # error This file should not be compiled if not building bridge | |||
| #endif | |||
| #include "CarlaEngine.hpp" | |||
| #include "CarlaHost.h" | |||
| @@ -36,7 +40,7 @@ | |||
| #include "jackbridge/JackBridge.hpp" | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| using CarlaBackend::CarlaEngine; | |||
| using CarlaBackend::EngineCallbackOpcode; | |||
| @@ -21,7 +21,7 @@ | |||
| #include "CarlaMIDI.h" | |||
| #include "LinkedList.hpp" | |||
| #include "water/water.h" | |||
| #include "water/files/juce_File.h" | |||
| #include <string> | |||
| #include <vector> | |||
| @@ -31,6 +31,10 @@ | |||
| #ifndef JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED | |||
| #define JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED | |||
| #include "../memory/juce_HeapBlock.h" | |||
| #include "CarlaMathUtils.hpp" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -1092,8 +1096,6 @@ private: | |||
| channels [numChannels] = nullptr; | |||
| isClear = false; | |||
| } | |||
| JUCE_LEAK_DETECTOR (AudioSampleBuffer) | |||
| }; | |||
| } | |||
| @@ -31,6 +31,9 @@ | |||
| #ifndef JUCE_ARRAY_H_INCLUDED | |||
| #define JUCE_ARRAY_H_INCLUDED | |||
| #include "../containers/juce_ArrayAllocationBase.h" | |||
| #include "../containers/juce_ElementComparator.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_ARRAYALLOCATIONBASE_H_INCLUDED | |||
| #define JUCE_ARRAYALLOCATIONBASE_H_INCLUDED | |||
| #include "../memory/juce_HeapBlock.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_ELEMENTCOMPARATOR_H_INCLUDED | |||
| #define JUCE_ELEMENTCOMPARATOR_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| /** This is an internal helper class which converts a juce ElementComparator style | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_LINKEDLISTPOINTER_H_INCLUDED | |||
| #define JUCE_LINKEDLISTPOINTER_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_NamedValueSet.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,10 @@ | |||
| #ifndef JUCE_NAMEDVALUESET_H_INCLUDED | |||
| #define JUCE_NAMEDVALUESET_H_INCLUDED | |||
| #include "juce_Array.h" | |||
| #include "juce_Variant.h" | |||
| #include "../text/juce_Identifier.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_OWNEDARRAY_H_INCLUDED | |||
| #define JUCE_OWNEDARRAY_H_INCLUDED | |||
| #include "juce_ArrayAllocationBase.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -835,7 +837,7 @@ private: | |||
| delete data.elements [--numUsed]; | |||
| } | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OwnedArray) | |||
| JUCE_DECLARE_NON_COPYABLE (OwnedArray) | |||
| }; | |||
| } | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED | |||
| #define JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED | |||
| #include "../memory/juce_ReferenceCountedObject.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_SORTEDSET_H_INCLUDED | |||
| #define JUCE_SORTEDSET_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_Variant.h" | |||
| namespace water { | |||
| enum VariantStreamMarkers | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_VARIANT_H_INCLUDED | |||
| #define JUCE_VARIANT_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -147,7 +149,6 @@ private: | |||
| const VariantType* type; | |||
| ValueUnion value; | |||
| Array<var>* convertToArray(); | |||
| var (const VariantType&) noexcept; | |||
| }; | |||
| @@ -28,6 +28,9 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_DirectoryIterator.h" | |||
| #include "../text/juce_StringArray.h" | |||
| namespace water { | |||
| DirectoryIterator::DirectoryIterator (const File& directory, bool recursive, | |||
| @@ -31,6 +31,11 @@ | |||
| #ifndef JUCE_DIRECTORYITERATOR_H_INCLUDED | |||
| #define JUCE_DIRECTORYITERATOR_H_INCLUDED | |||
| #include "juce_File.h" | |||
| #include "../text/juce_StringArray.h" | |||
| #include "CarlaJuceUtils.hpp" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -137,7 +142,7 @@ private: | |||
| friend class DirectoryIterator; | |||
| ScopedPointer<Pimpl> pimpl; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NativeIterator) | |||
| JUCE_DECLARE_NON_COPYABLE (NativeIterator) | |||
| }; | |||
| StringArray wildCards; | |||
| @@ -154,7 +159,7 @@ private: | |||
| static StringArray parseWildcards (const String& pattern); | |||
| static bool fileMatches (const StringArray& wildCards, const String& filename); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DirectoryIterator) | |||
| JUCE_DECLARE_NON_COPYABLE (DirectoryIterator) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,17 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_File.h" | |||
| #include "juce_DirectoryIterator.h" | |||
| #include "juce_FileInputStream.h" | |||
| #include "juce_FileOutputStream.h" | |||
| #include "juce_TemporaryFile.h" | |||
| #include "../maths/juce_Random.h" | |||
| #include "../text/juce_StringArray.h" | |||
| #include "../time/juce_Time.h" | |||
| #include "CarlaJuceUtils.hpp" | |||
| namespace water { | |||
| File::File (const String& fullPathName) | |||
| @@ -1184,7 +1195,7 @@ private: | |||
| const String directoryWithWildCard; | |||
| HANDLE handle; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Pimpl) | |||
| JUCE_DECLARE_NON_COPYABLE (Pimpl) | |||
| }; | |||
| #else | |||
| //===================================================================================================================== | |||
| @@ -31,6 +31,9 @@ | |||
| #ifndef JUCE_FILE_H_INCLUDED | |||
| #define JUCE_FILE_H_INCLUDED | |||
| #include "../containers/juce_Array.h" | |||
| #include "../misc/juce_Result.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_FileInputStream.h" | |||
| namespace water { | |||
| int64 juce_fileSetPosition (void* handle, int64 pos); | |||
| @@ -31,6 +31,9 @@ | |||
| #ifndef JUCE_FILEINPUTSTREAM_H_INCLUDED | |||
| #define JUCE_FILEINPUTSTREAM_H_INCLUDED | |||
| #include "juce_File.h" | |||
| #include "../streams/juce_InputStream.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -92,7 +95,7 @@ private: | |||
| void openHandle(); | |||
| size_t readInternal (void*, size_t); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileInputStream) | |||
| JUCE_DECLARE_NON_COPYABLE (FileInputStream) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_FileOutputStream.h" | |||
| namespace water { | |||
| int64 juce_fileSetPosition (void* handle, int64 pos); | |||
| @@ -137,4 +139,123 @@ bool FileOutputStream::writeRepeatedByte (uint8 byte, size_t numBytes) | |||
| return OutputStream::writeRepeatedByte (byte, numBytes); | |||
| } | |||
| #ifdef CARLA_OS_WIN | |||
| void FileOutputStream::openHandle() | |||
| { | |||
| HANDLE h = CreateFile (file.getFullPathName().toUTF8(), GENERIC_WRITE, FILE_SHARE_READ, 0, | |||
| OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | |||
| if (h != INVALID_HANDLE_VALUE) | |||
| { | |||
| LARGE_INTEGER li; | |||
| li.QuadPart = 0; | |||
| li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_END); | |||
| if (li.LowPart != INVALID_SET_FILE_POINTER) | |||
| { | |||
| fileHandle = (void*) h; | |||
| currentPosition = li.QuadPart; | |||
| return; | |||
| } | |||
| } | |||
| status = getResultForLastError(); | |||
| } | |||
| void FileOutputStream::closeHandle() | |||
| { | |||
| CloseHandle ((HANDLE) fileHandle); | |||
| } | |||
| ssize_t FileOutputStream::writeInternal (const void* bufferToWrite, size_t numBytes) | |||
| { | |||
| if (fileHandle != nullptr) | |||
| { | |||
| DWORD actualNum = 0; | |||
| if (! WriteFile ((HANDLE) fileHandle, bufferToWrite, (DWORD) numBytes, &actualNum, 0)) | |||
| status = getResultForLastError(); | |||
| return (ssize_t) actualNum; | |||
| } | |||
| return 0; | |||
| } | |||
| void FileOutputStream::flushInternal() | |||
| { | |||
| if (fileHandle != nullptr) | |||
| if (! FlushFileBuffers ((HANDLE) fileHandle)) | |||
| status = getResultForLastError(); | |||
| } | |||
| #else | |||
| void FileOutputStream::openHandle() | |||
| { | |||
| if (file.exists()) | |||
| { | |||
| const int f = open (file.getFullPathName().toUTF8(), O_RDWR, 00644); | |||
| if (f != -1) | |||
| { | |||
| currentPosition = lseek (f, 0, SEEK_END); | |||
| if (currentPosition >= 0) | |||
| { | |||
| fileHandle = fdToVoidPointer (f); | |||
| } | |||
| else | |||
| { | |||
| status = getResultForErrno(); | |||
| close (f); | |||
| } | |||
| } | |||
| else | |||
| { | |||
| status = getResultForErrno(); | |||
| } | |||
| } | |||
| else | |||
| { | |||
| const int f = open (file.getFullPathName().toUTF8(), O_RDWR + O_CREAT, 00644); | |||
| if (f != -1) | |||
| fileHandle = fdToVoidPointer (f); | |||
| else | |||
| status = getResultForErrno(); | |||
| } | |||
| } | |||
| void FileOutputStream::closeHandle() | |||
| { | |||
| if (fileHandle != 0) | |||
| { | |||
| close (getFD (fileHandle)); | |||
| fileHandle = 0; | |||
| } | |||
| } | |||
| ssize_t FileOutputStream::writeInternal (const void* const data, const size_t numBytes) | |||
| { | |||
| ssize_t result = 0; | |||
| if (fileHandle != 0) | |||
| { | |||
| result = ::write (getFD (fileHandle), data, numBytes); | |||
| if (result == -1) | |||
| status = getResultForErrno(); | |||
| } | |||
| return result; | |||
| } | |||
| void FileOutputStream::flushInternal() | |||
| { | |||
| if (fileHandle != 0) | |||
| { | |||
| if (fsync (getFD (fileHandle)) == -1) | |||
| status = getResultForErrno(); | |||
| } | |||
| } | |||
| #endif | |||
| } | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_FILEOUTPUTSTREAM_H_INCLUDED | |||
| #define JUCE_FILEOUTPUTSTREAM_H_INCLUDED | |||
| #include "../streams/juce_OutputStream.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -117,7 +119,7 @@ private: | |||
| int64 setPositionInternal (int64); | |||
| ssize_t writeInternal (const void*, size_t); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileOutputStream) | |||
| JUCE_DECLARE_NON_COPYABLE (FileOutputStream) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,9 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_TemporaryFile.h" | |||
| #include "../maths/juce_Random.h" | |||
| namespace water { | |||
| static File createTempFile (const File& parentDirectory, String name, | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_TEMPORARYFILE_H_INCLUDED | |||
| #define JUCE_TEMPORARYFILE_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -166,7 +168,7 @@ private: | |||
| //============================================================================== | |||
| const File temporaryFile, targetFile; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TemporaryFile) | |||
| JUCE_DECLARE_NON_COPYABLE (TemporaryFile) | |||
| }; | |||
| } | |||
| @@ -31,6 +31,10 @@ | |||
| #ifndef JUCE_MATHSFUNCTIONS_H_INCLUDED | |||
| #define JUCE_MATHSFUNCTIONS_H_INCLUDED | |||
| #include "../water.h" | |||
| #include <algorithm> | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -38,38 +42,6 @@ namespace water { | |||
| This file sets up some handy mathematical typdefs and functions. | |||
| */ | |||
| //============================================================================== | |||
| // Definitions for the int8, int16, int32, int64 and pointer_sized_int types. | |||
| /** A platform-independent 8-bit signed integer type. */ | |||
| typedef signed char int8; | |||
| /** A platform-independent 8-bit unsigned integer type. */ | |||
| typedef unsigned char uint8; | |||
| /** A platform-independent 16-bit signed integer type. */ | |||
| typedef signed short int16; | |||
| /** A platform-independent 16-bit unsigned integer type. */ | |||
| typedef unsigned short uint16; | |||
| /** A platform-independent 32-bit signed integer type. */ | |||
| typedef signed int int32; | |||
| /** A platform-independent 32-bit unsigned integer type. */ | |||
| typedef unsigned int uint32; | |||
| /** A platform-independent 64-bit integer type. */ | |||
| typedef long long int64; | |||
| /** A platform-independent 64-bit unsigned integer type. */ | |||
| typedef unsigned long long uint64; | |||
| #if JUCE_64BIT | |||
| /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ | |||
| typedef int64 pointer_sized_int; | |||
| /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ | |||
| typedef uint64 pointer_sized_uint; | |||
| #else | |||
| /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ | |||
| typedef int pointer_sized_int; | |||
| /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ | |||
| typedef unsigned int pointer_sized_uint; | |||
| #endif | |||
| //============================================================================== | |||
| // Some indispensable min/max functions | |||
| @@ -369,10 +341,10 @@ int roundToInt (const FloatType value) noexcept | |||
| union { int asInt[2]; double asDouble; } n; | |||
| n.asDouble = ((double) value) + 6755399441055744.0; | |||
| #if JUCE_BIG_ENDIAN | |||
| return n.asInt [1]; | |||
| #else | |||
| #ifdef __LITTLE_ENDIAN__ | |||
| return n.asInt [0]; | |||
| #else | |||
| return n.asInt [1]; | |||
| #endif | |||
| } | |||
| @@ -502,54 +474,6 @@ void writeLittleEndianBitsInBuffer (void* targetBuffer, uint32 startBit, uint32 | |||
| */ | |||
| uint32 readLittleEndianBitsInBuffer (const void* sourceBuffer, uint32 startBit, uint32 numBits) noexcept; | |||
| //============================================================================== | |||
| /** This namespace contains a few template classes for helping work out class type variations. | |||
| */ | |||
| namespace TypeHelpers | |||
| { | |||
| /** The ParameterType struct is used to find the best type to use when passing some kind | |||
| of object as a parameter. | |||
| Of course, this is only likely to be useful in certain esoteric template situations. | |||
| Because "typename TypeHelpers::ParameterType<SomeClass>::type" is a bit of a mouthful, there's | |||
| a PARAMETER_TYPE(SomeClass) macro that you can use to get the same effect. | |||
| E.g. "myFunction (PARAMETER_TYPE (int), PARAMETER_TYPE (MyObject))" | |||
| would evaluate to "myfunction (int, const MyObject&)", keeping any primitive types as | |||
| pass-by-value, but passing objects as a const reference, to avoid copying. | |||
| */ | |||
| template <typename Type> struct ParameterType { typedef const Type& type; }; | |||
| template <typename Type> struct ParameterType <Type&> { typedef Type& type; }; | |||
| template <typename Type> struct ParameterType <Type*> { typedef Type* type; }; | |||
| template <> struct ParameterType <char> { typedef char type; }; | |||
| template <> struct ParameterType <unsigned char> { typedef unsigned char type; }; | |||
| template <> struct ParameterType <short> { typedef short type; }; | |||
| template <> struct ParameterType <unsigned short> { typedef unsigned short type; }; | |||
| template <> struct ParameterType <int> { typedef int type; }; | |||
| template <> struct ParameterType <unsigned int> { typedef unsigned int type; }; | |||
| template <> struct ParameterType <long> { typedef long type; }; | |||
| template <> struct ParameterType <unsigned long> { typedef unsigned long type; }; | |||
| template <> struct ParameterType <int64> { typedef int64 type; }; | |||
| template <> struct ParameterType <uint64> { typedef uint64 type; }; | |||
| template <> struct ParameterType <bool> { typedef bool type; }; | |||
| template <> struct ParameterType <float> { typedef float type; }; | |||
| template <> struct ParameterType <double> { typedef double type; }; | |||
| /** A helpful macro to simplify the use of the ParameterType template. | |||
| @see ParameterType | |||
| */ | |||
| #define PARAMETER_TYPE(a) typename TypeHelpers::ParameterType<a>::type | |||
| /** These templates are designed to take a type, and if it's a double, they return a double | |||
| type; for anything else, they return a float type. | |||
| */ | |||
| template <typename Type> struct SmallestFloatType { typedef float type; }; | |||
| template <> struct SmallestFloatType <double> { typedef double type; }; | |||
| } | |||
| //============================================================================== | |||
| } | |||
| @@ -28,6 +28,9 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_Random.h" | |||
| #include "../time/juce_Time.h" | |||
| namespace water { | |||
| Random::Random (const int64 seedValue) noexcept : seed (seedValue) | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_RANDOM_H_INCLUDED | |||
| #define JUCE_RANDOM_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -122,8 +124,6 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| int64 seed; | |||
| JUCE_LEAK_DETECTOR (Random) | |||
| }; | |||
| } | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_ATOMIC_H_INCLUDED | |||
| #define JUCE_ATOMIC_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_BYTEORDER_H_INCLUDED | |||
| #define JUCE_BYTEORDER_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,9 @@ | |||
| #ifndef JUCE_HEAPBLOCK_H_INCLUDED | |||
| #define JUCE_HEAPBLOCK_H_INCLUDED | |||
| #include "juce_Memory.h" | |||
| #include "../maths/juce_MathsFunctions.h" | |||
| namespace water { | |||
| #if ! (defined (DOXYGEN) || JUCE_EXCEPTIONS_DISABLED) | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_MEMORY_H_INCLUDED | |||
| #define JUCE_MEMORY_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_MemoryBlock.h" | |||
| namespace water { | |||
| MemoryBlock::MemoryBlock() noexcept | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_MEMORYBLOCK_H_INCLUDED | |||
| #define JUCE_MEMORYBLOCK_H_INCLUDED | |||
| #include "juce_HeapBlock.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -256,8 +258,6 @@ private: | |||
| //============================================================================== | |||
| HeapBlock<char> data; | |||
| size_t size; | |||
| JUCE_LEAK_DETECTOR (MemoryBlock) | |||
| }; | |||
| } | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED | |||
| #define JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED | |||
| #include "juce_Atomic.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED | |||
| #define JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -161,8 +163,6 @@ private: | |||
| // There's no need to assign to a SharedResourcePointer because every | |||
| // instance of the class is exactly the same! | |||
| SharedResourcePointer& operator= (const SharedResourcePointer&) JUCE_DELETED_FUNCTION; | |||
| JUCE_LEAK_DETECTOR (SharedResourcePointer) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,9 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_MidiBuffer.h" | |||
| #include "juce_MidiMessage.h" | |||
| namespace water { | |||
| namespace MidiBufferHelpers | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_MIDIBUFFER_H_INCLUDED | |||
| #define JUCE_MIDIBUFFER_H_INCLUDED | |||
| #include "../containers/juce_Array.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -233,9 +235,6 @@ public: | |||
| change in future, so don't write code that relies on it! | |||
| */ | |||
| Array<uint8> data; | |||
| private: | |||
| JUCE_LEAK_DETECTOR (MidiBuffer) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,10 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_MidiFile.h" | |||
| #include "../memory/juce_ByteOrder.h" | |||
| #include "../streams/juce_MemoryOutputStream.h" | |||
| namespace water { | |||
| namespace MidiFileHelpers | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_MIDIFILE_H_INCLUDED | |||
| #define JUCE_MIDIFILE_H_INCLUDED | |||
| #include "juce_MidiMessageSequence.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -185,8 +187,6 @@ private: | |||
| void readNextTrack (const uint8*, int size); | |||
| bool writeTrack (OutputStream&, int trackNum); | |||
| JUCE_LEAK_DETECTOR (MidiFile) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_MidiMessage.h" | |||
| namespace water { | |||
| namespace MidiHelpers | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_MIDIMESSAGE_H_INCLUDED | |||
| #define JUCE_MIDIMESSAGE_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_MidiMessageSequence.h" | |||
| namespace water { | |||
| MidiMessageSequence::MidiMessageSequence() | |||
| @@ -31,6 +31,11 @@ | |||
| #ifndef JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED | |||
| #define JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED | |||
| #include "juce_MidiMessage.h" | |||
| #include "../containers/juce_Array.h" | |||
| #include "../containers/juce_OwnedArray.h" | |||
| #include "../text/juce_String.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -102,7 +107,6 @@ public: | |||
| //============================================================================== | |||
| friend class MidiMessageSequence; | |||
| MidiEventHolder (const MidiMessage&); | |||
| JUCE_LEAK_DETECTOR (MidiEventHolder) | |||
| }; | |||
| //============================================================================== | |||
| @@ -285,8 +289,6 @@ private: | |||
| //============================================================================== | |||
| friend class MidiFile; | |||
| OwnedArray<MidiEventHolder> list; | |||
| JUCE_LEAK_DETECTOR (MidiMessageSequence) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_Result.h" | |||
| namespace water { | |||
| Result::Result() noexcept {} | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_RESULT_H_INCLUDED | |||
| #define JUCE_RESULT_H_INCLUDED | |||
| #include "../text/juce_String.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -25,6 +25,8 @@ | |||
| #ifndef JUCE_AUDIOPLAYHEAD_H_INCLUDED | |||
| #define JUCE_AUDIOPLAYHEAD_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -22,6 +22,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_AudioProcessor.h" | |||
| namespace water { | |||
| AudioProcessor::AudioProcessor() | |||
| @@ -29,7 +31,7 @@ AudioProcessor::AudioProcessor() | |||
| cachedTotalIns = 0; | |||
| cachedTotalOuts = 0; | |||
| playHead = nullptr; | |||
| // playHead = nullptr; | |||
| currentSampleRate = 0; | |||
| blockSize = 0; | |||
| latencySamples = 0; | |||
| @@ -43,10 +45,10 @@ AudioProcessor::~AudioProcessor() | |||
| } | |||
| //============================================================================== | |||
| void AudioProcessor::setPlayHead (AudioPlayHead* const newPlayHead) | |||
| { | |||
| playHead = newPlayHead; | |||
| } | |||
| // void AudioProcessor::setPlayHead (AudioPlayHead* const newPlayHead) | |||
| // { | |||
| // playHead = newPlayHead; | |||
| // } | |||
| void AudioProcessor::setPlayConfigDetails (const int newNumIns, | |||
| const int newNumOuts, | |||
| @@ -92,6 +94,7 @@ void AudioProcessor::processBypassed (AudioSampleBuffer& buffer, MidiBuffer&) | |||
| void AudioProcessor::processBlockBypassed (AudioSampleBuffer& buffer, MidiBuffer& midi) { processBypassed (buffer, midi); } | |||
| #if 0 | |||
| //============================================================================== | |||
| bool AudioPlayHead::CurrentPositionInfo::operator== (const CurrentPositionInfo& other) const noexcept | |||
| { | |||
| @@ -123,4 +126,6 @@ void AudioPlayHead::CurrentPositionInfo::resetToDefault() | |||
| bpm = 120; | |||
| } | |||
| #endif | |||
| } | |||
| @@ -25,6 +25,9 @@ | |||
| #ifndef JUCE_AUDIOPROCESSOR_H_INCLUDED | |||
| #define JUCE_AUDIOPROCESSOR_H_INCLUDED | |||
| #include "../text/juce_String.h" | |||
| #include "../buffers/juce_AudioSampleBuffer.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -163,6 +166,7 @@ public: | |||
| virtual void processBlockBypassed (AudioSampleBuffer& buffer, | |||
| MidiBuffer& midiMessages); | |||
| #if 0 | |||
| //============================================================================== | |||
| /** Returns the current AudioPlayHead object that should be used to find | |||
| out the state and position of the playhead. | |||
| @@ -180,6 +184,7 @@ public: | |||
| If the host can't or won't provide any time info, this will return nullptr. | |||
| */ | |||
| AudioPlayHead* getPlayHead() const noexcept { return playHead; } | |||
| #endif | |||
| //============================================================================== | |||
| /** Returns the total number of input channels. | |||
| @@ -335,12 +340,14 @@ public: | |||
| */ | |||
| virtual void setNonRealtime (bool isNonRealtime) noexcept; | |||
| #if 0 | |||
| //============================================================================== | |||
| /** Tells the processor to use this playhead object. | |||
| The processor will not take ownership of the object, so the caller must delete it when | |||
| it is no longer being used. | |||
| */ | |||
| virtual void setPlayHead (AudioPlayHead* newPlayHead); | |||
| #endif | |||
| //============================================================================== | |||
| /** This is called by the processor to specify its details before being played. Use this | |||
| @@ -357,9 +364,11 @@ public: | |||
| void setRateAndBufferSizeDetails (double sampleRate, int blockSize) noexcept; | |||
| private: | |||
| #if 0 | |||
| //============================================================================== | |||
| /** @internal */ | |||
| AudioPlayHead* playHead; | |||
| #endif | |||
| //============================================================================== | |||
| double currentSampleRate; | |||
| @@ -374,7 +383,7 @@ private: | |||
| void processBypassed (AudioSampleBuffer&, MidiBuffer&); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessor) | |||
| JUCE_DECLARE_NON_COPYABLE (AudioProcessor) | |||
| }; | |||
| } | |||
| @@ -22,6 +22,9 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_AudioProcessorGraph.h" | |||
| #include "../containers/juce_SortedSet.h" | |||
| namespace water { | |||
| const int AudioProcessorGraph::midiChannelIndex = 0x1000; | |||
| @@ -38,8 +41,6 @@ struct AudioGraphRenderingOpBase | |||
| virtual void perform (AudioSampleBuffer& sharedBufferChans, | |||
| const OwnedArray<MidiBuffer>& sharedMidiBuffers, | |||
| const int numSamples) = 0; | |||
| JUCE_LEAK_DETECTOR (AudioGraphRenderingOpBase) | |||
| }; | |||
| // use CRTP | |||
| @@ -740,7 +741,7 @@ private: | |||
| } | |||
| } | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (RenderingOpSequenceCalculator) | |||
| JUCE_DECLARE_NON_COPYABLE (RenderingOpSequenceCalculator) | |||
| }; | |||
| //============================================================================== | |||
| @@ -1017,7 +1018,7 @@ AudioProcessorGraph::Node* AudioProcessorGraph::addNode (AudioProcessor* const n | |||
| lastNodeId = nodeId; | |||
| } | |||
| newProcessor->setPlayHead (getPlayHead()); | |||
| // newProcessor->setPlayHead (getPlayHead()); | |||
| Node* const n = new Node (nodeId, newProcessor); | |||
| nodes.add (n); | |||
| @@ -1351,15 +1352,15 @@ void AudioProcessorGraph::setNonRealtime (bool isProcessingNonRealtime) noexcept | |||
| nodes.getUnchecked(i)->getProcessor()->setNonRealtime (isProcessingNonRealtime); | |||
| } | |||
| void AudioProcessorGraph::setPlayHead (AudioPlayHead* audioPlayHead) | |||
| { | |||
| const CarlaRecursiveMutexLocker cml (getCallbackLock()); | |||
| AudioProcessor::setPlayHead (audioPlayHead); | |||
| for (int i = 0; i < nodes.size(); ++i) | |||
| nodes.getUnchecked(i)->getProcessor()->setPlayHead (audioPlayHead); | |||
| } | |||
| // void AudioProcessorGraph::setPlayHead (AudioPlayHead* audioPlayHead) | |||
| // { | |||
| // const CarlaRecursiveMutexLocker cml (getCallbackLock()); | |||
| // | |||
| // AudioProcessor::setPlayHead (audioPlayHead); | |||
| // | |||
| // for (int i = 0; i < nodes.size(); ++i) | |||
| // nodes.getUnchecked(i)->getProcessor()->setPlayHead (audioPlayHead); | |||
| // } | |||
| void AudioProcessorGraph::processAudio (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) | |||
| { | |||
| @@ -25,6 +25,12 @@ | |||
| #ifndef JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED | |||
| #define JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED | |||
| #include "juce_AudioProcessor.h" | |||
| #include "../containers/juce_NamedValueSet.h" | |||
| #include "../containers/juce_OwnedArray.h" | |||
| #include "../containers/juce_ReferenceCountedArray.h" | |||
| #include "../midi/juce_MidiBuffer.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -42,7 +48,6 @@ namespace water { | |||
| AudioProcessorPlayer object. | |||
| */ | |||
| class AudioProcessorGraph : public AudioProcessor | |||
| /* private AsyncUpdater*/ | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| @@ -96,7 +101,7 @@ public: | |||
| void prepare (double newSampleRate, int newBlockSize, AudioProcessorGraph*); | |||
| void unprepare(); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Node) | |||
| JUCE_DECLARE_NON_COPYABLE (Node) | |||
| }; | |||
| //============================================================================== | |||
| @@ -139,10 +144,6 @@ public: | |||
| index of an audio input channel in the destination node. | |||
| */ | |||
| int destChannelIndex; | |||
| private: | |||
| //============================================================================== | |||
| JUCE_LEAK_DETECTOR (Connection) | |||
| }; | |||
| //============================================================================== | |||
| @@ -332,7 +333,7 @@ public: | |||
| //============================================================================== | |||
| void processAudio (AudioSampleBuffer& buffer, MidiBuffer& midiMessages); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioGraphIOProcessor) | |||
| JUCE_DECLARE_NON_COPYABLE (AudioGraphIOProcessor) | |||
| }; | |||
| //============================================================================== | |||
| @@ -343,7 +344,7 @@ public: | |||
| void reset() override; | |||
| void setNonRealtime (bool) noexcept override; | |||
| void setPlayHead (AudioPlayHead*) override; | |||
| // void setPlayHead (AudioPlayHead*) override; | |||
| bool acceptsMidi() const override; | |||
| bool producesMidi() const override; | |||
| @@ -375,7 +376,7 @@ private: | |||
| void buildRenderingSequence(); | |||
| bool isAnInputTo (uint32 possibleInputId, uint32 possibleDestinationId, int recursionCheck) const; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessorGraph) | |||
| JUCE_DECLARE_NON_COPYABLE (AudioProcessorGraph) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_FileInputSource.h" | |||
| namespace water { | |||
| FileInputSource::FileInputSource (const File& f, bool useFileTimeInHash) | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_FILEINPUTSOURCE_H_INCLUDED | |||
| #define JUCE_FILEINPUTSOURCE_H_INCLUDED | |||
| #include "juce_InputSource.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -62,7 +64,7 @@ private: | |||
| const File file; | |||
| bool useFileTimeInHashGeneration; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileInputSource) | |||
| JUCE_DECLARE_NON_COPYABLE (FileInputSource) | |||
| }; | |||
| } | |||
| @@ -1,259 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library. | |||
| Copyright (c) 2016 - ROLI Ltd. | |||
| Permission is granted to use this software under the terms of the ISC license | |||
| http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
| Permission to use, copy, modify, and/or distribute this software for any | |||
| purpose with or without fee is hereby granted, provided that the above | |||
| copyright notice and this permission notice appear in all copies. | |||
| THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
| TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
| FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
| OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
| USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
| TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
| OF THIS SOFTWARE. | |||
| ----------------------------------------------------------------------------- | |||
| To release a closed-source product which uses other parts of JUCE not | |||
| licensed under the ISC terms, commercial licenses are available: visit | |||
| www.juce.com for more information. | |||
| ============================================================================== | |||
| */ | |||
| namespace water { | |||
| int64 juce_fileSetPosition (void* handle, int64 pos); | |||
| //============================================================================== | |||
| FileOutputStream::FileOutputStream (const File& f, const size_t bufferSizeToUse) | |||
| : file (f), | |||
| fileHandle (nullptr), | |||
| status (Result::ok()), | |||
| currentPosition (0), | |||
| bufferSize (bufferSizeToUse), | |||
| bytesInBuffer (0), | |||
| buffer (jmax (bufferSizeToUse, (size_t) 16)) | |||
| { | |||
| openHandle(); | |||
| } | |||
| FileOutputStream::~FileOutputStream() | |||
| { | |||
| flushBuffer(); | |||
| closeHandle(); | |||
| } | |||
| int64 FileOutputStream::getPosition() | |||
| { | |||
| return currentPosition; | |||
| } | |||
| bool FileOutputStream::setPosition (int64 newPosition) | |||
| { | |||
| if (newPosition != currentPosition) | |||
| { | |||
| flushBuffer(); | |||
| currentPosition = juce_fileSetPosition (fileHandle, newPosition); | |||
| } | |||
| return newPosition == currentPosition; | |||
| } | |||
| bool FileOutputStream::flushBuffer() | |||
| { | |||
| bool ok = true; | |||
| if (bytesInBuffer > 0) | |||
| { | |||
| ok = (writeInternal (buffer, bytesInBuffer) == (ssize_t) bytesInBuffer); | |||
| bytesInBuffer = 0; | |||
| } | |||
| return ok; | |||
| } | |||
| void FileOutputStream::flush() | |||
| { | |||
| flushBuffer(); | |||
| flushInternal(); | |||
| } | |||
| bool FileOutputStream::write (const void* const src, const size_t numBytes) | |||
| { | |||
| jassert (src != nullptr && ((ssize_t) numBytes) >= 0); | |||
| if (bytesInBuffer + numBytes < bufferSize) | |||
| { | |||
| memcpy (buffer + bytesInBuffer, src, numBytes); | |||
| bytesInBuffer += numBytes; | |||
| currentPosition += (int64) numBytes; | |||
| } | |||
| else | |||
| { | |||
| if (! flushBuffer()) | |||
| return false; | |||
| if (numBytes < bufferSize) | |||
| { | |||
| memcpy (buffer + bytesInBuffer, src, numBytes); | |||
| bytesInBuffer += numBytes; | |||
| currentPosition += (int64) numBytes; | |||
| } | |||
| else | |||
| { | |||
| const ssize_t bytesWritten = writeInternal (src, numBytes); | |||
| if (bytesWritten < 0) | |||
| return false; | |||
| currentPosition += (int64) bytesWritten; | |||
| return bytesWritten == (ssize_t) numBytes; | |||
| } | |||
| } | |||
| return true; | |||
| } | |||
| bool FileOutputStream::writeRepeatedByte (uint8 byte, size_t numBytes) | |||
| { | |||
| jassert (((ssize_t) numBytes) >= 0); | |||
| if (bytesInBuffer + numBytes < bufferSize) | |||
| { | |||
| memset (buffer + bytesInBuffer, byte, numBytes); | |||
| bytesInBuffer += numBytes; | |||
| currentPosition += (int64) numBytes; | |||
| return true; | |||
| } | |||
| return OutputStream::writeRepeatedByte (byte, numBytes); | |||
| } | |||
| #ifdef CARLA_OS_WIN | |||
| void FileOutputStream::openHandle() | |||
| { | |||
| HANDLE h = CreateFile (file.getFullPathName().toUTF8(), GENERIC_WRITE, FILE_SHARE_READ, 0, | |||
| OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | |||
| if (h != INVALID_HANDLE_VALUE) | |||
| { | |||
| LARGE_INTEGER li; | |||
| li.QuadPart = 0; | |||
| li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_END); | |||
| if (li.LowPart != INVALID_SET_FILE_POINTER) | |||
| { | |||
| fileHandle = (void*) h; | |||
| currentPosition = li.QuadPart; | |||
| return; | |||
| } | |||
| } | |||
| status = getResultForLastError(); | |||
| } | |||
| void FileOutputStream::closeHandle() | |||
| { | |||
| CloseHandle ((HANDLE) fileHandle); | |||
| } | |||
| ssize_t FileOutputStream::writeInternal (const void* bufferToWrite, size_t numBytes) | |||
| { | |||
| if (fileHandle != nullptr) | |||
| { | |||
| DWORD actualNum = 0; | |||
| if (! WriteFile ((HANDLE) fileHandle, bufferToWrite, (DWORD) numBytes, &actualNum, 0)) | |||
| status = getResultForLastError(); | |||
| return (ssize_t) actualNum; | |||
| } | |||
| return 0; | |||
| } | |||
| void FileOutputStream::flushInternal() | |||
| { | |||
| if (fileHandle != nullptr) | |||
| if (! FlushFileBuffers ((HANDLE) fileHandle)) | |||
| status = getResultForLastError(); | |||
| } | |||
| #else | |||
| void FileOutputStream::openHandle() | |||
| { | |||
| if (file.exists()) | |||
| { | |||
| const int f = open (file.getFullPathName().toUTF8(), O_RDWR, 00644); | |||
| if (f != -1) | |||
| { | |||
| currentPosition = lseek (f, 0, SEEK_END); | |||
| if (currentPosition >= 0) | |||
| { | |||
| fileHandle = fdToVoidPointer (f); | |||
| } | |||
| else | |||
| { | |||
| status = getResultForErrno(); | |||
| close (f); | |||
| } | |||
| } | |||
| else | |||
| { | |||
| status = getResultForErrno(); | |||
| } | |||
| } | |||
| else | |||
| { | |||
| const int f = open (file.getFullPathName().toUTF8(), O_RDWR + O_CREAT, 00644); | |||
| if (f != -1) | |||
| fileHandle = fdToVoidPointer (f); | |||
| else | |||
| status = getResultForErrno(); | |||
| } | |||
| } | |||
| void FileOutputStream::closeHandle() | |||
| { | |||
| if (fileHandle != 0) | |||
| { | |||
| close (getFD (fileHandle)); | |||
| fileHandle = 0; | |||
| } | |||
| } | |||
| ssize_t FileOutputStream::writeInternal (const void* const data, const size_t numBytes) | |||
| { | |||
| ssize_t result = 0; | |||
| if (fileHandle != 0) | |||
| { | |||
| result = ::write (getFD (fileHandle), data, numBytes); | |||
| if (result == -1) | |||
| status = getResultForErrno(); | |||
| } | |||
| return result; | |||
| } | |||
| void FileOutputStream::flushInternal() | |||
| { | |||
| if (fileHandle != 0) | |||
| { | |||
| if (fsync (getFD (fileHandle)) == -1) | |||
| status = getResultForErrno(); | |||
| } | |||
| } | |||
| #endif | |||
| } | |||
| @@ -1,125 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library. | |||
| Copyright (c) 2016 - ROLI Ltd. | |||
| Permission is granted to use this software under the terms of the ISC license | |||
| http://www.isc.org/downloads/software-support-policy/isc-license/ | |||
| Permission to use, copy, modify, and/or distribute this software for any | |||
| purpose with or without fee is hereby granted, provided that the above | |||
| copyright notice and this permission notice appear in all copies. | |||
| THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||
| TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
| FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||
| OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||
| USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||
| TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||
| OF THIS SOFTWARE. | |||
| ----------------------------------------------------------------------------- | |||
| To release a closed-source product which uses other parts of JUCE not | |||
| licensed under the ISC terms, commercial licenses are available: visit | |||
| www.juce.com for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef JUCE_FILEOUTPUTSTREAM_H_INCLUDED | |||
| #define JUCE_FILEOUTPUTSTREAM_H_INCLUDED | |||
| namespace water { | |||
| //============================================================================== | |||
| /** | |||
| An output stream that writes into a local file. | |||
| @see OutputStream, FileInputStream, File::createOutputStream | |||
| */ | |||
| class FileOutputStream : public OutputStream | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| /** Creates a FileOutputStream. | |||
| If the file doesn't exist, it will first be created. If the file can't be | |||
| created or opened (for example, because the parent directory of the file | |||
| does not exist), the failedToOpen() method will return true. | |||
| If the file already exists when opened, the stream's write-position will | |||
| be set to the end of the file. To overwrite an existing file, | |||
| use File::deleteFile() before opening the stream, or use setPosition(0) | |||
| after it's opened (although this won't truncate the file). | |||
| Destroying a FileOutputStream object does not force the operating system | |||
| to write the buffered data to disk immediately. If this is required you | |||
| should call flush() before triggering the destructor. | |||
| @see TemporaryFile | |||
| */ | |||
| FileOutputStream (const File& fileToWriteTo, | |||
| size_t bufferSizeToUse = 16384); | |||
| /** Destructor. */ | |||
| ~FileOutputStream(); | |||
| //============================================================================== | |||
| /** Returns the file that this stream is writing to. | |||
| */ | |||
| const File& getFile() const { return file; } | |||
| /** Returns the status of the file stream. | |||
| The result will be ok if the file opened successfully. If an error occurs while | |||
| opening or writing to the file, this will contain an error message. | |||
| */ | |||
| const Result& getStatus() const noexcept { return status; } | |||
| /** Returns true if the stream couldn't be opened for some reason. | |||
| @see getResult() | |||
| */ | |||
| bool failedToOpen() const noexcept { return status.failed(); } | |||
| /** Returns true if the stream opened without problems. | |||
| @see getResult() | |||
| */ | |||
| bool openedOk() const noexcept { return status.wasOk(); } | |||
| /** Attempts to truncate the file to the current write position. | |||
| To truncate a file to a specific size, first use setPosition() to seek to the | |||
| appropriate location, and then call this method. | |||
| */ | |||
| Result truncate(); | |||
| //============================================================================== | |||
| void flush() override; | |||
| int64 getPosition() override; | |||
| bool setPosition (int64) override; | |||
| bool write (const void*, size_t) override; | |||
| bool writeRepeatedByte (uint8 byte, size_t numTimesToRepeat) override; | |||
| private: | |||
| //============================================================================== | |||
| File file; | |||
| void* fileHandle; | |||
| Result status; | |||
| int64 currentPosition; | |||
| size_t bufferSize, bytesInBuffer; | |||
| HeapBlock<char> buffer; | |||
| void openHandle(); | |||
| void closeHandle(); | |||
| void flushInternal(); | |||
| bool flushBuffer(); | |||
| int64 setPositionInternal (int64); | |||
| ssize_t writeInternal (const void*, size_t); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileOutputStream) | |||
| }; | |||
| } | |||
| #endif // JUCE_FILEOUTPUTSTREAM_H_INCLUDED | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_INPUTSOURCE_H_INCLUDED | |||
| #define JUCE_INPUTSOURCE_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -72,10 +74,6 @@ public: | |||
| */ | |||
| virtual int64 hashCode() const = 0; | |||
| #endif | |||
| private: | |||
| //============================================================================== | |||
| JUCE_LEAK_DETECTOR (InputSource) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,10 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_InputSource.h" | |||
| #include "../memory/juce_ByteOrder.h" | |||
| #include "../streams/juce_MemoryOutputStream.h" | |||
| namespace water { | |||
| int64 InputStream::getNumBytesRemaining() | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_INPUTSTREAM_H_INCLUDED | |||
| #define JUCE_INPUTSTREAM_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -263,7 +265,7 @@ protected: | |||
| InputStream() noexcept {} | |||
| private: | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InputStream) | |||
| JUCE_DECLARE_NON_COPYABLE (InputStream) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,9 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_MemoryOutputStream.h" | |||
| #include "juce_InputStream.h" | |||
| namespace water { | |||
| MemoryOutputStream::MemoryOutputStream (const size_t initialSize) | |||
| @@ -31,6 +31,9 @@ | |||
| #ifndef JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED | |||
| #define JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED | |||
| #include "juce_OutputStream.h" | |||
| #include "../memory/juce_MemoryBlock.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -132,7 +135,7 @@ private: | |||
| void trimExternalBlockSize(); | |||
| char* prepareToWrite (size_t); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MemoryOutputStream) | |||
| JUCE_DECLARE_NON_COPYABLE (MemoryOutputStream) | |||
| }; | |||
| /** Copies all the data that has been written to a MemoryOutputStream into another stream. */ | |||
| @@ -28,6 +28,11 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_OutputStream.h" | |||
| #include "../files/juce_FileInputStream.h" | |||
| #include "../memory/juce_ByteOrder.h" | |||
| #include "../text/juce_NewLine.h" | |||
| namespace water { | |||
| #if JUCE_DEBUG | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_OUTPUTSTREAM_H_INCLUDED | |||
| #define JUCE_OUTPUTSTREAM_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -239,7 +241,7 @@ private: | |||
| //============================================================================== | |||
| String newLineString; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OutputStream) | |||
| JUCE_DECLARE_NON_COPYABLE (OutputStream) | |||
| }; | |||
| //============================================================================== | |||
| @@ -31,6 +31,9 @@ | |||
| #ifndef JUCE_CHARPOINTER_UTF8_H_INCLUDED | |||
| #define JUCE_CHARPOINTER_UTF8_H_INCLUDED | |||
| #include "juce_CharacterFunctions.h" | |||
| #include "../memory/juce_Atomic.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_CharacterFunctions.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,10 @@ | |||
| #ifndef JUCE_CHARACTERFUNCTIONS_H_INCLUDED | |||
| #define JUCE_CHARACTERFUNCTIONS_H_INCLUDED | |||
| #include <algorithm> | |||
| #include "../memory/juce_Memory.h" | |||
| /** This macro will be set to 1 if the compiler's native wchar_t is an 8-bit type. */ | |||
| #define JUCE_NATIVE_WCHAR_IS_UTF8 1 | |||
| @@ -28,6 +28,9 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_Identifier.h" | |||
| #include "juce_StringPool.h" | |||
| namespace water { | |||
| Identifier::Identifier() noexcept {} | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_IDENTIFIER_H_INCLUDED | |||
| #define JUCE_IDENTIFIER_H_INCLUDED | |||
| #include "juce_String.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_NEWLINE_H_INCLUDED | |||
| #define JUCE_NEWLINE_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -28,6 +28,11 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_String.h" | |||
| #include "juce_NewLine.h" | |||
| #include "CarlaJuceUtils.hpp" | |||
| namespace water { | |||
| NewLine newLine; | |||
| @@ -332,40 +337,6 @@ String String::charToString (const juce_wchar character) | |||
| //============================================================================== | |||
| namespace NumberToStringConverters | |||
| { | |||
| enum | |||
| { | |||
| charsNeededForInt = 32, | |||
| charsNeededForDouble = 48 | |||
| }; | |||
| template <typename Type> | |||
| static char* printDigits (char* t, Type v) noexcept | |||
| { | |||
| *--t = 0; | |||
| do | |||
| { | |||
| *--t = '0' + (char) (v % 10); | |||
| v /= 10; | |||
| } while (v > 0); | |||
| return t; | |||
| } | |||
| // pass in a pointer to the END of a buffer.. | |||
| static char* numberToString (char* t, const int64 n) noexcept | |||
| { | |||
| if (n >= 0) | |||
| return printDigits (t, static_cast<uint64> (n)); | |||
| // NB: this needs to be careful not to call -std::numeric_limits<int64>::min(), | |||
| // which has undefined behaviour | |||
| t = printDigits (t, static_cast<uint64> (-(n + 1)) + 1); | |||
| *--t = '-'; | |||
| return t; | |||
| } | |||
| static char* numberToString (char* t, uint64 v) noexcept | |||
| { | |||
| return printDigits (t, v); | |||
| @@ -31,6 +31,9 @@ | |||
| #ifndef JUCE_STRING_H_INCLUDED | |||
| #define JUCE_STRING_H_INCLUDED | |||
| #include "juce_CharPointer_UTF8.h" | |||
| #include "../memory/juce_Memory.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -1187,4 +1190,6 @@ OutputStream& operator<< (OutputStream& stream, StringRef stringToWrite); | |||
| } | |||
| #include "juce_StringRef.h" | |||
| #endif // JUCE_STRING_H_INCLUDED | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_StringArray.h" | |||
| namespace water { | |||
| StringArray::StringArray() noexcept | |||
| @@ -31,6 +31,9 @@ | |||
| #ifndef JUCE_STRINGARRAY_H_INCLUDED | |||
| #define JUCE_STRINGARRAY_H_INCLUDED | |||
| #include "juce_String.h" | |||
| #include "../containers/juce_Array.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -420,9 +423,6 @@ public: | |||
| to array methods that may not already be provided by the StringArray class. | |||
| */ | |||
| Array<String> strings; | |||
| private: | |||
| JUCE_LEAK_DETECTOR (StringArray) | |||
| }; | |||
| } | |||
| @@ -28,6 +28,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_StringPool.h" | |||
| namespace water { | |||
| static const int minNumberOfStringsForGarbageCollection = 300; | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_STRINGPOOL_H_INCLUDED | |||
| #define JUCE_STRINGPOOL_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_STRINGREF_H_INCLUDED | |||
| #define JUCE_STRINGREF_H_INCLUDED | |||
| #include "juce_String.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -28,6 +28,10 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_ChildProcess.h" | |||
| #include "../files/juce_File.h" | |||
| #include "../time/juce_Time.h" | |||
| #define JUCE_USE_VFORK 1 | |||
| namespace water { | |||
| @@ -140,7 +144,7 @@ private: | |||
| HANDLE readPipe, writePipe; | |||
| PROCESS_INFORMATION processInfo; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ActiveProcess) | |||
| JUCE_DECLARE_NON_COPYABLE (ActiveProcess) | |||
| }; | |||
| #else | |||
| class ChildProcess::ActiveProcess | |||
| @@ -281,7 +285,7 @@ private: | |||
| int pipeHandle; | |||
| FILE* readHandle; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ActiveProcess) | |||
| JUCE_DECLARE_NON_COPYABLE (ActiveProcess) | |||
| }; | |||
| #endif | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_CHILDPROCESS_H_INCLUDED | |||
| #define JUCE_CHILDPROCESS_H_INCLUDED | |||
| #include "../text/juce_StringArray.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -116,7 +118,7 @@ private: | |||
| class ActiveProcess; | |||
| ScopedPointer<ActiveProcess> activeProcess; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChildProcess) | |||
| JUCE_DECLARE_NON_COPYABLE (ChildProcess) | |||
| }; | |||
| } | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_PROCESS_H_INCLUDED | |||
| #define JUCE_PROCESS_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_SCOPEDLOCK_H_INCLUDED | |||
| #define JUCE_SCOPEDLOCK_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_SPINLOCK_H_INCLUDED | |||
| #define JUCE_SPINLOCK_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -28,9 +28,17 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_Time.h" | |||
| namespace water { | |||
| namespace TimeHelpers | |||
| { | |||
| static uint32 lastMSCounterValue = 0; | |||
| } | |||
| //============================================================================== | |||
| static uint32 juce_millisecondsSinceStartup() noexcept | |||
| { | |||
| #ifdef CARLA_OS_WIN | |||
| @@ -43,11 +51,6 @@ static uint32 juce_millisecondsSinceStartup() noexcept | |||
| #endif | |||
| } | |||
| namespace TimeHelpers | |||
| { | |||
| static uint32 lastMSCounterValue = 0; | |||
| } | |||
| //============================================================================== | |||
| Time::Time() noexcept : millisSinceEpoch (0) | |||
| { | |||
| @@ -31,6 +31,8 @@ | |||
| #ifndef JUCE_TIME_H_INCLUDED | |||
| #define JUCE_TIME_H_INCLUDED | |||
| #include "../water.h" | |||
| namespace water { | |||
| //============================================================================== | |||
| @@ -18,6 +18,8 @@ | |||
| #include "water.h" | |||
| #include "CarlaMutex.hpp" | |||
| #include <locale> | |||
| #include <ctime> | |||
| #include <cctype> | |||
| @@ -44,6 +46,8 @@ | |||
| // #include <wctype.h> | |||
| #include "misc/juce_Result.h" | |||
| //============================================================================== | |||
| namespace water | |||
| { | |||
| @@ -98,41 +102,43 @@ static int64 juce_fileSetPosition (void* handle, int64 pos) | |||
| } | |||
| #include "memory/juce_MemoryBlock.cpp" | |||
| #include "text/juce_CharacterFunctions.cpp" | |||
| #include "text/juce_String.cpp" | |||
| #include "containers/juce_NamedValueSet.cpp" | |||
| #include "containers/juce_Variant.cpp" | |||
| #include "files/juce_DirectoryIterator.cpp" | |||
| #include "files/juce_File.cpp" | |||
| #include "files/juce_FileInputStream.cpp" | |||
| #include "files/juce_FileOutputStream.cpp" | |||
| #include "files/juce_TemporaryFile.cpp" | |||
| #include "maths/juce_Random.cpp" | |||
| #include "memory/juce_MemoryBlock.cpp" | |||
| #include "midi/juce_MidiBuffer.cpp" | |||
| #include "midi/juce_MidiFile.cpp" | |||
| #include "midi/juce_MidiMessage.cpp" | |||
| #include "midi/juce_MidiMessageSequence.cpp" | |||
| #include "midi/juce_MidiFile.cpp" | |||
| #include "maths/juce_Random.cpp" | |||
| #include "misc/juce_Result.cpp" | |||
| #include "processors/juce_AudioProcessor.cpp" | |||
| #include "processors/juce_AudioProcessorGraph.cpp" | |||
| #include "streams/juce_FileInputSource.cpp" | |||
| #include "streams/juce_FileInputStream.cpp" | |||
| #include "streams/juce_FileOutputStream.cpp" | |||
| #include "streams/juce_InputStream.cpp" | |||
| #include "streams/juce_MemoryOutputStream.cpp" | |||
| #include "streams/juce_OutputStream.cpp" | |||
| #include "text/juce_CharacterFunctions.cpp" | |||
| #include "text/juce_Identifier.cpp" | |||
| #include "text/juce_StringArray.cpp" | |||
| #include "text/juce_StringPool.cpp" | |||
| #include "text/juce_String.cpp" | |||
| #include "threads/juce_ChildProcess.cpp" | |||
| #include "time/juce_Time.cpp" | |||
| #include "xml/juce_XmlElement.cpp" | |||
| #include "xml/juce_XmlDocument.cpp" | |||
| #include "xml/juce_XmlElement.cpp" | |||
| @@ -19,12 +19,14 @@ | |||
| #ifndef WATER_H_INCLUDED | |||
| #define WATER_H_INCLUDED | |||
| #include "CarlaMathUtils.hpp" | |||
| #include "CarlaJuceUtils.hpp" | |||
| #include "CarlaMutex.hpp" | |||
| #include "CarlaDefines.h" | |||
| #include <algorithm> | |||
| #include <string> | |||
| // #include "CarlaMathUtils.hpp" | |||
| // #include "CarlaJuceUtils.hpp" | |||
| // #include "CarlaMutex.hpp" | |||
| // #include <algorithm> | |||
| // #include <string> | |||
| //============================================================================== | |||
| @@ -161,9 +163,6 @@ | |||
| #endif | |||
| #define JUCE_DECLARE_NON_COPYABLE(className) CARLA_DECLARE_NON_COPY_CLASS(className) | |||
| #define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className) \ | |||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className) | |||
| #define JUCE_LEAK_DETECTOR(className) CARLA_LEAK_DETECTOR(className) | |||
| #define JUCE_PREVENT_HEAP_ALLOCATION CARLA_PREVENT_HEAP_ALLOCATION | |||
| #define NEEDS_TRANS(x) (x) | |||
| @@ -173,88 +172,144 @@ | |||
| namespace water | |||
| { | |||
| class DynamicObject; | |||
| class AudioProcessor; | |||
| class File; | |||
| class FileInputStream; | |||
| class FileOutputStream; | |||
| class Identifier; | |||
| class InputSource; | |||
| class InputStream; | |||
| class MidiBuffer; | |||
| class MidiMessage; | |||
| class MemoryBlock; | |||
| class MemoryOutputStream; | |||
| class NewLine; | |||
| class OutputStream; | |||
| class Result; | |||
| class String; | |||
| class StringArray; | |||
| class StringRef; | |||
| class Time; | |||
| class XmlElement; | |||
| class AudioProcessor; | |||
| class var; | |||
| //============================================================================== | |||
| // Definitions for the int8, int16, int32, int64 and pointer_sized_int types. | |||
| /** A platform-independent 8-bit signed integer type. */ | |||
| typedef signed char int8; | |||
| /** A platform-independent 8-bit unsigned integer type. */ | |||
| typedef unsigned char uint8; | |||
| /** A platform-independent 16-bit signed integer type. */ | |||
| typedef signed short int16; | |||
| /** A platform-independent 16-bit unsigned integer type. */ | |||
| typedef unsigned short uint16; | |||
| /** A platform-independent 32-bit signed integer type. */ | |||
| typedef signed int int32; | |||
| /** A platform-independent 32-bit unsigned integer type. */ | |||
| typedef unsigned int uint32; | |||
| /** A platform-independent 64-bit integer type. */ | |||
| typedef long long int64; | |||
| /** A platform-independent 64-bit unsigned integer type. */ | |||
| typedef unsigned long long uint64; | |||
| #if JUCE_64BIT | |||
| /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ | |||
| typedef int64 pointer_sized_int; | |||
| /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ | |||
| typedef uint64 pointer_sized_uint; | |||
| #else | |||
| /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ | |||
| typedef int pointer_sized_int; | |||
| /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ | |||
| typedef unsigned int pointer_sized_uint; | |||
| #endif | |||
| //============================================================================== | |||
| namespace NumberToStringConverters | |||
| { | |||
| enum | |||
| { | |||
| charsNeededForInt = 32, | |||
| charsNeededForDouble = 48 | |||
| }; | |||
| template <typename Type> | |||
| static char* printDigits (char* t, Type v) noexcept | |||
| { | |||
| *--t = 0; | |||
| do | |||
| { | |||
| *--t = '0' + (char) (v % 10); | |||
| v /= 10; | |||
| } while (v > 0); | |||
| return t; | |||
| } | |||
| // pass in a pointer to the END of a buffer.. | |||
| static char* numberToString (char* t, const int64 n) noexcept | |||
| { | |||
| if (n >= 0) | |||
| return printDigits (t, static_cast<uint64> (n)); | |||
| // NB: this needs to be careful not to call -std::numeric_limits<int64>::min(), | |||
| // which has undefined behaviour | |||
| t = printDigits (t, static_cast<uint64> (-(n + 1)) + 1); | |||
| *--t = '-'; | |||
| return t; | |||
| } | |||
| } | |||
| #include "memory/juce_Memory.h" | |||
| #include "maths/juce_MathsFunctions.h" | |||
| #include "memory/juce_ByteOrder.h" | |||
| #include "memory/juce_Atomic.h" | |||
| #include "text/juce_CharacterFunctions.h" | |||
| #include "text/juce_CharPointer_UTF8.h" | |||
| #include "text/juce_String.h" | |||
| #include "memory/juce_HeapBlock.h" | |||
| #include "containers/juce_ElementComparator.h" | |||
| #include "containers/juce_ArrayAllocationBase.h" | |||
| #include "containers/juce_Array.h" | |||
| #include "text/juce_StringArray.h" | |||
| #include "text/juce_StringRef.h" | |||
| #include "memory/juce_MemoryBlock.h" | |||
| #include "memory/juce_ReferenceCountedObject.h" | |||
| #include "text/juce_Identifier.h" | |||
| #include "text/juce_NewLine.h" | |||
| #include "threads/juce_ScopedLock.h" | |||
| #include "threads/juce_SpinLock.h" | |||
| #include "memory/juce_SharedResourcePointer.h" | |||
| #include "containers/juce_LinkedListPointer.h" | |||
| #include "containers/juce_OwnedArray.h" | |||
| #include "containers/juce_ReferenceCountedArray.h" | |||
| #include "containers/juce_SortedSet.h" | |||
| #include "containers/juce_Variant.h" | |||
| #include "containers/juce_NamedValueSet.h" | |||
| #include "streams/juce_InputSource.h" | |||
| #include "streams/juce_InputStream.h" | |||
| #include "streams/juce_OutputStream.h" | |||
| #include "streams/juce_MemoryOutputStream.h" | |||
| #include "maths/juce_Random.h" | |||
| #include "misc/juce_Result.h" | |||
| #include "text/juce_StringPool.h" | |||
| #include "time/juce_Time.h" | |||
| #include "files/juce_File.h" | |||
| #include "files/juce_DirectoryIterator.h" | |||
| #include "files/juce_TemporaryFile.h" | |||
| #include "streams/juce_FileInputStream.h" | |||
| #include "streams/juce_FileInputSource.h" | |||
| #include "streams/juce_FileOutputStream.h" | |||
| #include "buffers/juce_AudioSampleBuffer.h" | |||
| #include "midi/juce_MidiBuffer.h" | |||
| #include "midi/juce_MidiMessage.h" | |||
| #include "midi/juce_MidiMessageSequence.h" | |||
| #include "midi/juce_MidiFile.h" | |||
| #include "processors/juce_AudioPlayHead.h" | |||
| #include "processors/juce_AudioProcessor.h" | |||
| #include "processors/juce_AudioProcessorGraph.h" | |||
| #include "threads/juce_ChildProcess.h" | |||
| #include "threads/juce_Process.h" | |||
| #include "xml/juce_XmlElement.h" | |||
| #include "xml/juce_XmlDocument.h" | |||
| //============================================================================== | |||
| /** This namespace contains a few template classes for helping work out class type variations. | |||
| */ | |||
| namespace TypeHelpers | |||
| { | |||
| /** The ParameterType struct is used to find the best type to use when passing some kind | |||
| of object as a parameter. | |||
| Of course, this is only likely to be useful in certain esoteric template situations. | |||
| Because "typename TypeHelpers::ParameterType<SomeClass>::type" is a bit of a mouthful, there's | |||
| a PARAMETER_TYPE(SomeClass) macro that you can use to get the same effect. | |||
| E.g. "myFunction (PARAMETER_TYPE (int), PARAMETER_TYPE (MyObject))" | |||
| would evaluate to "myfunction (int, const MyObject&)", keeping any primitive types as | |||
| pass-by-value, but passing objects as a const reference, to avoid copying. | |||
| */ | |||
| template <typename Type> struct ParameterType { typedef const Type& type; }; | |||
| template <typename Type> struct ParameterType <Type&> { typedef Type& type; }; | |||
| template <typename Type> struct ParameterType <Type*> { typedef Type* type; }; | |||
| template <> struct ParameterType <char> { typedef char type; }; | |||
| template <> struct ParameterType <unsigned char> { typedef unsigned char type; }; | |||
| template <> struct ParameterType <short> { typedef short type; }; | |||
| template <> struct ParameterType <unsigned short> { typedef unsigned short type; }; | |||
| template <> struct ParameterType <int> { typedef int type; }; | |||
| template <> struct ParameterType <unsigned int> { typedef unsigned int type; }; | |||
| template <> struct ParameterType <long> { typedef long type; }; | |||
| template <> struct ParameterType <unsigned long> { typedef unsigned long type; }; | |||
| template <> struct ParameterType <int64> { typedef int64 type; }; | |||
| template <> struct ParameterType <uint64> { typedef uint64 type; }; | |||
| template <> struct ParameterType <bool> { typedef bool type; }; | |||
| template <> struct ParameterType <float> { typedef float type; }; | |||
| template <> struct ParameterType <double> { typedef double type; }; | |||
| /** A helpful macro to simplify the use of the ParameterType template. | |||
| @see ParameterType | |||
| */ | |||
| #define PARAMETER_TYPE(a) typename TypeHelpers::ParameterType<a>::type | |||
| /** These templates are designed to take a type, and if it's a double, they return a double | |||
| type; for anything else, they return a float type. | |||
| */ | |||
| template <typename Type> struct SmallestFloatType { typedef float type; }; | |||
| template <> struct SmallestFloatType <double> { typedef double type; }; | |||
| } | |||
| } | |||
| #endif // WATER_H_INCLUDED | |||
| @@ -28,6 +28,11 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "juce_XmlDocument.h" | |||
| #include "juce_XmlElement.h" | |||
| #include "../containers/juce_LinkedListPointer.h" | |||
| #include "../streams/juce_FileInputSource.h" | |||
| namespace water { | |||
| XmlDocument::XmlDocument (const String& documentText) | |||