Browse Source

More water cleanup

tags/1.9.8
falkTX 7 years ago
parent
commit
b4690e48cc
82 changed files with 515 additions and 1042 deletions
  1. +3
    -3
      source/backend/CarlaStandalone.cpp
  2. +3
    -3
      source/backend/CarlaUtils.cpp
  3. +5
    -5
      source/backend/engine/CarlaEngineGraph.cpp
  4. +1
    -1
      source/libjack/libjack.cpp
  5. +12
    -10
      source/modules/water/buffers/AudioSampleBuffer.h
  6. +7
    -7
      source/modules/water/containers/Array.h
  7. +4
    -4
      source/modules/water/containers/ArrayAllocationBase.h
  8. +5
    -5
      source/modules/water/containers/ElementComparator.h
  9. +4
    -4
      source/modules/water/containers/LinkedListPointer.h
  10. +2
    -2
      source/modules/water/containers/NamedValueSet.cpp
  11. +6
    -6
      source/modules/water/containers/NamedValueSet.h
  12. +5
    -5
      source/modules/water/containers/OwnedArray.h
  13. +3
    -3
      source/modules/water/containers/ReferenceCountedArray.h
  14. +3
    -3
      source/modules/water/containers/SortedSet.h
  15. +2
    -2
      source/modules/water/containers/Variant.cpp
  16. +4
    -4
      source/modules/water/containers/Variant.h
  17. +3
    -3
      source/modules/water/files/DirectoryIterator.h
  18. +54
    -63
      source/modules/water/files/File.cpp
  19. +6
    -25
      source/modules/water/files/File.h
  20. +2
    -3
      source/modules/water/files/FileInputStream.cpp
  21. +3
    -3
      source/modules/water/files/FileInputStream.h
  22. +2
    -2
      source/modules/water/files/FileOutputStream.cpp
  23. +3
    -3
      source/modules/water/files/FileOutputStream.h
  24. +3
    -3
      source/modules/water/files/TemporaryFile.h
  25. +9
    -9
      source/modules/water/maths/MathsFunctions.h
  26. +3
    -3
      source/modules/water/maths/Random.h
  27. +3
    -3
      source/modules/water/memory/Atomic.h
  28. +7
    -7
      source/modules/water/memory/ByteOrder.h
  29. +4
    -4
      source/modules/water/memory/HeapBlock.h
  30. +3
    -3
      source/modules/water/memory/Memory.h
  31. +2
    -61
      source/modules/water/memory/MemoryBlock.cpp
  32. +4
    -32
      source/modules/water/memory/MemoryBlock.h
  33. +4
    -4
      source/modules/water/memory/ReferenceCountedObject.h
  34. +4
    -4
      source/modules/water/memory/SharedResourcePointer.h
  35. +3
    -3
      source/modules/water/midi/MidiBuffer.h
  36. +3
    -3
      source/modules/water/midi/MidiFile.h
  37. +1
    -142
      source/modules/water/midi/MidiMessage.cpp
  38. +7
    -37
      source/modules/water/midi/MidiMessage.h
  39. +4
    -4
      source/modules/water/midi/MidiMessageSequence.h
  40. +1
    -1
      source/modules/water/misc/Result.cpp
  41. +4
    -4
      source/modules/water/misc/Result.h
  42. +2
    -2
      source/modules/water/misc/Time.cpp
  43. +3
    -3
      source/modules/water/misc/Time.h
  44. +10
    -15
      source/modules/water/processors/AudioPlayHead.h
  45. +7
    -12
      source/modules/water/processors/AudioProcessor.cpp
  46. +10
    -15
      source/modules/water/processors/AudioProcessor.h
  47. +7
    -12
      source/modules/water/processors/AudioProcessorGraph.cpp
  48. +10
    -15
      source/modules/water/processors/AudioProcessorGraph.h
  49. +3
    -3
      source/modules/water/streams/FileInputSource.h
  50. +3
    -3
      source/modules/water/streams/InputSource.h
  51. +3
    -3
      source/modules/water/streams/InputStream.h
  52. +1
    -1
      source/modules/water/streams/MemoryOutputStream.cpp
  53. +4
    -4
      source/modules/water/streams/MemoryOutputStream.h
  54. +1
    -30
      source/modules/water/streams/OutputStream.cpp
  55. +3
    -3
      source/modules/water/streams/OutputStream.h
  56. +19
    -19
      source/modules/water/text/CharPointer_UTF8.h
  57. +15
    -15
      source/modules/water/text/CharacterFunctions.cpp
  58. +34
    -34
      source/modules/water/text/CharacterFunctions.h
  59. +1
    -1
      source/modules/water/text/Identifier.cpp
  60. +4
    -4
      source/modules/water/text/Identifier.h
  61. +3
    -3
      source/modules/water/text/NewLine.h
  62. +50
    -56
      source/modules/water/text/String.cpp
  63. +25
    -25
      source/modules/water/text/String.h
  64. +3
    -3
      source/modules/water/text/StringArray.cpp
  65. +6
    -6
      source/modules/water/text/StringArray.h
  66. +3
    -3
      source/modules/water/text/StringPool.h
  67. +4
    -4
      source/modules/water/text/StringRef.h
  68. +0
    -23
      source/modules/water/threads/ChildProcess.cpp
  69. +3
    -3
      source/modules/water/threads/ChildProcess.h
  70. +0
    -148
      source/modules/water/threads/Process.h
  71. +3
    -3
      source/modules/water/threads/ScopedLock.h
  72. +6
    -5
      source/modules/water/threads/SpinLock.h
  73. +3
    -3
      source/modules/water/water.cpp
  74. +8
    -16
      source/modules/water/water.h
  75. +1
    -1
      source/modules/water/water.mm
  76. +22
    -24
      source/modules/water/xml/XmlDocument.cpp
  77. +4
    -4
      source/modules/water/xml/XmlDocument.h
  78. +11
    -13
      source/modules/water/xml/XmlElement.cpp
  79. +5
    -5
      source/modules/water/xml/XmlElement.h
  80. +1
    -1
      source/native-plugins/Makefile
  81. +2
    -2
      source/plugin/carla-lv2-export.cpp
  82. +1
    -1
      source/tests/CarlaUtils1.cpp

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

@@ -145,7 +145,7 @@ static void carla_engine_init_common()

#ifdef BUILD_BRIDGE
using water::File;
File juceBinaryDir(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory());
File waterBinaryDir(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory());

/*
if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_FORCE_STEREO"))
@@ -191,12 +191,12 @@ static void carla_engine_init_common()
if (const char* const binaryDir = std::getenv("ENGINE_OPTION_PATH_BINARIES"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, binaryDir);
else
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, juceBinaryDir.getFullPathName().toRawUTF8());
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, waterBinaryDir.getFullPathName().toRawUTF8());

if (const char* const resourceDir = std::getenv("ENGINE_OPTION_PATH_RESOURCES"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, resourceDir);
else
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, juceBinaryDir.getChildFile("resources").getFullPathName().toRawUTF8());
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, waterBinaryDir.getChildFile("resources").getFullPathName().toRawUTF8());

if (const char* const preventBadBehaviour = std::getenv("ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, (std::strcmp(preventBadBehaviour, "true") == 0) ? 1 : 0, nullptr);


+ 3
- 3
source/backend/CarlaUtils.cpp View File

@@ -520,17 +520,17 @@ const char* carla_get_supported_file_extensions()
AudioFormatManager afm;
afm.registerBasicFormats();

String juceFormats;
String waterFormats;

for (AudioFormat **it=afm.begin(), **end=afm.end(); it != end; ++it)
{
const StringArray& exts((*it)->getFileExtensions());

for (String *eit=exts.begin(), *eend=exts.end(); eit != eend; ++eit)
juceFormats += String(";*" + (*eit)).toRawUTF8();
waterFormats += String(";*" + (*eit)).toRawUTF8();
}

retText += juceFormats.toRawUTF8();
retText += waterFormats.toRawUTF8();
}
#endif
}


+ 5
- 5
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -1544,7 +1544,7 @@ bool PatchbayGraph::connect(const bool external, const uint groupA, const uint p

if (! graph.addConnection(groupA, static_cast<int>(adjustedPortA), groupB, static_cast<int>(adjustedPortB)))
{
kEngine->setLastError("Failed from juce");
kEngine->setLastError("Failed from water");
return false;
}

@@ -1806,13 +1806,13 @@ void PatchbayGraph::process(CarlaEngine::ProtectedData* const data, const float*
CARLA_SAFE_ASSERT_RETURN(data->events.out != nullptr,);
CARLA_SAFE_ASSERT_RETURN(frames > 0,);

// put events in juce buffer
// put events in water buffer
{
midiBuffer.clear();
fillWaterMidiBufferFromEngineEvents(midiBuffer, data->events.in);
}

// put carla audio in juce buffer
// put carla audio in water buffer
{
int i=0;

@@ -1826,13 +1826,13 @@ void PatchbayGraph::process(CarlaEngine::ProtectedData* const data, const float*

graph.processBlock(audioBuffer, midiBuffer);

// put juce audio in carla buffer
// put water audio in carla buffer
{
for (int i=0; i < static_cast<int>(outputs); ++i)
carla_copyFloats(outBuf[i], audioBuffer.getReadPointer(i), frames);
}

// put juce events in carla buffer
// put water events in carla buffer
{
carla_zeroStructs(data->events.out, kMaxEngineEventInternalCount);
fillEngineEventsFromWaterMidiBuffer(data->events.out, midiBuffer);


+ 1
- 1
source/libjack/libjack.cpp View File

@@ -1217,7 +1217,7 @@ int jack_client_real_time_priority(jack_client_t* client)
{
carla_debug("%s(%p)", __FUNCTION__, client);

// code as used by juce
// code as used by water
const int minPriority = sched_get_priority_min(SCHED_RR);
const int maxPriority = sched_get_priority_max(SCHED_RR);
return ((maxPriority - minPriority) * 9) / 10 + minPriority;


+ 12
- 10
source/modules/water/buffers/AudioSampleBuffer.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED
#define JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED
#ifndef WATER_AUDIOSAMPLEBUFFER_H_INCLUDED
#define WATER_AUDIOSAMPLEBUFFER_H_INCLUDED
#include "../memory/HeapBlock.h"
@@ -65,8 +65,8 @@ public:
: numChannels (numChannelsToAllocate),
size (numSamplesToAllocate)
{
jassert (size >= 0);
jassert (numChannels >= 0);
CARLA_SAFE_ASSERT_RETURN (size >= 0,);
CARLA_SAFE_ASSERT_RETURN (numChannels >= 0,);
allocateData();
}
@@ -93,8 +93,9 @@ public:
size (numSamples),
allocatedBytes (0)
{
jassert (dataToReferTo != nullptr);
jassert (numChannelsToUse >= 0 && numSamples >= 0);
CARLA_SAFE_ASSERT_RETURN (dataToReferTo != nullptr,);
CARLA_SAFE_ASSERT_RETURN (numChannelsToUse >= 0 && numSamples >= 0,);
allocateChannels (dataToReferTo, 0);
}
@@ -123,8 +124,9 @@ public:
allocatedBytes (0),
isClear (false)
{
jassert (dataToReferTo != nullptr);
jassert (numChannelsToUse >= 0 && startSample >= 0 && numSamples >= 0);
CARLA_SAFE_ASSERT_RETURN (dataToReferTo != nullptr,);
CARLA_SAFE_ASSERT_RETURN (numChannelsToUse >= 0 && startSample >= 0 && numSamples >= 0,);
allocateChannels (dataToReferTo, startSample);
}
@@ -189,7 +191,7 @@ public:
*/
~AudioSampleBuffer() noexcept {}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Move constructor */
AudioSampleBuffer (AudioSampleBuffer&& other) noexcept
: numChannels (other.numChannels),
@@ -1095,4 +1097,4 @@ private:
}
#endif // JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED
#endif // WATER_AUDIOSAMPLEBUFFER_H_INCLUDED

+ 7
- 7
source/modules/water/containers/Array.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_ARRAY_H_INCLUDED
#define JUCE_ARRAY_H_INCLUDED
#ifndef WATER_ARRAY_H_INCLUDED
#define WATER_ARRAY_H_INCLUDED
#include "../containers/ArrayAllocationBase.h"
#include "../containers/ElementComparator.h"
@@ -77,7 +77,7 @@ public:
new (data.elements + i) ElementType (other.data.elements[i]);
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
Array (Array<ElementType>&& other) noexcept
: data (static_cast<ArrayAllocationBase<ElementType>&&> (other.data)),
numUsed (other.numUsed)
@@ -131,7 +131,7 @@ public:
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
Array& operator= (Array&& other) noexcept
{
deleteAllElements();
@@ -313,7 +313,7 @@ public:
*/
inline ElementType* end() const noexcept
{
#if JUCE_DEBUG
#ifdef DEBUG
if (data.elements == nullptr || numUsed <= 0) // (to keep static analysers happy)
return data.elements;
#endif
@@ -371,7 +371,7 @@ public:
new (data.elements + numUsed++) ElementType (newElement);
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Appends a new element at the end of the array.
@param newElement the new object to add to the array
@@ -1130,4 +1130,4 @@ private:
}
#endif // JUCE_ARRAY_H_INCLUDED
#endif // WATER_ARRAY_H_INCLUDED

+ 4
- 4
source/modules/water/containers/ArrayAllocationBase.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_ARRAYALLOCATIONBASE_H_INCLUDED
#define JUCE_ARRAYALLOCATIONBASE_H_INCLUDED
#ifndef WATER_ARRAYALLOCATIONBASE_H_INCLUDED
#define WATER_ARRAYALLOCATIONBASE_H_INCLUDED
#include "../memory/HeapBlock.h"
@@ -60,7 +60,7 @@ public:
{
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
ArrayAllocationBase (ArrayAllocationBase<ElementType>&& other) noexcept
: elements (static_cast<HeapBlock<ElementType>&&> (other.elements)),
numAllocated (other.numAllocated)
@@ -138,4 +138,4 @@ private:
}
#endif // JUCE_ARRAYALLOCATIONBASE_H_INCLUDED
#endif // WATER_ARRAYALLOCATIONBASE_H_INCLUDED

+ 5
- 5
source/modules/water/containers/ElementComparator.h View File

@@ -23,14 +23,14 @@
==============================================================================
*/
#ifndef JUCE_ELEMENTCOMPARATOR_H_INCLUDED
#define JUCE_ELEMENTCOMPARATOR_H_INCLUDED
#ifndef WATER_ELEMENTCOMPARATOR_H_INCLUDED
#define WATER_ELEMENTCOMPARATOR_H_INCLUDED
#include "../water.h"
namespace water {
/** This is an internal helper class which converts a juce ElementComparator style
/** This is an internal helper class which converts an ElementComparator style
class (using a "compareElements" method) into a class that's compatible with
std::sort (i.e. using an operator() to compare the elements)
*/
@@ -44,7 +44,7 @@ struct SortFunctionConverter
private:
ElementComparator& comparator;
SortFunctionConverter& operator= (const SortFunctionConverter&) JUCE_DELETED_FUNCTION;
SortFunctionConverter& operator= (const SortFunctionConverter&) WATER_DELETED_FUNCTION;
};
//==============================================================================
@@ -189,4 +189,4 @@ public:
}
#endif // JUCE_ELEMENTCOMPARATOR_H_INCLUDED
#endif // WATER_ELEMENTCOMPARATOR_H_INCLUDED

+ 4
- 4
source/modules/water/containers/LinkedListPointer.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_LINKEDLISTPOINTER_H_INCLUDED
#define JUCE_LINKEDLISTPOINTER_H_INCLUDED
#ifndef WATER_LINKEDLISTPOINTER_H_INCLUDED
#define WATER_LINKEDLISTPOINTER_H_INCLUDED
#include "../water.h"
@@ -81,7 +81,7 @@ public:
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
LinkedListPointer (LinkedListPointer&& other) noexcept
: item (other.item)
{
@@ -369,4 +369,4 @@ private:
}
#endif // JUCE_LINKEDLISTPOINTER_H_INCLUDED
#endif // WATER_LINKEDLISTPOINTER_H_INCLUDED

+ 2
- 2
source/modules/water/containers/NamedValueSet.cpp View File

@@ -44,7 +44,7 @@ NamedValueSet& NamedValueSet::operator= (const NamedValueSet& other)
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
NamedValueSet::NamedValueSet (NamedValueSet&& other) noexcept
: values (static_cast<Array<NamedValue>&&> (other.values))
{
@@ -117,7 +117,7 @@ var* NamedValueSet::getVarPointer (const Identifier& name) const noexcept
return nullptr;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
bool NamedValueSet::set (const Identifier& name, var&& newValue)
{
if (var* const v = getVarPointer (name))


+ 6
- 6
source/modules/water/containers/NamedValueSet.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_NAMEDVALUESET_H_INCLUDED
#define JUCE_NAMEDVALUESET_H_INCLUDED
#ifndef WATER_NAMEDVALUESET_H_INCLUDED
#define WATER_NAMEDVALUESET_H_INCLUDED
#include "Array.h"
#include "Variant.h"
@@ -50,7 +50,7 @@ public:
/** Replaces this set with a copy of another set. */
NamedValueSet& operator= (const NamedValueSet&);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
NamedValueSet (NamedValueSet&&) noexcept;
NamedValueSet& operator= (NamedValueSet&&) noexcept;
#endif
@@ -68,7 +68,7 @@ public:
NamedValue (const Identifier& n, const var& v) : name (n), value (v) {}
NamedValue (const NamedValue& other) : name (other.name), value (other.value) {}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
NamedValue (NamedValue&& other) noexcept
: name (static_cast<Identifier&&> (other.name)),
value (static_cast<var&&> (other.value))
@@ -124,7 +124,7 @@ public:
*/
bool set (const Identifier& name, const var& newValue);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Changes or adds a named value.
@returns true if a value was changed or added; false if the
value was already set the value passed-in.
@@ -186,4 +186,4 @@ private:
}
#endif // JUCE_NAMEDVALUESET_H_INCLUDED
#endif // WATER_NAMEDVALUESET_H_INCLUDED

+ 5
- 5
source/modules/water/containers/OwnedArray.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_OWNEDARRAY_H_INCLUDED
#define JUCE_OWNEDARRAY_H_INCLUDED
#ifndef WATER_OWNEDARRAY_H_INCLUDED
#define WATER_OWNEDARRAY_H_INCLUDED
#include "ArrayAllocationBase.h"
@@ -73,7 +73,7 @@ public:
deleteAllObjects();
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
OwnedArray (OwnedArray&& other) noexcept
: data (static_cast<ArrayAllocationBase <ObjectClass*>&&> (other.data)),
numUsed (other.numUsed)
@@ -213,7 +213,7 @@ public:
*/
inline ObjectClass** end() const noexcept
{
#if JUCE_DEBUG
#ifdef DEBUG
if (data.elements == nullptr || numUsed <= 0) // (to keep static analysers happy)
return data.elements;
#endif
@@ -839,4 +839,4 @@ private:
}
#endif // JUCE_OWNEDARRAY_H_INCLUDED
#endif // WATER_OWNEDARRAY_H_INCLUDED

+ 3
- 3
source/modules/water/containers/ReferenceCountedArray.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED
#define JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED
#ifndef WATER_REFERENCECOUNTEDARRAY_H_INCLUDED
#define WATER_REFERENCECOUNTEDARRAY_H_INCLUDED
#include "../memory/ReferenceCountedObject.h"
@@ -852,4 +852,4 @@ private:
}
#endif // JUCE_REFERENCECOUNTEDARRAY_H_INCLUDED
#endif // WATER_REFERENCECOUNTEDARRAY_H_INCLUDED

+ 3
- 3
source/modules/water/containers/SortedSet.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_SORTEDSET_H_INCLUDED
#define JUCE_SORTEDSET_H_INCLUDED
#ifndef WATER_SORTEDSET_H_INCLUDED
#define WATER_SORTEDSET_H_INCLUDED
#include "../water.h"
@@ -463,4 +463,4 @@ private:
}
#endif // JUCE_SORTEDSET_H_INCLUDED
#endif // WATER_SORTEDSET_H_INCLUDED

+ 2
- 2
source/modules/water/containers/Variant.cpp View File

@@ -164,7 +164,7 @@ public:
int toInt (const ValueUnion& data) const noexcept override { return data.boolValue ? 1 : 0; };
int64 toInt64 (const ValueUnion& data) const noexcept override { return data.boolValue ? 1 : 0; };
double toDouble (const ValueUnion& data) const noexcept override { return data.boolValue ? 1.0 : 0.0; }
String toString (const ValueUnion& data) const override { return String::charToString (data.boolValue ? (juce_wchar) '1' : (juce_wchar) '0'); }
String toString (const ValueUnion& data) const override { return String::charToString (data.boolValue ? (water_uchar) '1' : (water_uchar) '0'); }
bool toBool (const ValueUnion& data) const noexcept override { return data.boolValue; }
bool isBool() const noexcept override { return true; }
@@ -265,7 +265,7 @@ var& var::operator= (const double v) { type->cleanUp (value); type =
var& var::operator= (const char* const v) { type->cleanUp (value); type = &VariantType_String::instance; new (value.stringValue) String (v); return *this; }
var& var::operator= (const String& v) { type->cleanUp (value); type = &VariantType_String::instance; new (value.stringValue) String (v); return *this; }
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
var::var (var&& other) noexcept
: type (other.type),
value (other.value)


+ 4
- 4
source/modules/water/containers/Variant.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_VARIANT_H_INCLUDED
#define JUCE_VARIANT_H_INCLUDED
#ifndef WATER_VARIANT_H_INCLUDED
#define WATER_VARIANT_H_INCLUDED
#include "../water.h"
@@ -69,7 +69,7 @@ public:
var& operator= (const char* value);
var& operator= (const String& value);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
var (var&&) noexcept;
var (String&&);
var& operator= (var&&) noexcept;
@@ -175,4 +175,4 @@ struct VariantConverter<String>
}
#endif // JUCE_VARIANT_H_INCLUDED
#endif // WATER_VARIANT_H_INCLUDED

+ 3
- 3
source/modules/water/files/DirectoryIterator.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_DIRECTORYITERATOR_H_INCLUDED
#define JUCE_DIRECTORYITERATOR_H_INCLUDED
#ifndef WATER_DIRECTORYITERATOR_H_INCLUDED
#define WATER_DIRECTORYITERATOR_H_INCLUDED
#include "File.h"
#include "../text/StringArray.h"
@@ -159,4 +159,4 @@ private:
}
#endif // JUCE_DIRECTORYITERATOR_H_INCLUDED
#endif // WATER_DIRECTORYITERATOR_H_INCLUDED

+ 54
- 63
source/modules/water/files/File.cpp View File

@@ -77,7 +77,7 @@ File& File::operator= (const File& other)
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
File::File (File&& other) noexcept
: fullPath (static_cast<String&&> (other.fullPath))
{
@@ -196,23 +196,14 @@ String File::parseAbsolutePath (const String& p)
}
else if (! path.startsWithChar (separator))
{
#if JUCE_DEBUG || JUCE_LOG_ASSERTIONS
if (! (path.startsWith ("./") || path.startsWith ("../")))
{
/* When you supply a raw string to the File object constructor, it must be an absolute path.
If you're trying to parse a string that may be either a relative path or an absolute path,
you MUST provide a context against which the partial path can be evaluated - you can do
this by simply using File::getChildFile() instead of the File constructor. E.g. saying
"File::getCurrentWorkingDirectory().getChildFile (myUnknownPath)" would return an absolute
path if that's what was supplied, or would evaluate a partial path relative to the CWD.
*/
jassertfalse;
#if JUCE_LOG_ASSERTIONS
Logger::writeToLog ("Illegal absolute path: " + path);
#endif
}
#endif
/* When you supply a raw string to the File object constructor, it must be an absolute path.
If you're trying to parse a string that may be either a relative path or an absolute path,
you MUST provide a context against which the partial path can be evaluated - you can do
this by simply using File::getChildFile() instead of the File constructor. E.g. saying
"File::getCurrentWorkingDirectory().getChildFile (myUnknownPath)" would return an absolute
path if that's what was supplied, or would evaluate a partial path relative to the CWD.
*/
CARLA_SAFE_ASSERT_RETURN(path.startsWith ("./") || path.startsWith ("../"), String());
return File::getCurrentWorkingDirectory().getChildFile (path).getFullPathName();
}
@@ -399,7 +390,7 @@ int64 File::hashCode64() const { return fullPath.hashCode64(); }
//==============================================================================
bool File::isAbsolutePath (StringRef path)
{
const juce_wchar firstChar = *(path.text);
const water_uchar firstChar = *(path.text);
return firstChar == separator
#ifdef CARLA_OS_WIN
@@ -417,7 +408,7 @@ File File::getChildFile (StringRef relativePath) const
return File (String (r));
#ifdef CARLA_OS_WIN
if (r.indexOf ((juce_wchar) '/') >= 0)
if (r.indexOf ((water_uchar) '/') >= 0)
return getChildFile (String (r).replaceCharacter ('/', '\\'));
#endif
@@ -426,11 +417,11 @@ File File::getChildFile (StringRef relativePath) const
while (*r == '.')
{
String::CharPointerType lastPos = r;
const juce_wchar secondChar = *++r;
const water_uchar secondChar = *++r;
if (secondChar == '.') // remove "../"
{
const juce_wchar thirdChar = *++r;
const water_uchar thirdChar = *++r;
if (thirdChar == separator || thirdChar == 0)
{
@@ -664,7 +655,7 @@ bool File::hasFileExtension (StringRef possibleSuffix) const
if (possibleSuffix.isEmpty())
return fullPath.lastIndexOfChar ('.') <= fullPath.lastIndexOfChar (separator);
const int semicolon = possibleSuffix.text.indexOf ((juce_wchar) ';');
const int semicolon = possibleSuffix.text.indexOf ((water_uchar) ';');
if (semicolon >= 0)
return hasFileExtension (String (possibleSuffix.text).substring (0, semicolon).trimEnd())
@@ -849,7 +840,7 @@ static int countNumberOfSeparators (String::CharPointerType s)
for (;;)
{
const juce_wchar c = s.getAndAdvance();
const water_uchar c = s.getAndAdvance();
if (c == 0)
break;
@@ -881,8 +872,8 @@ String File::getRelativePathFrom (const File& dir) const
for (int i = 0;;)
{
const juce_wchar c1 = thisPathIter.getAndAdvance();
const juce_wchar c2 = dirPathIter.getAndAdvance();
const water_uchar c1 = thisPathIter.getAndAdvance();
const water_uchar c2 = dirPathIter.getAndAdvance();
#if NAMES_ARE_CASE_SENSITIVE
if (c1 != c2
@@ -959,7 +950,7 @@ bool File::createSymbolicLink (const File& linkFileToCreate, bool overwriteExist
}
return true;
#elif JUCE_MSVC
#elif _MSVC_VER
return CreateSymbolicLink (linkFileToCreate.getFullPathName().toUTF8(),
fullPath.toUTF8(),
isDirectory() ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0) != FALSE;
@@ -1019,7 +1010,7 @@ namespace WindowsFileHelpers
}
}
const juce_wchar File::separator = '\\';
const water_uchar File::separator = '\\';
const String File::separatorString ("\\");
bool File::isDirectory() const
@@ -1210,23 +1201,23 @@ private:
namespace
{
#if CARLA_OS_MAC
typedef struct stat juce_statStruct;
#define JUCE_STAT stat
typedef struct stat water_statStruct;
#define WATER_STAT stat
#else
typedef struct stat64 juce_statStruct;
#define JUCE_STAT stat64
typedef struct stat64 water_statStruct;
#define WATER_STAT stat64
#endif
bool juce_stat (const String& fileName, juce_statStruct& info)
bool water_stat (const String& fileName, water_statStruct& info)
{
return fileName.isNotEmpty()
&& JUCE_STAT (fileName.toUTF8(), &info) == 0;
&& WATER_STAT (fileName.toUTF8(), &info) == 0;
}
#if CARLA_OS_MAC
static int64 getCreationTime (const juce_statStruct& s) noexcept { return (int64) s.st_birthtime; }
static int64 getCreationTime (const water_statStruct& s) noexcept { return (int64) s.st_birthtime; }
#else
static int64 getCreationTime (const juce_statStruct& s) noexcept { return (int64) s.st_ctime; }
static int64 getCreationTime (const water_statStruct& s) noexcept { return (int64) s.st_ctime; }
#endif
void updateStatInfoForFile (const String& path, bool* const isDir, int64* const fileSize,
@@ -1234,8 +1225,8 @@ namespace
{
if (isDir != nullptr || fileSize != nullptr || modTime != nullptr || creationTime != nullptr)
{
juce_statStruct info;
const bool statOk = juce_stat (path, info);
water_statStruct info;
const bool statOk = water_stat (path, info);
if (isDir != nullptr) *isDir = statOk && ((info.st_mode & S_IFDIR) != 0);
if (fileSize != nullptr) *fileSize = statOk ? (int64) info.st_size : 0;
@@ -1253,15 +1244,15 @@ namespace
}
}
const juce_wchar File::separator = '/';
const water_uchar File::separator = '/';
const String File::separatorString ("/");
bool File::isDirectory() const
{
juce_statStruct info;
water_statStruct info;
return fullPath.isNotEmpty()
&& (juce_stat (fullPath, info) && ((info.st_mode & S_IFDIR) != 0));
&& (water_stat (fullPath, info) && ((info.st_mode & S_IFDIR) != 0));
}
bool File::exists() const
@@ -1288,8 +1279,8 @@ bool File::hasWriteAccess() const
int64 File::getSize() const
{
juce_statStruct info;
return juce_stat (fullPath, info) ? info.st_size : 0;
water_statStruct info;
return water_stat (fullPath, info) ? info.st_size : 0;
}
bool File::deleteFile() const
@@ -1347,15 +1338,15 @@ File File::getCurrentWorkingDirectory()
return File (CharPointer_UTF8 (cwd));
}
File juce_getExecutableFile();
File juce_getExecutableFile()
File water_getExecutableFile();
File water_getExecutableFile()
{
struct DLAddrReader
{
static String getFilename()
{
Dl_info exeInfo;
void* localSymbol = (void*) juce_getExecutableFile;
void* localSymbol = (void*) water_getExecutableFile;
dladdr (localSymbol, &exeInfo);
const CharPointer_UTF8 filename (exeInfo.dli_fname);
@@ -1394,7 +1385,7 @@ File juce_getExecutableFile()
#ifdef CARLA_OS_MAC
static NSString* getFileLink (const String& path)
{
return [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (path) error: nil];
return [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: waterStringToNS (path) error: nil];
}
bool File::isSymbolicLink() const
@@ -1405,7 +1396,7 @@ bool File::isSymbolicLink() const
File File::getLinkedTarget() const
{
if (NSString* dest = getFileLink (fullPath))
return getSiblingFile (nsStringToJuce (dest));
return getSiblingFile (nsStringToWater (dest));
return *this;
}
@@ -1416,14 +1407,14 @@ bool File::copyInternal (const File& dest) const
{
NSFileManager* fm = [NSFileManager defaultManager];
return [fm fileExistsAtPath: juceStringToNS (fullPath)]
return [fm fileExistsAtPath: waterStringToNS (fullPath)]
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
&& [fm copyItemAtPath: juceStringToNS (fullPath)
toPath: juceStringToNS (dest.getFullPathName())
&& [fm copyItemAtPath: waterStringToNS (fullPath)
toPath: waterStringToNS (dest.getFullPathName())
error: nil];
#else
&& [fm copyPath: juceStringToNS (fullPath)
toPath: juceStringToNS (dest.getFullPathName())
&& [fm copyPath: waterStringToNS (fullPath)
toPath: waterStringToNS (dest.getFullPathName())
handler: nil];
#endif
}
@@ -1437,13 +1428,13 @@ File File::getSpecialLocation (const SpecialLocationType type)
switch (type)
{
case userHomeDirectory: resultPath = nsStringToJuce (NSHomeDirectory()); break;
case userHomeDirectory: resultPath = nsStringToWater (NSHomeDirectory()); break;
case userDocumentsDirectory: resultPath = "~/Documents"; break;
case userDesktopDirectory: resultPath = "~/Desktop"; break;
case tempDirectory:
{
File tmp ("~/Library/Caches/" + juce_getExecutableFile().getFileNameWithoutExtension());
File tmp ("~/Library/Caches/" + water_getExecutableFile().getFileNameWithoutExtension());
tmp.createDirectory();
return File (tmp.getFullPathName());
}
@@ -1457,16 +1448,16 @@ File File::getSpecialLocation (const SpecialLocationType type)
case globalApplicationsDirectory: resultPath = "/Applications"; break;
case invokedExecutableFile:
if (juce_argv != nullptr && juce_argc > 0)
return File::getCurrentWorkingDirectory().getChildFile (CharPointer_UTF8 (juce_argv[0]));
if (water_argv != nullptr && water_argc > 0)
return File::getCurrentWorkingDirectory().getChildFile (CharPointer_UTF8 (water_argv[0]));
// deliberate fall-through...
case currentExecutableFile:
return juce_getExecutableFile();
return water_getExecutableFile();
case currentApplicationFile:
{
const File exe (juce_getExecutableFile());
const File exe (water_getExecutableFile());
const File parent (exe.getParentDirectory());
return parent.getFullPathName().endsWithIgnoreCase ("Contents/MacOS")
@@ -1506,7 +1497,7 @@ public:
{
@autoreleasepool
{
enumerator = [[[NSFileManager defaultManager] enumeratorAtPath: juceStringToNS (directory.getFullPathName())] retain];
enumerator = [[[NSFileManager defaultManager] enumeratorAtPath: waterStringToNS (directory.getFullPathName())] retain];
}
}
@@ -1530,7 +1521,7 @@ public:
return false;
[enumerator skipDescendents];
filenameFound = nsStringToJuce (file).convertToPrecomposedUnicode();
filenameFound = nsStringToWater (file).convertToPrecomposedUnicode();
if (wildcardUTF8 == nullptr)
wildcardUTF8 = wildCard.toUTF8();
@@ -1634,12 +1625,12 @@ File File::getSpecialLocation (const SpecialLocationType type)
case currentExecutableFile:
case currentApplicationFile:
return juce_getExecutableFile();
return water_getExecutableFile();
case hostApplicationPath:
{
const File f ("/proc/self/exe");
return f.isSymbolicLink() ? f.getLinkedTarget() : juce_getExecutableFile();
return f.isSymbolicLink() ? f.getLinkedTarget() : water_getExecutableFile();
}
default:


+ 6
- 25
source/modules/water/files/File.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_FILE_H_INCLUDED
#define JUCE_FILE_H_INCLUDED
#ifndef WATER_FILE_H_INCLUDED
#define WATER_FILE_H_INCLUDED
#include "../containers/Array.h"
#include "../misc/Result.h"
@@ -89,7 +89,7 @@ public:
/** Copies from another file object. */
File& operator= (const File& otherFile);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
File (File&&) noexcept;
File& operator= (File&&) noexcept;
#endif
@@ -705,25 +705,6 @@ public:
*/
bool isOnRemovableDrive() const;
//==============================================================================
/** Launches the file as a process.
- if the file is executable, this will run it.
- if it's a document of some kind, it will launch the document with its
default viewer application.
- if it's a folder, it will be opened in Explorer, Finder, or equivalent.
@see revealToUser
*/
bool startAsProcess (const String& parameters = String()) const;
/** Opens Finder, Explorer, or whatever the OS uses, to show the user this file's location.
@see startAsProcess
*/
void revealToUser() const;
//==============================================================================
/** A set of types of location that can be passed to the getSpecialLocation() method.
*/
@@ -815,7 +796,7 @@ public:
/** The system-specific file separator character.
On Windows, this will be '\', on Mac/Linux, it'll be '/'
*/
static const juce_wchar separator;
static const water_uchar separator;
/** The system-specific file separator character, as a string.
On Windows, this will be '\', on Mac/Linux, it'll be '/'
@@ -882,7 +863,7 @@ public:
#endif
//==============================================================================
#if JUCE_MAC
#ifdef CARLA_OS_MAC
/** OSX ONLY - Finds the OSType of a file from the its resources. */
OSType getMacOSType() const;
@@ -929,4 +910,4 @@ private:
}
#endif // JUCE_FILE_H_INCLUDED
#endif // WATER_FILE_H_INCLUDED

+ 2
- 3
source/modules/water/files/FileInputStream.cpp View File

@@ -27,8 +27,7 @@
namespace water {
int64 juce_fileSetPosition (void* handle, int64 pos);
static int64 water_fileSetPosition (void* handle, int64 pos);
//==============================================================================
FileInputStream::FileInputStream (const File& f)
@@ -79,7 +78,7 @@ bool FileInputStream::setPosition (int64 pos)
jassert (openedOk());
if (pos != currentPosition)
currentPosition = juce_fileSetPosition (fileHandle, pos);
currentPosition = water_fileSetPosition (fileHandle, pos);
return currentPosition == pos;
}


+ 3
- 3
source/modules/water/files/FileInputStream.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_FILEINPUTSTREAM_H_INCLUDED
#define JUCE_FILEINPUTSTREAM_H_INCLUDED
#ifndef WATER_FILEINPUTSTREAM_H_INCLUDED
#define WATER_FILEINPUTSTREAM_H_INCLUDED
#include "File.h"
#include "../streams/InputStream.h"
@@ -95,4 +95,4 @@ private:
}
#endif // JUCE_FILEINPUTSTREAM_H_INCLUDED
#endif // WATER_FILEINPUTSTREAM_H_INCLUDED

+ 2
- 2
source/modules/water/files/FileOutputStream.cpp View File

@@ -27,7 +27,7 @@
namespace water {
int64 juce_fileSetPosition (void* handle, int64 pos);
int64 water_fileSetPosition (void* handle, int64 pos);
//==============================================================================
FileOutputStream::FileOutputStream (const File& f, const size_t bufferSizeToUse)
@@ -60,7 +60,7 @@ bool FileOutputStream::setPosition (int64 newPosition)
if (newPosition != currentPosition)
{
flushBuffer();
currentPosition = juce_fileSetPosition (fileHandle, newPosition);
currentPosition = water_fileSetPosition (fileHandle, newPosition);
}
return newPosition == currentPosition;


+ 3
- 3
source/modules/water/files/FileOutputStream.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_FILEOUTPUTSTREAM_H_INCLUDED
#define JUCE_FILEOUTPUTSTREAM_H_INCLUDED
#ifndef WATER_FILEOUTPUTSTREAM_H_INCLUDED
#define WATER_FILEOUTPUTSTREAM_H_INCLUDED
#include "../files/File.h"
#include "../memory/HeapBlock.h"
@@ -121,4 +121,4 @@ private:
}
#endif // JUCE_FILEOUTPUTSTREAM_H_INCLUDED
#endif // WATER_FILEOUTPUTSTREAM_H_INCLUDED

+ 3
- 3
source/modules/water/files/TemporaryFile.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_TEMPORARYFILE_H_INCLUDED
#define JUCE_TEMPORARYFILE_H_INCLUDED
#ifndef WATER_TEMPORARYFILE_H_INCLUDED
#define WATER_TEMPORARYFILE_H_INCLUDED
#include "TemporaryFile.h"
#include "File.h"
@@ -169,4 +169,4 @@ private:
}
#endif // JUCE_TEMPORARYFILE_H_INCLUDED
#endif // WATER_TEMPORARYFILE_H_INCLUDED

+ 9
- 9
source/modules/water/maths/MathsFunctions.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_MATHSFUNCTIONS_H_INCLUDED
#define JUCE_MATHSFUNCTIONS_H_INCLUDED
#ifndef WATER_MATHSFUNCTIONS_H_INCLUDED
#define WATER_MATHSFUNCTIONS_H_INCLUDED
#include "../water.h"
@@ -254,16 +254,16 @@ int numElementsInArray (Type (&array)[N])
//==============================================================================
// Some useful maths functions that aren't always present with all compilers and build settings.
/** Using juce_hypot is easier than dealing with the different types of hypot function
/** Using water_hypot is easier than dealing with the different types of hypot function
that are provided by the various platforms and compilers. */
template <typename Type>
Type juce_hypot (Type a, Type b) noexcept
Type water_hypot (Type a, Type b) noexcept
{
return static_cast<Type> (hypot (a, b));
}
template <>
inline float juce_hypot (float a, float b) noexcept
inline float water_hypot (float a, float b) noexcept
{
return hypotf (a, b);
}
@@ -304,19 +304,19 @@ inline double radiansToDegrees (double radians) noexcept { return radians * (1
platform-independent function for it.
*/
template <typename NumericType>
bool juce_isfinite (NumericType) noexcept
bool water_isfinite (NumericType) noexcept
{
return true; // Integer types are always finite
}
template <>
inline bool juce_isfinite (float value) noexcept
inline bool water_isfinite (float value) noexcept
{
return std::isfinite (value);
}
template <>
inline bool juce_isfinite (double value) noexcept
inline bool water_isfinite (double value) noexcept
{
return std::isfinite (value);
}
@@ -475,4 +475,4 @@ uint32 readLittleEndianBitsInBuffer (const void* sourceBuffer, uint32 startBit,
}
#endif // JUCE_MATHSFUNCTIONS_H_INCLUDED
#endif // WATER_MATHSFUNCTIONS_H_INCLUDED

+ 3
- 3
source/modules/water/maths/Random.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_RANDOM_H_INCLUDED
#define JUCE_RANDOM_H_INCLUDED
#ifndef WATER_RANDOM_H_INCLUDED
#define WATER_RANDOM_H_INCLUDED
#include "../water.h"
@@ -123,4 +123,4 @@ private:
}
#endif // JUCE_RANDOM_H_INCLUDED
#endif // WATER_RANDOM_H_INCLUDED

+ 3
- 3
source/modules/water/memory/Atomic.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_ATOMIC_H_INCLUDED
#define JUCE_ATOMIC_H_INCLUDED
#ifndef WATER_ATOMIC_H_INCLUDED
#define WATER_ATOMIC_H_INCLUDED
#include "../water.h"
@@ -245,4 +245,4 @@ inline void Atomic<Type>::memoryBarrier() noexcept
}
#endif // JUCE_ATOMIC_H_INCLUDED
#endif // WATER_ATOMIC_H_INCLUDED

+ 7
- 7
source/modules/water/memory/ByteOrder.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_BYTEORDER_H_INCLUDED
#define JUCE_BYTEORDER_H_INCLUDED
#ifndef WATER_BYTEORDER_H_INCLUDED
#define WATER_BYTEORDER_H_INCLUDED
#include "../water.h"
@@ -133,7 +133,7 @@ public:
static bool isBigEndian() noexcept;
private:
ByteOrder() JUCE_DELETED_FUNCTION;
ByteOrder() WATER_DELETED_FUNCTION;
CARLA_DECLARE_NON_COPY_CLASS (ByteOrder)
};
@@ -147,9 +147,9 @@ inline uint16 ByteOrder::swap (uint16 n) noexcept
inline uint32 ByteOrder::swap (uint32 n) noexcept
{
#if JUCE_MAC
#ifdef CARLA_OS_MAC
return OSSwapInt32 (n);
#elif JUCE_INTEL && ! JUCE_NO_INLINE_ASM
#elif defined(CARLA_OS_WIN) || ! (defined (__arm__) || defined (__arm64__))
asm("bswap %%eax" : "=a"(n) : "a"(n));
return n;
#else
@@ -159,7 +159,7 @@ inline uint32 ByteOrder::swap (uint32 n) noexcept
inline uint64 ByteOrder::swap (uint64 value) noexcept
{
#if JUCE_MAC
#ifdef CARLA_OS_MAC
return OSSwapInt64 (value);
#else
return (((uint64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
@@ -227,4 +227,4 @@ inline void ByteOrder::bigEndian24BitToChars (const int value, void* const destB
}
#endif // JUCE_BYTEORDER_H_INCLUDED
#endif // WATER_BYTEORDER_H_INCLUDED

+ 4
- 4
source/modules/water/memory/HeapBlock.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_HEAPBLOCK_H_INCLUDED
#define JUCE_HEAPBLOCK_H_INCLUDED
#ifndef WATER_HEAPBLOCK_H_INCLUDED
#define WATER_HEAPBLOCK_H_INCLUDED
#include "Memory.h"
#include "../maths/MathsFunctions.h"
@@ -99,7 +99,7 @@ public:
std::free (data);
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
HeapBlock (HeapBlock&& other) noexcept
: data (other.data)
{
@@ -263,4 +263,4 @@ private:
}
#endif // JUCE_HEAPBLOCK_H_INCLUDED
#endif // WATER_HEAPBLOCK_H_INCLUDED

+ 3
- 3
source/modules/water/memory/Memory.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_MEMORY_H_INCLUDED
#define JUCE_MEMORY_H_INCLUDED
#ifndef WATER_MEMORY_H_INCLUDED
#define WATER_MEMORY_H_INCLUDED
#include "../water.h"
@@ -87,4 +87,4 @@ inline void writeUnaligned (void* dstPtr, Type value) noexcept
}
#endif // JUCE_MEMORY_H_INCLUDED
#endif // WATER_MEMORY_H_INCLUDED

+ 2
- 61
source/modules/water/memory/MemoryBlock.cpp View File

@@ -87,7 +87,7 @@ MemoryBlock& MemoryBlock::operator= (const MemoryBlock& other)
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
MemoryBlock::MemoryBlock (MemoryBlock&& other) noexcept
: data (static_cast<HeapBlock<char>&&> (other.data)),
size (other.size)
@@ -339,7 +339,7 @@ void MemoryBlock::loadFromHexString (StringRef hex)
for (;;)
{
const juce_wchar c = t.getAndAdvance();
const water_uchar c = t.getAndAdvance();
if (c >= '0' && c <= '9') { byte |= c - '0'; break; }
if (c >= 'a' && c <= 'z') { byte |= c - ('a' - 10); break; }
@@ -357,63 +357,4 @@ void MemoryBlock::loadFromHexString (StringRef hex)
}
}
//==============================================================================
static const char base64EncodingTable[] = ".ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+";
String MemoryBlock::toBase64Encoding() const
{
const size_t numChars = ((size << 3) + 5) / 6;
String destString ((unsigned int) size); // store the length, followed by a '.', and then the data.
const int initialLen = destString.length();
destString.preallocateBytes (sizeof (String::CharPointerType::CharType) * (size_t) initialLen + 2 + numChars);
String::CharPointerType d (destString.getCharPointer());
d += initialLen;
d.write ('.');
for (size_t i = 0; i < numChars; ++i)
d.write ((juce_wchar) (uint8) base64EncodingTable [getBitRange (i * 6, 6)]);
d.writeNull();
return destString;
}
static const char base64DecodingTable[] =
{
63, 0, 0, 0, 0, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 0, 0, 0, 0, 0, 0, 0,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
0, 0, 0, 0, 0, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52
};
bool MemoryBlock::fromBase64Encoding (StringRef s)
{
String::CharPointerType dot (CharacterFunctions::find (s.text, (juce_wchar) '.'));
if (dot.isEmpty())
return false;
const int numBytesNeeded = String (s.text, dot).getIntValue();
setSize ((size_t) numBytesNeeded, true);
String::CharPointerType srcChars (dot + 1);
int pos = 0;
for (;;)
{
int c = (int) srcChars.getAndAdvance();
if (c == 0)
return true;
c -= 43;
if (isPositiveAndBelow (c, numElementsInArray (base64DecodingTable)))
{
setBitRange ((size_t) pos, 6, base64DecodingTable [c]);
pos += 6;
}
}
}
}

+ 4
- 32
source/modules/water/memory/MemoryBlock.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_MEMORYBLOCK_H_INCLUDED
#define JUCE_MEMORYBLOCK_H_INCLUDED
#ifndef WATER_MEMORYBLOCK_H_INCLUDED
#define WATER_MEMORYBLOCK_H_INCLUDED
#include "HeapBlock.h"
@@ -68,7 +68,7 @@ public:
*/
MemoryBlock& operator= (const MemoryBlock&);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
MemoryBlock (MemoryBlock&&) noexcept;
MemoryBlock& operator= (MemoryBlock&&) noexcept;
#endif
@@ -221,34 +221,6 @@ public:
int getBitRange (size_t bitRangeStart,
size_t numBitsToRead) const noexcept;
//==============================================================================
/** Returns a string of characters in a JUCE-specific text encoding that represents the
binary contents of this block.
This uses a JUCE-specific (i.e. not standard!) 64-bit encoding system to convert binary
data into a string of ASCII characters for purposes like storage in XML.
Note that this proprietary format is mainly kept here for backwards-compatibility, and
you may prefer to use the Base64::toBase64() method if you want to use the standard
base-64 encoding.
@see fromBase64Encoding, Base64::toBase64, Base64::convertToBase64
*/
String toBase64Encoding() const;
/** Takes a string created by MemoryBlock::toBase64Encoding() and extracts the original data.
The string passed in must have been created by to64BitEncoding(), and this
block will be resized to recreate the original data block.
Note that these methods use a JUCE-specific (i.e. not standard!) 64-bit encoding system.
You may prefer to use the Base64::convertFromBase64() method if you want to use the
standard base-64 encoding.
@see toBase64Encoding, Base64::convertFromBase64
*/
bool fromBase64Encoding (StringRef encodedString);
private:
//==============================================================================
HeapBlock<char> data;
@@ -257,4 +229,4 @@ private:
}
#endif // JUCE_MEMORYBLOCK_H_INCLUDED
#endif // WATER_MEMORYBLOCK_H_INCLUDED

+ 4
- 4
source/modules/water/memory/ReferenceCountedObject.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED
#define JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED
#ifndef WATER_REFERENCECOUNTEDOBJECT_H_INCLUDED
#define WATER_REFERENCECOUNTEDOBJECT_H_INCLUDED
#include "Atomic.h"
@@ -300,7 +300,7 @@ public:
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Takes-over the object from another pointer. */
ReferenceCountedObjectPtr (ReferenceCountedObjectPtr&& other) noexcept
: referencedObject (other.referencedObject)
@@ -411,4 +411,4 @@ bool operator!= (ReferenceCountedObjectClass* object1, const ReferenceCountedObj
}
#endif // JUCE_REFERENCECOUNTEDOBJECT_H_INCLUDED
#endif // WATER_REFERENCECOUNTEDOBJECT_H_INCLUDED

+ 4
- 4
source/modules/water/memory/SharedResourcePointer.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED
#define JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED
#ifndef WATER_SHAREDRESOURCEPOINTER_H_INCLUDED
#define WATER_SHAREDRESOURCEPOINTER_H_INCLUDED
#include "../water.h"
@@ -157,9 +157,9 @@ 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;
SharedResourcePointer& operator= (const SharedResourcePointer&) WATER_DELETED_FUNCTION;
};
}
#endif // JUCE_SHAREDRESOURCEPOINTER_H_INCLUDED
#endif // WATER_SHAREDRESOURCEPOINTER_H_INCLUDED

+ 3
- 3
source/modules/water/midi/MidiBuffer.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_MIDIBUFFER_H_INCLUDED
#define JUCE_MIDIBUFFER_H_INCLUDED
#ifndef WATER_MIDIBUFFER_H_INCLUDED
#define WATER_MIDIBUFFER_H_INCLUDED
#include "../containers/Array.h"
@@ -234,4 +234,4 @@ public:
}
#endif // JUCE_MIDIBUFFER_H_INCLUDED
#endif // WATER_MIDIBUFFER_H_INCLUDED

+ 3
- 3
source/modules/water/midi/MidiFile.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_MIDIFILE_H_INCLUDED
#define JUCE_MIDIFILE_H_INCLUDED
#ifndef WATER_MIDIFILE_H_INCLUDED
#define WATER_MIDIFILE_H_INCLUDED
#include "MidiMessageSequence.h"
@@ -186,4 +186,4 @@ private:
}
#endif // JUCE_MIDIFILE_H_INCLUDED
#endif // WATER_MIDIFILE_H_INCLUDED

+ 1
- 142
source/modules/water/midi/MidiMessage.cpp View File

@@ -286,7 +286,7 @@ MidiMessage& MidiMessage::operator= (const MidiMessage& other)
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
MidiMessage::MidiMessage (MidiMessage&& other) noexcept
: timeStamp (other.timeStamp), size (other.size)
{
@@ -322,31 +322,6 @@ uint8* MidiMessage::allocateSpace (int bytes)
return packedData.asBytes;
}
String MidiMessage::getDescription() const
{
if (isNoteOn()) return "Note on " + MidiMessage::getMidiNoteName (getNoteNumber(), true, true, 3) + " Velocity " + String (getVelocity()) + " Channel " + String (getChannel());
if (isNoteOff()) return "Note off " + MidiMessage::getMidiNoteName (getNoteNumber(), true, true, 3) + " Velocity " + String (getVelocity()) + " Channel " + String (getChannel());
if (isProgramChange()) return "Program change " + String (getProgramChangeNumber()) + " Channel " + String (getChannel());
if (isPitchWheel()) return "Pitch wheel " + String (getPitchWheelValue()) + " Channel " + String (getChannel());
if (isAftertouch()) return "Aftertouch " + MidiMessage::getMidiNoteName (getNoteNumber(), true, true, 3) + ": " + String (getAfterTouchValue()) + " Channel " + String (getChannel());
if (isChannelPressure()) return "Channel pressure " + String (getChannelPressureValue()) + " Channel " + String (getChannel());
if (isAllNotesOff()) return "All notes off Channel " + String (getChannel());
if (isAllSoundOff()) return "All sound off Channel " + String (getChannel());
if (isMetaEvent()) return "Meta event";
if (isController())
{
String name (MidiMessage::getControllerName (getControllerNumber()));
if (name.isEmpty())
name = String (getControllerNumber());
return "Controller " + name + ": " + String (getControllerValue()) + " Channel " + String (getChannel());
}
return String::toHexString (getRawData(), getRawDataSize());
}
int MidiMessage::getChannel() const noexcept
{
const uint8* const data = getRawData();
@@ -1035,120 +1010,4 @@ bool MidiMessage::isMidiNoteBlack (int noteNumber) noexcept
return ((1 << (noteNumber % 12)) & 0x054a) != 0;
}
const char* MidiMessage::getGMInstrumentName (const int n)
{
static const char* names[] =
{
NEEDS_TRANS("Acoustic Grand Piano"), NEEDS_TRANS("Bright Acoustic Piano"), NEEDS_TRANS("Electric Grand Piano"), NEEDS_TRANS("Honky-tonk Piano"),
NEEDS_TRANS("Electric Piano 1"), NEEDS_TRANS("Electric Piano 2"), NEEDS_TRANS("Harpsichord"), NEEDS_TRANS("Clavinet"),
NEEDS_TRANS("Celesta"), NEEDS_TRANS("Glockenspiel"), NEEDS_TRANS("Music Box"), NEEDS_TRANS("Vibraphone"),
NEEDS_TRANS("Marimba"), NEEDS_TRANS("Xylophone"), NEEDS_TRANS("Tubular Bells"), NEEDS_TRANS("Dulcimer"),
NEEDS_TRANS("Drawbar Organ"), NEEDS_TRANS("Percussive Organ"), NEEDS_TRANS("Rock Organ"), NEEDS_TRANS("Church Organ"),
NEEDS_TRANS("Reed Organ"), NEEDS_TRANS("Accordion"), NEEDS_TRANS("Harmonica"), NEEDS_TRANS("Tango Accordion"),
NEEDS_TRANS("Acoustic Guitar (nylon)"), NEEDS_TRANS("Acoustic Guitar (steel)"), NEEDS_TRANS("Electric Guitar (jazz)"), NEEDS_TRANS("Electric Guitar (clean)"),
NEEDS_TRANS("Electric Guitar (mute)"), NEEDS_TRANS("Overdriven Guitar"), NEEDS_TRANS("Distortion Guitar"), NEEDS_TRANS("Guitar Harmonics"),
NEEDS_TRANS("Acoustic Bass"), NEEDS_TRANS("Electric Bass (finger)"), NEEDS_TRANS("Electric Bass (pick)"), NEEDS_TRANS("Fretless Bass"),
NEEDS_TRANS("Slap Bass 1"), NEEDS_TRANS("Slap Bass 2"), NEEDS_TRANS("Synth Bass 1"), NEEDS_TRANS("Synth Bass 2"),
NEEDS_TRANS("Violin"), NEEDS_TRANS("Viola"), NEEDS_TRANS("Cello"), NEEDS_TRANS("Contrabass"),
NEEDS_TRANS("Tremolo Strings"), NEEDS_TRANS("Pizzicato Strings"), NEEDS_TRANS("Orchestral Harp"), NEEDS_TRANS("Timpani"),
NEEDS_TRANS("String Ensemble 1"), NEEDS_TRANS("String Ensemble 2"), NEEDS_TRANS("SynthStrings 1"), NEEDS_TRANS("SynthStrings 2"),
NEEDS_TRANS("Choir Aahs"), NEEDS_TRANS("Voice Oohs"), NEEDS_TRANS("Synth Voice"), NEEDS_TRANS("Orchestra Hit"),
NEEDS_TRANS("Trumpet"), NEEDS_TRANS("Trombone"), NEEDS_TRANS("Tuba"), NEEDS_TRANS("Muted Trumpet"),
NEEDS_TRANS("French Horn"), NEEDS_TRANS("Brass Section"), NEEDS_TRANS("SynthBrass 1"), NEEDS_TRANS("SynthBrass 2"),
NEEDS_TRANS("Soprano Sax"), NEEDS_TRANS("Alto Sax"), NEEDS_TRANS("Tenor Sax"), NEEDS_TRANS("Baritone Sax"),
NEEDS_TRANS("Oboe"), NEEDS_TRANS("English Horn"), NEEDS_TRANS("Bassoon"), NEEDS_TRANS("Clarinet"),
NEEDS_TRANS("Piccolo"), NEEDS_TRANS("Flute"), NEEDS_TRANS("Recorder"), NEEDS_TRANS("Pan Flute"),
NEEDS_TRANS("Blown Bottle"), NEEDS_TRANS("Shakuhachi"), NEEDS_TRANS("Whistle"), NEEDS_TRANS("Ocarina"),
NEEDS_TRANS("Lead 1 (square)"), NEEDS_TRANS("Lead 2 (sawtooth)"), NEEDS_TRANS("Lead 3 (calliope)"), NEEDS_TRANS("Lead 4 (chiff)"),
NEEDS_TRANS("Lead 5 (charang)"), NEEDS_TRANS("Lead 6 (voice)"), NEEDS_TRANS("Lead 7 (fifths)"), NEEDS_TRANS("Lead 8 (bass+lead)"),
NEEDS_TRANS("Pad 1 (new age)"), NEEDS_TRANS("Pad 2 (warm)"), NEEDS_TRANS("Pad 3 (polysynth)"), NEEDS_TRANS("Pad 4 (choir)"),
NEEDS_TRANS("Pad 5 (bowed)"), NEEDS_TRANS("Pad 6 (metallic)"), NEEDS_TRANS("Pad 7 (halo)"), NEEDS_TRANS("Pad 8 (sweep)"),
NEEDS_TRANS("FX 1 (rain)"), NEEDS_TRANS("FX 2 (soundtrack)"), NEEDS_TRANS("FX 3 (crystal)"), NEEDS_TRANS("FX 4 (atmosphere)"),
NEEDS_TRANS("FX 5 (brightness)"), NEEDS_TRANS("FX 6 (goblins)"), NEEDS_TRANS("FX 7 (echoes)"), NEEDS_TRANS("FX 8 (sci-fi)"),
NEEDS_TRANS("Sitar"), NEEDS_TRANS("Banjo"), NEEDS_TRANS("Shamisen"), NEEDS_TRANS("Koto"),
NEEDS_TRANS("Kalimba"), NEEDS_TRANS("Bag pipe"), NEEDS_TRANS("Fiddle"), NEEDS_TRANS("Shanai"),
NEEDS_TRANS("Tinkle Bell"), NEEDS_TRANS("Agogo"), NEEDS_TRANS("Steel Drums"), NEEDS_TRANS("Woodblock"),
NEEDS_TRANS("Taiko Drum"), NEEDS_TRANS("Melodic Tom"), NEEDS_TRANS("Synth Drum"), NEEDS_TRANS("Reverse Cymbal"),
NEEDS_TRANS("Guitar Fret Noise"), NEEDS_TRANS("Breath Noise"), NEEDS_TRANS("Seashore"), NEEDS_TRANS("Bird Tweet"),
NEEDS_TRANS("Telephone Ring"), NEEDS_TRANS("Helicopter"), NEEDS_TRANS("Applause"), NEEDS_TRANS("Gunshot")
};
return isPositiveAndBelow (n, numElementsInArray (names)) ? names[n] : nullptr;
}
const char* MidiMessage::getGMInstrumentBankName (const int n)
{
static const char* names[] =
{
NEEDS_TRANS("Piano"), NEEDS_TRANS("Chromatic Percussion"), NEEDS_TRANS("Organ"), NEEDS_TRANS("Guitar"),
NEEDS_TRANS("Bass"), NEEDS_TRANS("Strings"), NEEDS_TRANS("Ensemble"), NEEDS_TRANS("Brass"),
NEEDS_TRANS("Reed"), NEEDS_TRANS("Pipe"), NEEDS_TRANS("Synth Lead"), NEEDS_TRANS("Synth Pad"),
NEEDS_TRANS("Synth Effects"), NEEDS_TRANS("Ethnic"), NEEDS_TRANS("Percussive"), NEEDS_TRANS("Sound Effects")
};
return isPositiveAndBelow (n, numElementsInArray (names)) ? names[n] : nullptr;
}
const char* MidiMessage::getRhythmInstrumentName (const int n)
{
static const char* names[] =
{
NEEDS_TRANS("Acoustic Bass Drum"), NEEDS_TRANS("Bass Drum 1"), NEEDS_TRANS("Side Stick"), NEEDS_TRANS("Acoustic Snare"),
NEEDS_TRANS("Hand Clap"), NEEDS_TRANS("Electric Snare"), NEEDS_TRANS("Low Floor Tom"), NEEDS_TRANS("Closed Hi-Hat"),
NEEDS_TRANS("High Floor Tom"), NEEDS_TRANS("Pedal Hi-Hat"), NEEDS_TRANS("Low Tom"), NEEDS_TRANS("Open Hi-Hat"),
NEEDS_TRANS("Low-Mid Tom"), NEEDS_TRANS("Hi-Mid Tom"), NEEDS_TRANS("Crash Cymbal 1"), NEEDS_TRANS("High Tom"),
NEEDS_TRANS("Ride Cymbal 1"), NEEDS_TRANS("Chinese Cymbal"), NEEDS_TRANS("Ride Bell"), NEEDS_TRANS("Tambourine"),
NEEDS_TRANS("Splash Cymbal"), NEEDS_TRANS("Cowbell"), NEEDS_TRANS("Crash Cymbal 2"), NEEDS_TRANS("Vibraslap"),
NEEDS_TRANS("Ride Cymbal 2"), NEEDS_TRANS("Hi Bongo"), NEEDS_TRANS("Low Bongo"), NEEDS_TRANS("Mute Hi Conga"),
NEEDS_TRANS("Open Hi Conga"), NEEDS_TRANS("Low Conga"), NEEDS_TRANS("High Timbale"), NEEDS_TRANS("Low Timbale"),
NEEDS_TRANS("High Agogo"), NEEDS_TRANS("Low Agogo"), NEEDS_TRANS("Cabasa"), NEEDS_TRANS("Maracas"),
NEEDS_TRANS("Short Whistle"), NEEDS_TRANS("Long Whistle"), NEEDS_TRANS("Short Guiro"), NEEDS_TRANS("Long Guiro"),
NEEDS_TRANS("Claves"), NEEDS_TRANS("Hi Wood Block"), NEEDS_TRANS("Low Wood Block"), NEEDS_TRANS("Mute Cuica"),
NEEDS_TRANS("Open Cuica"), NEEDS_TRANS("Mute Triangle"), NEEDS_TRANS("Open Triangle")
};
return (n >= 35 && n <= 81) ? names [n - 35] : nullptr;
}
const char* MidiMessage::getControllerName (const int n)
{
static const char* names[] =
{
NEEDS_TRANS("Bank Select"), NEEDS_TRANS("Modulation Wheel (coarse)"), NEEDS_TRANS("Breath controller (coarse)"),
nullptr,
NEEDS_TRANS("Foot Pedal (coarse)"), NEEDS_TRANS("Portamento Time (coarse)"), NEEDS_TRANS("Data Entry (coarse)"),
NEEDS_TRANS("Volume (coarse)"), NEEDS_TRANS("Balance (coarse)"),
nullptr,
NEEDS_TRANS("Pan position (coarse)"), NEEDS_TRANS("Expression (coarse)"), NEEDS_TRANS("Effect Control 1 (coarse)"),
NEEDS_TRANS("Effect Control 2 (coarse)"),
nullptr, nullptr,
NEEDS_TRANS("General Purpose Slider 1"), NEEDS_TRANS("General Purpose Slider 2"),
NEEDS_TRANS("General Purpose Slider 3"), NEEDS_TRANS("General Purpose Slider 4"),
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
NEEDS_TRANS("Bank Select (fine)"), NEEDS_TRANS("Modulation Wheel (fine)"), NEEDS_TRANS("Breath controller (fine)"),
nullptr,
NEEDS_TRANS("Foot Pedal (fine)"), NEEDS_TRANS("Portamento Time (fine)"), NEEDS_TRANS("Data Entry (fine)"), NEEDS_TRANS("Volume (fine)"),
NEEDS_TRANS("Balance (fine)"), nullptr, NEEDS_TRANS("Pan position (fine)"), NEEDS_TRANS("Expression (fine)"),
NEEDS_TRANS("Effect Control 1 (fine)"), NEEDS_TRANS("Effect Control 2 (fine)"),
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
NEEDS_TRANS("Hold Pedal (on/off)"), NEEDS_TRANS("Portamento (on/off)"), NEEDS_TRANS("Sustenuto Pedal (on/off)"), NEEDS_TRANS("Soft Pedal (on/off)"),
NEEDS_TRANS("Legato Pedal (on/off)"), NEEDS_TRANS("Hold 2 Pedal (on/off)"), NEEDS_TRANS("Sound Variation"), NEEDS_TRANS("Sound Timbre"),
NEEDS_TRANS("Sound Release Time"), NEEDS_TRANS("Sound Attack Time"), NEEDS_TRANS("Sound Brightness"), NEEDS_TRANS("Sound Control 6"),
NEEDS_TRANS("Sound Control 7"), NEEDS_TRANS("Sound Control 8"), NEEDS_TRANS("Sound Control 9"), NEEDS_TRANS("Sound Control 10"),
NEEDS_TRANS("General Purpose Button 1 (on/off)"), NEEDS_TRANS("General Purpose Button 2 (on/off)"),
NEEDS_TRANS("General Purpose Button 3 (on/off)"), NEEDS_TRANS("General Purpose Button 4 (on/off)"),
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
NEEDS_TRANS("Reverb Level"), NEEDS_TRANS("Tremolo Level"), NEEDS_TRANS("Chorus Level"), NEEDS_TRANS("Celeste Level"),
NEEDS_TRANS("Phaser Level"), NEEDS_TRANS("Data Button increment"), NEEDS_TRANS("Data Button decrement"), NEEDS_TRANS("Non-registered Parameter (fine)"),
NEEDS_TRANS("Non-registered Parameter (coarse)"), NEEDS_TRANS("Registered Parameter (fine)"), NEEDS_TRANS("Registered Parameter (coarse)"),
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
NEEDS_TRANS("All Sound Off"), NEEDS_TRANS("All Controllers Off"), NEEDS_TRANS("Local Keyboard (on/off)"), NEEDS_TRANS("All Notes Off"),
NEEDS_TRANS("Omni Mode Off"), NEEDS_TRANS("Omni Mode On"), NEEDS_TRANS("Mono Operation"), NEEDS_TRANS("Poly Operation")
};
return isPositiveAndBelow (n, numElementsInArray (names)) ? names[n] : nullptr;
}
}

+ 7
- 37
source/modules/water/midi/MidiMessage.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_MIDIMESSAGE_H_INCLUDED
#define JUCE_MIDIMESSAGE_H_INCLUDED
#ifndef WATER_MIDIMESSAGE_H_INCLUDED
#define WATER_MIDIMESSAGE_H_INCLUDED
#include "../water.h"
@@ -113,7 +113,7 @@ public:
/** Copies this message from another one. */
MidiMessage& operator= (const MidiMessage& other);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
MidiMessage (MidiMessage&&) noexcept;
MidiMessage& operator= (MidiMessage&&) noexcept;
#endif
@@ -129,12 +129,6 @@ public:
*/
int getRawDataSize() const noexcept { return size; }
//==============================================================================
/** Returns a human-readable description of the midi message as a string,
for example "Note On C#3 Velocity 120 Channel 1".
*/
String getDescription() const;
//==============================================================================
/** Returns the timestamp associated with this message.
@@ -342,13 +336,13 @@ public:
//==============================================================================
/** Returns true if the message is a program (patch) change message.
@see getProgramChangeNumber, getGMInstrumentName
@see getProgramChangeNumber
*/
bool isProgramChange() const noexcept;
/** Returns the new program number of a program change message.
If the message isn't a program change, the value returned is undefined.
@see isProgramChange, getGMInstrumentName
@see isProgramChange
*/
int getProgramChangeNumber() const noexcept;
@@ -356,7 +350,7 @@ public:
@param channel the midi channel, in the range 1 to 16
@param programNumber the midi program number, 0 to 127
@see isProgramChange, getGMInstrumentName
@see isProgramChange
*/
static MidiMessage programChange (int channel, int programNumber) noexcept;
@@ -887,28 +881,6 @@ public:
/** Returns true if the given midi note number is a black key. */
static bool isMidiNoteBlack (int noteNumber) noexcept;
/** Returns the standard name of a GM instrument, or nullptr if unknown for this index.
@param midiInstrumentNumber the program number 0 to 127
@see getProgramChangeNumber
*/
static const char* getGMInstrumentName (int midiInstrumentNumber);
/** Returns the name of a bank of GM instruments, or nullptr if unknown for this bank number.
@param midiBankNumber the bank, 0 to 15
*/
static const char* getGMInstrumentBankName (int midiBankNumber);
/** Returns the standard name of a channel 10 percussion sound, or nullptr if unknown for this note number.
@param midiNoteNumber the key number, 35 to 81
*/
static const char* getRhythmInstrumentName (int midiNoteNumber);
/** Returns the name of a controller type number, or nullptr if unknown for this controller number.
@see getControllerNumber
*/
static const char* getControllerName (int controllerNumber);
/** Converts a floating-point value between 0 and 1 to a MIDI 7-bit value between 0 and 127. */
static uint8 floatValueToMidiByte (float valueBetween0and1) noexcept;
@@ -918,7 +890,6 @@ public:
private:
//==============================================================================
#ifndef DOXYGEN
union PackedData
{
uint8* allocatedData;
@@ -928,7 +899,6 @@ private:
PackedData packedData;
double timeStamp;
int size;
#endif
inline bool isHeapAllocated() const noexcept { return size > (int) sizeof (packedData); }
inline uint8* getData() const noexcept { return isHeapAllocated() ? packedData.allocatedData : (uint8*) packedData.asBytes; }
@@ -937,4 +907,4 @@ private:
}
#endif // JUCE_MIDIMESSAGE_H_INCLUDED
#endif // WATER_MIDIMESSAGE_H_INCLUDED

+ 4
- 4
source/modules/water/midi/MidiMessageSequence.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED
#define JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED
#ifndef WATER_MIDIMESSAGESEQUENCE_H_INCLUDED
#define WATER_MIDIMESSAGESEQUENCE_H_INCLUDED
#include "MidiMessage.h"
#include "../containers/Array.h"
@@ -55,7 +55,7 @@ public:
/** Replaces this sequence with another one. */
MidiMessageSequence& operator= (const MidiMessageSequence&);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
MidiMessageSequence (MidiMessageSequence&& other) noexcept
: list (static_cast<OwnedArray<MidiEventHolder>&&> (other.list))
{}
@@ -288,4 +288,4 @@ private:
}
#endif // JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED
#endif // WATER_MIDIMESSAGESEQUENCE_H_INCLUDED

+ 1
- 1
source/modules/water/misc/Result.cpp View File

@@ -45,7 +45,7 @@ Result& Result::operator= (const Result& other)
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
Result::Result (Result&& other) noexcept
: errorMessage (static_cast<String&&> (other.errorMessage))
{


+ 4
- 4
source/modules/water/misc/Result.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_RESULT_H_INCLUDED
#define JUCE_RESULT_H_INCLUDED
#ifndef WATER_RESULT_H_INCLUDED
#define WATER_RESULT_H_INCLUDED
#include "../text/String.h"
@@ -100,7 +100,7 @@ public:
Result (const Result&);
Result& operator= (const Result&);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
Result (Result&&) noexcept;
Result& operator= (Result&&) noexcept;
#endif
@@ -123,4 +123,4 @@ private:
}
#endif // JUCE_RESULT_H_INCLUDED
#endif // WATER_RESULT_H_INCLUDED

+ 2
- 2
source/modules/water/misc/Time.cpp View File

@@ -37,7 +37,7 @@ namespace TimeHelpers
//==============================================================================
static uint32 juce_millisecondsSinceStartup() noexcept
static uint32 water_millisecondsSinceStartup() noexcept
{
#ifdef CARLA_OS_WIN
return (uint32) timeGetTime();
@@ -90,7 +90,7 @@ int64 Time::currentTimeMillis() noexcept
uint32 Time::getMillisecondCounter() noexcept
{
const uint32 now = juce_millisecondsSinceStartup();
const uint32 now = water_millisecondsSinceStartup();
if (now < TimeHelpers::lastMSCounterValue)
{


+ 3
- 3
source/modules/water/misc/Time.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_TIME_H_INCLUDED
#define JUCE_TIME_H_INCLUDED
#ifndef WATER_TIME_H_INCLUDED
#define WATER_TIME_H_INCLUDED
#include "../water.h"
@@ -126,4 +126,4 @@ private:
}
#endif // JUCE_TIME_H_INCLUDED
#endif // WATER_TIME_H_INCLUDED

+ 10
- 15
source/modules/water/processors/AudioPlayHead.h View File

@@ -5,26 +5,21 @@
Copyright (c) 2015 ROLI Ltd.
Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Permission is granted to use this software under the terms of the GNU
General Public License as published by the Free Software Foundation;
either version 2 of the License, or any later version.
Details of these licenses can be found at: www.gnu.org/licenses
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
For a full copy of the GNU General Public License see the doc/GPL.txt file.
==============================================================================
*/
#ifndef JUCE_AUDIOPLAYHEAD_H_INCLUDED
#define JUCE_AUDIOPLAYHEAD_H_INCLUDED
#ifndef WATER_AUDIOPLAYHEAD_H_INCLUDED
#define WATER_AUDIOPLAYHEAD_H_INCLUDED
#include "../water.h"
@@ -146,4 +141,4 @@ public:
}
#endif // JUCE_AUDIOPLAYHEAD_H_INCLUDED
#endif // WATER_AUDIOPLAYHEAD_H_INCLUDED

+ 7
- 12
source/modules/water/processors/AudioProcessor.cpp View File

@@ -5,20 +5,15 @@
Copyright (c) 2015 ROLI Ltd.
Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Permission is granted to use this software under the terms of the GNU
General Public License as published by the Free Software Foundation;
either version 2 of the License, or any later version.
Details of these licenses can be found at: www.gnu.org/licenses
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
For a full copy of the GNU General Public License see the doc/GPL.txt file.
==============================================================================
*/


+ 10
- 15
source/modules/water/processors/AudioProcessor.h View File

@@ -5,26 +5,21 @@
Copyright (c) 2015 ROLI Ltd.
Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Permission is granted to use this software under the terms of the GNU
General Public License as published by the Free Software Foundation;
either version 2 of the License, or any later version.
Details of these licenses can be found at: www.gnu.org/licenses
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
For a full copy of the GNU General Public License see the doc/GPL.txt file.
==============================================================================
*/
#ifndef JUCE_AUDIOPROCESSOR_H_INCLUDED
#define JUCE_AUDIOPROCESSOR_H_INCLUDED
#ifndef WATER_AUDIOPROCESSOR_H_INCLUDED
#define WATER_AUDIOPROCESSOR_H_INCLUDED
#include "../text/String.h"
#include "../buffers/AudioSampleBuffer.h"
@@ -391,4 +386,4 @@ private:
}
#endif // JUCE_AUDIOPROCESSOR_H_INCLUDED
#endif // WATER_AUDIOPROCESSOR_H_INCLUDED

+ 7
- 12
source/modules/water/processors/AudioProcessorGraph.cpp View File

@@ -5,20 +5,15 @@
Copyright (c) 2015 ROLI Ltd.
Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Permission is granted to use this software under the terms of the GNU
General Public License as published by the Free Software Foundation;
either version 2 of the License, or any later version.
Details of these licenses can be found at: www.gnu.org/licenses
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
For a full copy of the GNU General Public License see the doc/GPL.txt file.
==============================================================================
*/


+ 10
- 15
source/modules/water/processors/AudioProcessorGraph.h View File

@@ -5,26 +5,21 @@
Copyright (c) 2015 ROLI Ltd.
Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Permission is granted to use this software under the terms of the GNU
General Public License as published by the Free Software Foundation;
either version 2 of the License, or any later version.
Details of these licenses can be found at: www.gnu.org/licenses
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
For a full copy of the GNU General Public License see the doc/GPL.txt file.
==============================================================================
*/
#ifndef JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED
#define JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED
#ifndef WATER_AUDIOPROCESSORGRAPH_H_INCLUDED
#define WATER_AUDIOPROCESSORGRAPH_H_INCLUDED
#include "AudioProcessor.h"
#include "../containers/NamedValueSet.h"
@@ -382,4 +377,4 @@ private:
}
#endif // JUCE_AUDIOPROCESSORGRAPH_H_INCLUDED
#endif // WATER_AUDIOPROCESSORGRAPH_H_INCLUDED

+ 3
- 3
source/modules/water/streams/FileInputSource.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_FILEINPUTSOURCE_H_INCLUDED
#define JUCE_FILEINPUTSOURCE_H_INCLUDED
#ifndef WATER_FILEINPUTSOURCE_H_INCLUDED
#define WATER_FILEINPUTSOURCE_H_INCLUDED
#include "InputSource.h"
#include "../files/File.h"
@@ -65,4 +65,4 @@ private:
}
#endif // JUCE_FILEINPUTSOURCE_H_INCLUDED
#endif // WATER_FILEINPUTSOURCE_H_INCLUDED

+ 3
- 3
source/modules/water/streams/InputSource.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_INPUTSOURCE_H_INCLUDED
#define JUCE_INPUTSOURCE_H_INCLUDED
#ifndef WATER_INPUTSOURCE_H_INCLUDED
#define WATER_INPUTSOURCE_H_INCLUDED
#include "../water.h"
@@ -73,4 +73,4 @@ public:
}
#endif // JUCE_INPUTSOURCE_H_INCLUDED
#endif // WATER_INPUTSOURCE_H_INCLUDED

+ 3
- 3
source/modules/water/streams/InputStream.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_INPUTSTREAM_H_INCLUDED
#define JUCE_INPUTSTREAM_H_INCLUDED
#ifndef WATER_INPUTSTREAM_H_INCLUDED
#define WATER_INPUTSTREAM_H_INCLUDED
#include "../water.h"
@@ -256,4 +256,4 @@ private:
}
#endif // JUCE_INPUTSTREAM_H_INCLUDED
#endif // WATER_INPUTSTREAM_H_INCLUDED

+ 1
- 1
source/modules/water/streams/MemoryOutputStream.cpp View File

@@ -137,7 +137,7 @@ bool MemoryOutputStream::writeRepeatedByte (uint8 byte, size_t howMany)
return false;
}
bool MemoryOutputStream::appendUTF8Char (juce_wchar c)
bool MemoryOutputStream::appendUTF8Char (water_uchar c)
{
if (char* dest = prepareToWrite (CharPointer_UTF8::getBytesRequiredFor (c)))
{


+ 4
- 4
source/modules/water/streams/MemoryOutputStream.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED
#define JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED
#ifndef WATER_MEMORYOUTPUTSTREAM_H_INCLUDED
#define WATER_MEMORYOUTPUTSTREAM_H_INCLUDED
#include "OutputStream.h"
#include "../memory/MemoryBlock.h"
@@ -94,7 +94,7 @@ public:
void preallocate (size_t bytesToPreallocate);
/** Appends the utf-8 bytes for a unicode character */
bool appendUTF8Char (juce_wchar character);
bool appendUTF8Char (water_uchar character);
/** Returns a String created from the (UTF8) data that has been written to the stream. */
String toUTF8() const;
@@ -138,4 +138,4 @@ OutputStream& operator<< (OutputStream& stream, const MemoryOutputStream& stream
}
#endif // JUCE_MEMORYOUTPUTSTREAM_H_INCLUDED
#endif // WATER_MEMORYOUTPUTSTREAM_H_INCLUDED

+ 1
- 30
source/modules/water/streams/OutputStream.cpp View File

@@ -31,43 +31,14 @@
namespace water {
#if JUCE_DEBUG
struct DanglingStreamChecker
{
DanglingStreamChecker() {}
~DanglingStreamChecker()
{
/*
It's always a bad idea to leak any object, but if you're leaking output
streams, then there's a good chance that you're failing to flush a file
to disk properly, which could result in corrupted data and other similar
nastiness..
*/
jassert (activeStreams.size() == 0);
}
Array<void*, CriticalSection> activeStreams;
};
static DanglingStreamChecker danglingStreamChecker;
#endif
//==============================================================================
OutputStream::OutputStream()
: newLineString (NewLine::getDefault())
{
#if JUCE_DEBUG
danglingStreamChecker.activeStreams.add (this);
#endif
}
OutputStream::~OutputStream()
{
#if JUCE_DEBUG
danglingStreamChecker.activeStreams.removeFirstMatchingValue (this);
#endif
}
//==============================================================================
@@ -195,7 +166,7 @@ bool OutputStream::writeText (const String& text, const bool asUTF16,
for (;;)
{
const juce_wchar c = src.getAndAdvance();
const water_uchar c = src.getAndAdvance();
if (c == 0)
break;


+ 3
- 3
source/modules/water/streams/OutputStream.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_OUTPUTSTREAM_H_INCLUDED
#define JUCE_OUTPUTSTREAM_H_INCLUDED
#ifndef WATER_OUTPUTSTREAM_H_INCLUDED
#define WATER_OUTPUTSTREAM_H_INCLUDED
#include "../water.h"
@@ -275,4 +275,4 @@ OutputStream& operator<< (OutputStream& stream, const NewLine&);
}
#endif // JUCE_OUTPUTSTREAM_H_INCLUDED
#endif // WATER_OUTPUTSTREAM_H_INCLUDED

+ 19
- 19
source/modules/water/text/CharPointer_UTF8.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_CHARPOINTER_UTF8_H_INCLUDED
#define JUCE_CHARPOINTER_UTF8_H_INCLUDED
#ifndef WATER_CHARPOINTER_UTF8_H_INCLUDED
#define WATER_CHARPOINTER_UTF8_H_INCLUDED
#include "CharacterFunctions.h"
#include "../memory/Atomic.h"
@@ -84,12 +84,12 @@ public:
inline bool isEmpty() const noexcept { return *data == 0; }
/** Returns the unicode character that this pointer is pointing to. */
juce_wchar operator*() const noexcept
water_uchar operator*() const noexcept
{
const signed char byte = (signed char) *data;
if (byte >= 0)
return (juce_wchar) (uint8) byte;
return (water_uchar) (uint8) byte;
uint32 n = (uint32) (uint8) byte;
uint32 mask = 0x7f;
@@ -116,7 +116,7 @@ public:
n |= (nextByte & 0x3f);
}
return (juce_wchar) n;
return (water_uchar) n;
}
/** Moves this pointer along to the next character in the string. */
@@ -127,7 +127,7 @@ public:
if (n < 0)
{
juce_wchar bit = 0x40;
water_uchar bit = 0x40;
while ((n & bit) != 0 && bit > 0x8)
{
@@ -152,12 +152,12 @@ public:
/** Returns the character that this pointer is currently pointing to, and then
advances the pointer to point to the next character. */
juce_wchar getAndAdvance() noexcept
water_uchar getAndAdvance() noexcept
{
const signed char byte = (signed char) *data++;
if (byte >= 0)
return (juce_wchar) (uint8) byte;
return (water_uchar) (uint8) byte;
uint32 n = (uint32) (uint8) byte;
uint32 mask = 0x7f;
@@ -185,7 +185,7 @@ public:
n |= (nextByte & 0x3f);
}
return (juce_wchar) n;
return (water_uchar) n;
}
/** Moves this pointer along to the next character in the string. */
@@ -218,7 +218,7 @@ public:
}
/** Returns the character at a given character index from the start of the string. */
juce_wchar operator[] (int characterIndex) const noexcept
water_uchar operator[] (int characterIndex) const noexcept
{
CharPointer_UTF8 p (*this);
p += characterIndex;
@@ -289,7 +289,7 @@ public:
/** Returns the number of bytes that would be needed to represent the given
unicode character in this encoding format.
*/
static size_t getBytesRequiredFor (const juce_wchar charToWrite) noexcept
static size_t getBytesRequiredFor (const water_uchar charToWrite) noexcept
{
size_t num = 1;
const uint32 c = (uint32) charToWrite;
@@ -317,7 +317,7 @@ public:
{
size_t count = 0;
while (juce_wchar n = text.getAndAdvance())
while (water_uchar n = text.getAndAdvance())
count += getBytesRequiredFor (n);
return count;
@@ -330,7 +330,7 @@ public:
}
/** Writes a unicode character to this string, and advances this pointer to point to the next position. */
void write (const juce_wchar charToWrite) noexcept
void write (const water_uchar charToWrite) noexcept
{
const uint32 c = (uint32) charToWrite;
@@ -442,13 +442,13 @@ public:
}
/** Returns the character index of a unicode character, or -1 if it isn't found. */
int indexOf (const juce_wchar charToFind) const noexcept
int indexOf (const water_uchar charToFind) const noexcept
{
return CharacterFunctions::indexOfChar (*this, charToFind);
}
/** Returns the character index of a unicode character, or -1 if it isn't found. */
int indexOf (const juce_wchar charToFind, const bool ignoreCase) const noexcept
int indexOf (const water_uchar charToFind, const bool ignoreCase) const noexcept
{
return ignoreCase ? CharacterFunctions::indexOfCharIgnoreCase (*this, charToFind)
: CharacterFunctions::indexOfChar (*this, charToFind);
@@ -468,9 +468,9 @@ public:
bool isLowerCase() const noexcept { return CharacterFunctions::isLowerCase (operator*()) != 0; }
/** Returns an upper-case version of the first character of this string. */
juce_wchar toUpperCase() const noexcept { return CharacterFunctions::toUpperCase (operator*()); }
water_uchar toUpperCase() const noexcept { return CharacterFunctions::toUpperCase (operator*()); }
/** Returns a lower-case version of the first character of this string. */
juce_wchar toLowerCase() const noexcept { return CharacterFunctions::toLowerCase (operator*()); }
water_uchar toLowerCase() const noexcept { return CharacterFunctions::toLowerCase (operator*()); }
/** Parses this string as a 32-bit integer. */
int getIntValue32() const noexcept { return atoi (data); }
@@ -491,7 +491,7 @@ public:
CharPointer_UTF8 findEndOfWhitespace() const noexcept { return CharacterFunctions::findEndOfWhitespace (*this); }
/** Returns true if the given unicode character can be represented in this encoding. */
static bool canRepresent (juce_wchar character) noexcept
static bool canRepresent (water_uchar character) noexcept
{
return ((unsigned int) character) < (unsigned int) 0x10ffff;
}
@@ -570,4 +570,4 @@ private:
}
#endif // JUCE_CHARPOINTER_UTF8_H_INCLUDED
#endif // WATER_CHARPOINTER_UTF8_H_INCLUDED

+ 15
- 15
source/modules/water/text/CharacterFunctions.cpp View File

@@ -31,17 +31,17 @@ namespace water {
//==============================================================================
juce_wchar CharacterFunctions::toUpperCase (const juce_wchar character) noexcept
water_uchar CharacterFunctions::toUpperCase (const water_uchar character) noexcept
{
return (juce_wchar) towupper ((wint_t) character);
return (water_uchar) towupper ((wint_t) character);
}
juce_wchar CharacterFunctions::toLowerCase (const juce_wchar character) noexcept
water_uchar CharacterFunctions::toLowerCase (const water_uchar character) noexcept
{
return (juce_wchar) towlower ((wint_t) character);
return (water_uchar) towlower ((wint_t) character);
}
bool CharacterFunctions::isUpperCase (const juce_wchar character) noexcept
bool CharacterFunctions::isUpperCase (const water_uchar character) noexcept
{
#ifdef CARLA_OS_WIN
return iswupper ((wint_t) character) != 0;
@@ -50,7 +50,7 @@ bool CharacterFunctions::isUpperCase (const juce_wchar character) noexcept
#endif
}
bool CharacterFunctions::isLowerCase (const juce_wchar character) noexcept
bool CharacterFunctions::isLowerCase (const water_uchar character) noexcept
{
#ifdef CARLA_OS_WIN
return iswlower ((wint_t) character) != 0;
@@ -65,7 +65,7 @@ bool CharacterFunctions::isWhitespace (const char character) noexcept
return character == ' ' || (character <= 13 && character >= 9);
}
bool CharacterFunctions::isWhitespace (const juce_wchar character) noexcept
bool CharacterFunctions::isWhitespace (const water_uchar character) noexcept
{
return iswspace ((wint_t) character) != 0;
}
@@ -75,7 +75,7 @@ bool CharacterFunctions::isDigit (const char character) noexcept
return (character >= '0' && character <= '9');
}
bool CharacterFunctions::isDigit (const juce_wchar character) noexcept
bool CharacterFunctions::isDigit (const water_uchar character) noexcept
{
return iswdigit ((wint_t) character) != 0;
}
@@ -86,7 +86,7 @@ bool CharacterFunctions::isLetter (const char character) noexcept
|| (character >= 'A' && character <= 'Z');
}
bool CharacterFunctions::isLetter (const juce_wchar character) noexcept
bool CharacterFunctions::isLetter (const water_uchar character) noexcept
{
return iswalpha ((wint_t) character) != 0;
}
@@ -98,7 +98,7 @@ bool CharacterFunctions::isLetterOrDigit (const char character) noexcept
|| (character >= '0' && character <= '9');
}
bool CharacterFunctions::isLetterOrDigit (const juce_wchar character) noexcept
bool CharacterFunctions::isLetterOrDigit (const water_uchar character) noexcept
{
return iswalnum ((wint_t) character) != 0;
}
@@ -108,12 +108,12 @@ bool CharacterFunctions::isPrintable (const char character) noexcept
return (character >= ' ' && character <= '~');
}
bool CharacterFunctions::isPrintable (const juce_wchar character) noexcept
bool CharacterFunctions::isPrintable (const water_uchar character) noexcept
{
return iswprint ((wint_t) character) != 0;
}
int CharacterFunctions::getHexDigitValue (const juce_wchar digit) noexcept
int CharacterFunctions::getHexDigitValue (const water_uchar digit) noexcept
{
unsigned int d = (unsigned int) digit - '0';
if (d < (unsigned int) 10)
@@ -158,17 +158,17 @@ double CharacterFunctions::mulexp10 (const double value, int exponent) noexcept
return negative ? (value / result) : (value * result);
}
juce_wchar CharacterFunctions::getUnicodeCharFromWindows1252Codepage (const uint8 c) noexcept
water_uchar CharacterFunctions::getUnicodeCharFromWindows1252Codepage (const uint8 c) noexcept
{
if (c < 0x80 || c >= 0xa0)
return (juce_wchar) c;
return (water_uchar) c;
static const uint16 lookup[] = { 0x20AC, 0x0007, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0007, 0x017D, 0x0007,
0x0007, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0007, 0x017E, 0x0178 };
return (juce_wchar) lookup[c - 0x80];
return (water_uchar) lookup[c - 0x80];
}
}

+ 34
- 34
source/modules/water/text/CharacterFunctions.h View File

@@ -23,17 +23,17 @@
==============================================================================
*/
#ifndef JUCE_CHARACTERFUNCTIONS_H_INCLUDED
#define JUCE_CHARACTERFUNCTIONS_H_INCLUDED
#include <algorithm>
#ifndef WATER_CHARACTERFUNCTIONS_H_INCLUDED
#define WATER_CHARACTERFUNCTIONS_H_INCLUDED
#include "../memory/Memory.h"
#include <algorithm>
namespace water {
/** A platform-independent 32-bit unicode character type. */
typedef uint32 juce_wchar;
typedef uint32 water_uchar;
//==============================================================================
/**
@@ -49,34 +49,34 @@ class CharacterFunctions
public:
//==============================================================================
/** Converts a character to upper-case. */
static juce_wchar toUpperCase (juce_wchar character) noexcept;
static water_uchar toUpperCase (water_uchar character) noexcept;
/** Converts a character to lower-case. */
static juce_wchar toLowerCase (juce_wchar character) noexcept;
static water_uchar toLowerCase (water_uchar character) noexcept;
/** Checks whether a unicode character is upper-case. */
static bool isUpperCase (juce_wchar character) noexcept;
static bool isUpperCase (water_uchar character) noexcept;
/** Checks whether a unicode character is lower-case. */
static bool isLowerCase (juce_wchar character) noexcept;
static bool isLowerCase (water_uchar character) noexcept;
/** Checks whether a character is whitespace. */
static bool isWhitespace (char character) noexcept;
/** Checks whether a character is whitespace. */
static bool isWhitespace (juce_wchar character) noexcept;
static bool isWhitespace (water_uchar character) noexcept;
/** Checks whether a character is a digit. */
static bool isDigit (char character) noexcept;
/** Checks whether a character is a digit. */
static bool isDigit (juce_wchar character) noexcept;
static bool isDigit (water_uchar character) noexcept;
/** Checks whether a character is alphabetic. */
static bool isLetter (char character) noexcept;
/** Checks whether a character is alphabetic. */
static bool isLetter (juce_wchar character) noexcept;
static bool isLetter (water_uchar character) noexcept;
/** Checks whether a character is alphabetic or numeric. */
static bool isLetterOrDigit (char character) noexcept;
/** Checks whether a character is alphabetic or numeric. */
static bool isLetterOrDigit (juce_wchar character) noexcept;
static bool isLetterOrDigit (water_uchar character) noexcept;
/** Checks whether a character is a printable character, i.e. alphabetic, numeric,
a punctuation character or a space.
@@ -86,13 +86,13 @@ public:
/** Checks whether a character is a printable character, i.e. alphabetic, numeric,
a punctuation character or a space.
*/
static bool isPrintable (juce_wchar character) noexcept;
static bool isPrintable (water_uchar character) noexcept;
/** Returns 0 to 16 for '0' to 'F", or -1 for characters that aren't a legal hex digit. */
static int getHexDigitValue (juce_wchar digit) noexcept;
static int getHexDigitValue (water_uchar digit) noexcept;
/** Converts a byte of Windows 1252 codepage to unicode. */
static juce_wchar getUnicodeCharFromWindows1252Codepage (uint8 windows1252Char) noexcept;
static water_uchar getUnicodeCharFromWindows1252Codepage (uint8 windows1252Char) noexcept;
//==============================================================================
/** Parses a character string to read a floating-point number.
@@ -110,7 +110,7 @@ public:
const int maxSignificantDigits = 15 + 2;
text = text.findEndOfWhitespace();
juce_wchar c = *text;
water_uchar c = *text;
switch (c)
{
@@ -250,7 +250,7 @@ public:
for (;;)
{
const juce_wchar c = s.getAndAdvance();
const water_uchar c = s.getAndAdvance();
if (c >= '0' && c <= '9')
v = v * 10 + (IntType) (c - '0');
@@ -312,7 +312,7 @@ public:
template <typename DestCharPointerType, typename SrcCharPointerType>
static void copyAll (DestCharPointerType& dest, SrcCharPointerType src) noexcept
{
while (juce_wchar c = src.getAndAdvance())
while (water_uchar c = src.getAndAdvance())
dest.write (c);
dest.writeNull();
@@ -329,7 +329,7 @@ public:
for (;;)
{
const juce_wchar c = src.getAndAdvance();
const water_uchar c = src.getAndAdvance();
const size_t bytesNeeded = DestCharPointerType::getBytesRequiredFor (c);
maxBytes -= bytesNeeded;
@@ -352,7 +352,7 @@ public:
{
while (--maxChars > 0)
{
const juce_wchar c = src.getAndAdvance();
const water_uchar c = src.getAndAdvance();
if (c == 0)
break;
@@ -363,7 +363,7 @@ public:
}
/** Compares two characters. */
static inline int compare (juce_wchar char1, juce_wchar char2) noexcept
static inline int compare (water_uchar char1, water_uchar char2) noexcept
{
if (int diff = static_cast<int> (char1) - static_cast<int> (char2))
return diff < 0 ? -1 : 1;
@@ -377,7 +377,7 @@ public:
{
for (;;)
{
const juce_wchar c1 = s1.getAndAdvance();
const water_uchar c1 = s1.getAndAdvance();
if (int diff = compare (c1, s2.getAndAdvance()))
return diff;
@@ -395,7 +395,7 @@ public:
{
while (--maxChars >= 0)
{
const juce_wchar c1 = s1.getAndAdvance();
const water_uchar c1 = s1.getAndAdvance();
if (int diff = compare (c1, s2.getAndAdvance()))
return diff;
@@ -408,7 +408,7 @@ public:
}
/** Compares two characters, using a case-independant match. */
static inline int compareIgnoreCase (juce_wchar char1, juce_wchar char2) noexcept
static inline int compareIgnoreCase (water_uchar char1, water_uchar char2) noexcept
{
return char1 != char2 ? compare (toUpperCase (char1), toUpperCase (char2)) : 0;
}
@@ -419,7 +419,7 @@ public:
{
for (;;)
{
const juce_wchar c1 = s1.getAndAdvance();
const water_uchar c1 = s1.getAndAdvance();
if (int diff = compareIgnoreCase (c1, s2.getAndAdvance()))
return diff;
@@ -437,7 +437,7 @@ public:
{
while (--maxChars >= 0)
{
const juce_wchar c1 = s1.getAndAdvance();
const water_uchar c1 = s1.getAndAdvance();
if (int diff = compareIgnoreCase (c1, s2.getAndAdvance()))
return diff;
@@ -491,11 +491,11 @@ public:
null terminator.
*/
template <typename CharPointerType>
static CharPointerType find (CharPointerType textToSearch, const juce_wchar charToLookFor) noexcept
static CharPointerType find (CharPointerType textToSearch, const water_uchar charToLookFor) noexcept
{
for (;; ++textToSearch)
{
const juce_wchar c = *textToSearch;
const water_uchar c = *textToSearch;
if (c == charToLookFor || c == 0)
break;
@@ -530,7 +530,7 @@ public:
Returns -1 if the character is not found.
*/
template <typename Type>
static int indexOfChar (Type text, const juce_wchar charToFind) noexcept
static int indexOfChar (Type text, const water_uchar charToFind) noexcept
{
int i = 0;
@@ -550,7 +550,7 @@ public:
Returns -1 if the character is not found.
*/
template <typename Type>
static int indexOfCharIgnoreCase (Type text, juce_wchar charToFind) noexcept
static int indexOfCharIgnoreCase (Type text, water_uchar charToFind) noexcept
{
charToFind = CharacterFunctions::toLowerCase (charToFind);
int i = 0;
@@ -586,11 +586,11 @@ public:
template <typename Type, typename BreakType>
static Type findEndOfToken (Type text, const BreakType breakCharacters, const Type quoteCharacters)
{
juce_wchar currentQuoteChar = 0;
water_uchar currentQuoteChar = 0;
while (! text.isEmpty())
{
const juce_wchar c = text.getAndAdvance();
const water_uchar c = text.getAndAdvance();
if (currentQuoteChar == 0 && breakCharacters.indexOf (c) >= 0)
{
@@ -616,4 +616,4 @@ private:
}
#endif // JUCE_CHARACTERFUNCTIONS_H_INCLUDED
#endif // WATER_CHARACTERFUNCTIONS_H_INCLUDED

+ 1
- 1
source/modules/water/text/Identifier.cpp View File

@@ -33,7 +33,7 @@ Identifier::~Identifier() noexcept {}
Identifier::Identifier (const Identifier& other) noexcept : name (other.name) {}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
Identifier::Identifier (Identifier&& other) noexcept : name (static_cast<String&&> (other.name)) {}
Identifier& Identifier::operator= (Identifier&& other) noexcept


+ 4
- 4
source/modules/water/text/Identifier.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_IDENTIFIER_H_INCLUDED
#define JUCE_IDENTIFIER_H_INCLUDED
#ifndef WATER_IDENTIFIER_H_INCLUDED
#define WATER_IDENTIFIER_H_INCLUDED
#include "String.h"
@@ -70,7 +70,7 @@ public:
/** Creates a copy of another identifier. */
Identifier& operator= (const Identifier& other) noexcept;
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Creates a copy of another identifier. */
Identifier (Identifier&& other) noexcept;
@@ -138,4 +138,4 @@ private:
}
#endif // JUCE_IDENTIFIER_H_INCLUDED
#endif // WATER_IDENTIFIER_H_INCLUDED

+ 3
- 3
source/modules/water/text/NewLine.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_NEWLINE_H_INCLUDED
#define JUCE_NEWLINE_H_INCLUDED
#ifndef WATER_NEWLINE_H_INCLUDED
#define WATER_NEWLINE_H_INCLUDED
#include "../water.h"
@@ -86,4 +86,4 @@ inline String operator+ (const NewLine&, const char* s2) { return String (New
}
#endif // JUCE_NEWLINE_H_INCLUDED
#endif // WATER_NEWLINE_H_INCLUDED

+ 50
- 56
source/modules/water/text/String.cpp View File

@@ -53,7 +53,7 @@ static const EmptyString emptyString = { 0x3fffffff, sizeof (String::CharPointer
class StringHolder
{
public:
StringHolder() JUCE_DELETED_FUNCTION;
StringHolder() WATER_DELETED_FUNCTION;
typedef String::CharPointerType CharPointerType;
typedef String::CharPointerType::CharType CharType;
@@ -242,7 +242,7 @@ String& String::operator= (const String& other) noexcept
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
String::String (String&& other) noexcept : text (other.text)
{
other.text = &(emptyString.text);
@@ -288,12 +288,8 @@ String::String (const char* const t)
you use UTF-8 with escape characters in your source code to represent extended characters,
because there's no other way to represent these strings in a way that isn't dependent on
the compiler, source code editor and platform.
Note that the Projucer has a handy string literal generator utility that will convert
any unicode string to a valid C++ string literal, creating ascii escape sequences that will
work in any compiler.
*/
jassert (t == nullptr || CharPointer_UTF8::isValidString (t, std::numeric_limits<int>::max()));
CARLA_SAFE_ASSERT (t == nullptr || CharPointer_UTF8::isValidString (t, std::numeric_limits<int>::max()));
}
String::String (const char* const t, const size_t maxChars)
@@ -311,12 +307,8 @@ String::String (const char* const t, const size_t maxChars)
you use UTF-8 with escape characters in your source code to represent extended characters,
because there's no other way to represent these strings in a way that isn't dependent on
the compiler, source code editor and platform.
Note that the Projucer has a handy string literal generator utility that will convert
any unicode string to a valid C++ string literal, creating ascii escape sequences that will
work in any compiler.
*/
jassert (t == nullptr || CharPointer_UTF8::isValidString (t, (int) maxChars));
CARLA_SAFE_ASSERT (t == nullptr || CharPointer_UTF8::isValidString (t, (int) maxChars));
}
String::String (const CharPointer_UTF8 t) : text (StringHolder::createFromCharPointer (t)) {}
@@ -326,7 +318,7 @@ String::String (const CharPointer_UTF8 start, const CharPointer_UTF8 end) : t
String::String (const std::string& s) : text (StringHolder::createFromFixedLength (s.data(), s.size())) {}
String::String (StringRef s) : text (StringHolder::createFromCharPointer (s.text)) {}
String String::charToString (const juce_wchar character)
String String::charToString (const water_uchar character)
{
String result (PreallocationBytes (CharPointerType::getBytesRequiredFor (character)));
CharPointerType t (result.text);
@@ -481,7 +473,7 @@ size_t String::getByteOffsetOfEnd() const noexcept
return findByteOffsetOfEnd (text);
}
juce_wchar String::operator[] (int index) const noexcept
water_uchar String::operator[] (int index) const noexcept
{
jassert (index == 0 || (index > 0 && index <= (int) text.lengthUpTo ((size_t) index + 1)));
return text [index];
@@ -547,10 +539,10 @@ static int stringCompareRight (String::CharPointerType s1, String::CharPointerTy
{
for (int bias = 0;;)
{
const juce_wchar c1 = s1.getAndAdvance();
const water_uchar c1 = s1.getAndAdvance();
const bool isDigit1 = CharacterFunctions::isDigit (c1);
const juce_wchar c2 = s2.getAndAdvance();
const water_uchar c2 = s2.getAndAdvance();
const bool isDigit2 = CharacterFunctions::isDigit (c2);
if (! (isDigit1 || isDigit2)) return bias;
@@ -568,10 +560,10 @@ static int stringCompareLeft (String::CharPointerType s1, String::CharPointerTyp
{
for (;;)
{
const juce_wchar c1 = s1.getAndAdvance();
const water_uchar c1 = s1.getAndAdvance();
const bool isDigit1 = CharacterFunctions::isDigit (c1);
const juce_wchar c2 = s2.getAndAdvance();
const water_uchar c2 = s2.getAndAdvance();
const bool isDigit2 = CharacterFunctions::isDigit (c2);
if (! (isDigit1 || isDigit2)) return 0;
@@ -608,8 +600,8 @@ static int naturalStringCompare (String::CharPointerType s1, String::CharPointer
return result;
}
juce_wchar c1 = s1.getAndAdvance();
juce_wchar c2 = s2.getAndAdvance();
water_uchar c1 = s1.getAndAdvance();
water_uchar c2 = s2.getAndAdvance();
if (c1 != c2 && ! isCaseSensitive)
{
@@ -703,7 +695,7 @@ String& String::operator+= (const char ch)
return operator+= (asString);
}
String& String::operator+= (const juce_wchar ch)
String& String::operator+= (const water_uchar ch)
{
return operator+= (charToString(ch));
}
@@ -728,14 +720,14 @@ String& String::operator+= (const uint64 number) { return StringHelpers::o
//==============================================================================
String operator+ (const char* const s1, const String& s2) { String s (s1); return s += s2; }
String operator+ (const char s1, const String& s2) { return String::charToString ((juce_wchar) (uint8) s1) + s2; }
String operator+ (const char s1, const String& s2) { return String::charToString ((water_uchar) (uint8) s1) + s2; }
String operator+ (String s1, const String& s2) { return s1 += s2; }
String operator+ (String s1, const char* const s2) { return s1 += s2; }
String operator+ (String s1, const char s2) { return s1 += s2; }
String operator+ (const juce_wchar s1, const String& s2) { return String::charToString (s1) + s2; }
String operator+ (String s1, const juce_wchar s2) { return s1 += s2; }
String& operator<< (String& s1, const juce_wchar s2) { return s1 += s2; }
String operator+ (const water_uchar s1, const String& s2) { return String::charToString (s1) + s2; }
String operator+ (String s1, const water_uchar s2) { return s1 += s2; }
String& operator<< (String& s1, const water_uchar s2) { return s1 += s2; }
String& operator<< (String& s1, const char s2) { return s1 += s2; }
String& operator<< (String& s1, const char* const s2) { return s1 += s2; }
@@ -766,12 +758,12 @@ OutputStream& operator<< (OutputStream& stream, StringRef text)
}
//==============================================================================
int String::indexOfChar (const juce_wchar character) const noexcept
int String::indexOfChar (const water_uchar character) const noexcept
{
return text.indexOf (character);
}
int String::indexOfChar (const int startIndex, const juce_wchar character) const noexcept
int String::indexOfChar (const int startIndex, const water_uchar character) const noexcept
{
CharPointerType t (text);
@@ -791,7 +783,7 @@ int String::indexOfChar (const int startIndex, const juce_wchar character) const
return -1;
}
int String::lastIndexOfChar (const juce_wchar character) const noexcept
int String::lastIndexOfChar (const water_uchar character) const noexcept
{
CharPointerType t (text);
int last = -1;
@@ -936,7 +928,7 @@ bool String::contains (StringRef other) const noexcept
return indexOf (other) >= 0;
}
bool String::containsChar (const juce_wchar character) const noexcept
bool String::containsChar (const water_uchar character) const noexcept
{
return text.indexOf (character) >= 0;
}
@@ -1008,7 +1000,7 @@ struct WildCardMatcher
{
for (;;)
{
const juce_wchar wc = wildcard.getAndAdvance();
const water_uchar wc = wildcard.getAndAdvance();
if (wc == '*')
return wildcard.isEmpty() || matchesAnywhere (wildcard, test, ignoreCase);
@@ -1021,7 +1013,7 @@ struct WildCardMatcher
}
}
static bool characterMatches (const juce_wchar wc, const juce_wchar tc, const bool ignoreCase) noexcept
static bool characterMatches (const water_uchar wc, const water_uchar tc, const bool ignoreCase) noexcept
{
return (wc == tc) || (wc == '?' && tc != 0)
|| (ignoreCase && CharacterFunctions::toLowerCase (wc) == CharacterFunctions::toLowerCase (tc));
@@ -1057,7 +1049,7 @@ String String::repeatedString (StringRef stringToRepeat, int numberOfTimesToRepe
return result;
}
String String::paddedLeft (const juce_wchar padCharacter, int minimumLength) const
String String::paddedLeft (const water_uchar padCharacter, int minimumLength) const
{
jassert (padCharacter != 0);
@@ -1084,9 +1076,9 @@ String String::paddedLeft (const juce_wchar padCharacter, int minimumLength) con
return result;
}
String String::paddedRight (const juce_wchar padCharacter, int minimumLength) const
String String::paddedRight (const water_uchar padCharacter, int minimumLength) const
{
jassert (padCharacter != 0);
CARLA_SAFE_ASSERT_RETURN (padCharacter != 0, *this);
int extraChars = minimumLength;
CharPointerType end (text);
@@ -1209,7 +1201,7 @@ public:
dest = result.getCharPointer();
}
void write (juce_wchar c)
void write (water_uchar c)
{
bytesWritten += String::CharPointerType::getBytesRequiredFor (c);
@@ -1232,7 +1224,7 @@ private:
size_t allocatedBytes, bytesWritten;
};
String String::replaceCharacter (const juce_wchar charToReplace, const juce_wchar charToInsert) const
String String::replaceCharacter (const water_uchar charToReplace, const water_uchar charToInsert) const
{
if (! containsChar (charToReplace))
return *this;
@@ -1241,7 +1233,7 @@ String String::replaceCharacter (const juce_wchar charToReplace, const juce_wcha
for (;;)
{
juce_wchar c = builder.source.getAndAdvance();
water_uchar c = builder.source.getAndAdvance();
if (c == charToReplace)
c = charToInsert;
@@ -1265,7 +1257,7 @@ String String::replaceCharacters (StringRef charactersToReplace, StringRef chara
for (;;)
{
juce_wchar c = builder.source.getAndAdvance();
water_uchar c = builder.source.getAndAdvance();
const int index = charactersToReplace.text.indexOf (c);
if (index >= 0)
@@ -1291,16 +1283,18 @@ bool String::startsWithIgnoreCase (StringRef other) const noexcept
return text.compareIgnoreCaseUpTo (other.text, other.length()) == 0;
}
bool String::startsWithChar (const juce_wchar character) const noexcept
bool String::startsWithChar (const water_uchar character) const noexcept
{
jassert (character != 0); // strings can't contain a null character!
// strings can't contain a null character!
CARLA_SAFE_ASSERT_RETURN (character != 0, false);
return *text == character;
}
bool String::endsWithChar (const juce_wchar character) const noexcept
bool String::endsWithChar (const water_uchar character) const noexcept
{
jassert (character != 0); // strings can't contain a null character!
// strings can't contain a null character!
CARLA_SAFE_ASSERT_RETURN (character != 0, false);
if (text.isEmpty())
return false;
@@ -1350,7 +1344,7 @@ String String::toUpperCase() const
for (;;)
{
const juce_wchar c = builder.source.toUpperCase();
const water_uchar c = builder.source.toUpperCase();
builder.write (c);
if (c == 0)
@@ -1368,7 +1362,7 @@ String String::toLowerCase() const
for (;;)
{
const juce_wchar c = builder.source.toLowerCase();
const water_uchar c = builder.source.toLowerCase();
builder.write (c);
if (c == 0)
@@ -1381,9 +1375,9 @@ String String::toLowerCase() const
}
//==============================================================================
juce_wchar String::getLastCharacter() const noexcept
water_uchar String::getLastCharacter() const noexcept
{
return isEmpty() ? juce_wchar() : text [length() - 1];
return isEmpty() ? water_uchar() : text [length() - 1];
}
String String::substring (int start, const int end) const
@@ -1502,7 +1496,7 @@ String String::upToLastOccurrenceOf (StringRef sub,
bool String::isQuotedString() const
{
const juce_wchar trimmedStart = trimStart()[0];
const water_uchar trimmedStart = trimStart()[0];
return trimmedStart == '"'
|| trimmedStart == '\'';
@@ -1515,7 +1509,7 @@ String String::unquoted() const
if (len == 0)
return String();
const juce_wchar lastChar = text [len - 1];
const water_uchar lastChar = text [len - 1];
const int dropAtStart = (*text == '"' || *text == '\'') ? 1 : 0;
const int dropAtEnd = (lastChar == '"' || lastChar == '\'') ? 1 : 0;
@@ -1627,7 +1621,7 @@ String String::retainCharacters (StringRef charactersToRetain) const
for (;;)
{
juce_wchar c = builder.source.getAndAdvance();
water_uchar c = builder.source.getAndAdvance();
if (charactersToRetain.text.indexOf (c) >= 0)
builder.write (c);
@@ -1649,7 +1643,7 @@ String String::removeCharacters (StringRef charactersToRemove) const
for (;;)
{
juce_wchar c = builder.source.getAndAdvance();
water_uchar c = builder.source.getAndAdvance();
if (charactersToRemove.text.indexOf (c) < 0)
builder.write (c);
@@ -1727,7 +1721,7 @@ String String::createStringFromData (const void* const unknownData, int size)
return String();
if (size == 1)
return charToString ((juce_wchar) data[0]);
return charToString ((water_uchar) data[0]);
const char* start = (const char*) data;
@@ -1847,11 +1841,11 @@ String String::toHexString (const void* const d, const int size, const int group
for (int i = 0; i < size; ++i)
{
const unsigned char nextByte = *data++;
dest.write ((juce_wchar) hexDigits [nextByte >> 4]);
dest.write ((juce_wchar) hexDigits [nextByte & 0xf]);
dest.write ((water_uchar) hexDigits [nextByte >> 4]);
dest.write ((water_uchar) hexDigits [nextByte & 0xf]);
if (groupSize > 0 && (i % groupSize) == (groupSize - 1) && i < (size - 1))
dest.write ((juce_wchar) ' ');
dest.write ((water_uchar) ' ');
}
dest.writeNull();
@@ -1862,7 +1856,7 @@ int String::getHexValue32() const noexcept { return CharacterFunctions::Hex
int64 String::getHexValue64() const noexcept { return CharacterFunctions::HexParser<int64>::parse (text); }
//==============================================================================
static const juce_wchar emptyChar = 0;
static const water_uchar emptyChar = 0;
template <class CharPointerType_Src, class CharPointerType_Dest>
struct StringEncodingConverter
@@ -1886,7 +1880,7 @@ struct StringEncodingConverter
void* const newSpace = addBytesToPointer (text.getAddress(), (int) endOffset);
const CharPointerType_Dest extraSpace (static_cast<DestChar*> (newSpace));
#if JUCE_DEBUG // (This just avoids spurious warnings from valgrind about the uninitialised bytes at the end of the buffer..)
#ifdef DEBUG // (This just avoids spurious warnings from valgrind about the uninitialised bytes at the end of the buffer..)
const size_t bytesToClear = (size_t) jmin ((int) extraBytesNeeded, 4);
zeromem (addBytesToPointer (newSpace, extraBytesNeeded - bytesToClear), bytesToClear);
#endif


+ 25
- 25
source/modules/water/text/String.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_STRING_H_INCLUDED
#define JUCE_STRING_H_INCLUDED
#ifndef WATER_STRING_H_INCLUDED
#define WATER_STRING_H_INCLUDED
#include "CharPointer_UTF8.h"
#include "../memory/Memory.h"
@@ -33,7 +33,7 @@ namespace water {
//==============================================================================
/**
The JUCE String class!
The Water String class!
Using a reference-counted internal representation, these strings are fast
and efficient, and there are methods to do just about any operation you'll ever
@@ -53,7 +53,7 @@ public:
/** Creates a copy of another string. */
String (const String& other) noexcept;
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
String (String&& other) noexcept;
#endif
@@ -109,7 +109,7 @@ public:
//==============================================================================
/** Creates a string from a single character. */
static String charToString (juce_wchar character);
static String charToString (water_uchar character);
/** Destructor. */
~String() noexcept;
@@ -136,7 +136,7 @@ public:
/** Replaces this string's contents with another string. */
String& operator= (const String& other) noexcept;
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
String& operator= (String&& other) noexcept;
#endif
@@ -157,7 +157,7 @@ public:
/** Appends a character at the end of this string. */
String& operator+= (char characterToAppend);
/** Appends a character at the end of this string. */
String& operator+= (juce_wchar characterToAppend);
String& operator+= (water_uchar characterToAppend);
/** Appends a string to the end of this one.
@@ -301,7 +301,7 @@ public:
If the character is 0, this will always return false.
Uses a case-sensitive comparison.
*/
bool startsWithChar (juce_wchar character) const noexcept;
bool startsWithChar (water_uchar character) const noexcept;
/** Tests whether the string begins with another string.
If the parameter is an empty string, this will always return true.
@@ -319,7 +319,7 @@ public:
If the character is 0, this will always return false.
Uses a case-sensitive comparison.
*/
bool endsWithChar (juce_wchar character) const noexcept;
bool endsWithChar (water_uchar character) const noexcept;
/** Tests whether the string ends with another string.
If the parameter is an empty string, this will always return true.
@@ -336,7 +336,7 @@ public:
/** Tests whether the string contains a particular character.
Uses a case-sensitive comparison.
*/
bool containsChar (juce_wchar character) const noexcept;
bool containsChar (water_uchar character) const noexcept;
/** Tests whether the string contains another substring.
Uses a case-insensitive comparison.
@@ -420,7 +420,7 @@ public:
@returns the index of the first occurrence of the character in this
string, or -1 if it's not found.
*/
int indexOfChar (juce_wchar characterToLookFor) const noexcept;
int indexOfChar (water_uchar characterToLookFor) const noexcept;
/** Searches for a character inside this string.
Uses a case-sensitive comparison.
@@ -429,7 +429,7 @@ public:
@returns the index of the first occurrence of the character in this
string, or -1 if it's not found.
*/
int indexOfChar (int startIndex, juce_wchar characterToLookFor) const noexcept;
int indexOfChar (int startIndex, water_uchar characterToLookFor) const noexcept;
/** Returns the index of the first character that matches one of the characters
passed-in to this method.
@@ -483,7 +483,7 @@ public:
Uses a case-sensitive comparison.
@returns the index of the last occurrence of the character in this string, or -1 if it's not found.
*/
int lastIndexOfChar (juce_wchar character) const noexcept;
int lastIndexOfChar (water_uchar character) const noexcept;
/** Searches for a substring inside this string (working backwards from the end of the string).
Uses a case-sensitive comparison.
@@ -529,12 +529,12 @@ public:
then to use that to iterate the string.
@see getCharPointer
*/
juce_wchar operator[] (int index) const noexcept;
water_uchar operator[] (int index) const noexcept;
/** Returns the final character of the string.
If the string is empty this will return 0.
*/
juce_wchar getLastCharacter() const noexcept;
water_uchar getLastCharacter() const noexcept;
//==============================================================================
/** Returns a subsection of the string.
@@ -704,8 +704,8 @@ public:
bool ignoreCase = false) const;
/** Returns a string with all occurrences of a character replaced with a different one. */
String replaceCharacter (juce_wchar characterToReplace,
juce_wchar characterToInsertInstead) const;
String replaceCharacter (water_uchar characterToReplace,
water_uchar characterToInsertInstead) const;
/** Replaces a set of characters with another set.
@@ -790,12 +790,12 @@ public:
/** Returns a copy of this string with the specified character repeatedly added to its
beginning until the total length is at least the minimum length specified.
*/
String paddedLeft (juce_wchar padCharacter, int minimumLength) const;
String paddedLeft (water_uchar padCharacter, int minimumLength) const;
/** Returns a copy of this string with the specified character repeatedly added to its
end until the total length is at least the minimum length specified.
*/
String paddedRight (juce_wchar padCharacter, int minimumLength) const;
String paddedRight (water_uchar padCharacter, int minimumLength) const;
/** Creates a string from data in an unknown format.
@@ -1061,7 +1061,7 @@ public:
void swapWith (String& other) noexcept;
//==============================================================================
#if JUCE_MAC
#ifdef CARLA_OS_MAC
/** OSX ONLY - Creates a String from an OSX CFString. */
static String fromCFString (CFStringRef cfString);
@@ -1102,7 +1102,7 @@ String operator+ (const char* string1, const String& string2);
/** Concatenates two strings. */
String operator+ (char string1, const String& string2);
/** Concatenates two strings. */
String operator+ (juce_wchar string1, const String& string2);
String operator+ (water_uchar string1, const String& string2);
/** Concatenates two strings. */
String operator+ (String string1, const String& string2);
@@ -1111,13 +1111,13 @@ String operator+ (String string1, const char* string2);
/** Concatenates two strings. */
String operator+ (String string1, char characterToAppend);
/** Concatenates two strings. */
String operator+ (String string1, juce_wchar characterToAppend);
String operator+ (String string1, water_uchar characterToAppend);
//==============================================================================
/** Appends a character at the end of a string. */
String& operator<< (String& string1, char characterToAppend);
/** Appends a character at the end of a string. */
String& operator<< (String& string1, juce_wchar characterToAppend);
String& operator<< (String& string1, water_uchar characterToAppend);
/** Appends a string to the end of the first one. */
String& operator<< (String& string1, const char* string2);
@@ -1166,7 +1166,7 @@ bool operator>= (const String& string1, const String& string2) noexcept;
bool operator<= (const String& string1, const String& string2) noexcept;
//==============================================================================
/** This operator allows you to write a juce String directly to std output streams.
/** This operator allows you to write a water String directly to std output streams.
This is handy for writing strings to std::cout, std::cerr, etc.
*/
template <class traits>
@@ -1185,4 +1185,4 @@ OutputStream& operator<< (OutputStream& stream, StringRef stringToWrite);
#include "StringRef.h"
#endif // JUCE_STRING_H_INCLUDED
#endif // WATER_STRING_H_INCLUDED

+ 3
- 3
source/modules/water/text/StringArray.cpp View File

@@ -36,7 +36,7 @@ StringArray::StringArray (const StringArray& other)
{
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
StringArray::StringArray (StringArray&& other) noexcept
: strings (static_cast<Array <String>&&> (other.strings))
{
@@ -69,7 +69,7 @@ StringArray& StringArray::operator= (const StringArray& other)
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
StringArray& StringArray::operator= (StringArray&& other) noexcept
{
strings = static_cast<Array<String>&&> (other.strings);
@@ -125,7 +125,7 @@ void StringArray::add (const String& newString)
strings.add (newString);
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
void StringArray::add (String&& stringToAdd)
{
strings.add (static_cast<String&&> (stringToAdd));


+ 6
- 6
source/modules/water/text/StringArray.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_STRINGARRAY_H_INCLUDED
#define JUCE_STRINGARRAY_H_INCLUDED
#ifndef WATER_STRINGARRAY_H_INCLUDED
#define WATER_STRINGARRAY_H_INCLUDED
#include "String.h"
#include "../containers/Array.h"
@@ -47,7 +47,7 @@ public:
/** Creates a copy of another string array */
StringArray (const StringArray&);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
StringArray (StringArray&&) noexcept;
#endif
@@ -80,7 +80,7 @@ public:
/** Copies the contents of another string array into this one */
StringArray& operator= (const StringArray&);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
StringArray& operator= (StringArray&&) noexcept;
#endif
@@ -159,7 +159,7 @@ public:
/** Appends a string at the end of the array. */
void add (const String& stringToAdd);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Appends a string at the end of the array. */
void add (String&& stringToAdd);
#endif
@@ -418,4 +418,4 @@ public:
}
#endif // JUCE_STRINGARRAY_H_INCLUDED
#endif // WATER_STRINGARRAY_H_INCLUDED

+ 3
- 3
source/modules/water/text/StringPool.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_STRINGPOOL_H_INCLUDED
#define JUCE_STRINGPOOL_H_INCLUDED
#ifndef WATER_STRINGPOOL_H_INCLUDED
#define WATER_STRINGPOOL_H_INCLUDED
#include "../containers/Array.h"
@@ -96,4 +96,4 @@ private:
}
#endif // JUCE_STRINGPOOL_H_INCLUDED
#endif // WATER_STRINGPOOL_H_INCLUDED

+ 4
- 4
source/modules/water/text/StringRef.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_STRINGREF_H_INCLUDED
#define JUCE_STRINGREF_H_INCLUDED
#ifndef WATER_STRINGREF_H_INCLUDED
#define WATER_STRINGREF_H_INCLUDED
#include "String.h"
@@ -103,7 +103,7 @@ public:
int length() const noexcept { return (int) text.length(); }
/** Retrieves a character by index. */
juce_wchar operator[] (int index) const noexcept { return text[index]; }
water_uchar operator[] (int index) const noexcept { return text[index]; }
/** Compares this StringRef with a String. */
bool operator== (const String& s) const noexcept { return text.compare (s.getCharPointer()) == 0; }
@@ -133,4 +133,4 @@ inline String operator+ (StringRef s1, const char* s2) { return String (s1.
}
#endif // JUCE_STRINGREF_H_INCLUDED
#endif // WATER_STRINGREF_H_INCLUDED

+ 0
- 23
source/modules/water/threads/ChildProcess.cpp View File

@@ -33,8 +33,6 @@
# include <sys/wait.h>
#endif
#define JUCE_USE_VFORK 1
namespace water {
#ifdef CARLA_OS_WIN
@@ -172,11 +170,7 @@ public:
argv.add (nullptr);
#if JUCE_USE_VFORK
const pid_t result = vfork();
#else
const pid_t result = fork();
#endif
if (result < 0)
{
@@ -185,23 +179,6 @@ public:
}
else if (result == 0)
{
#if ! JUCE_USE_VFORK
// we're the child process..
close (pipeHandles[0]); // close the read handle
if ((streamFlags & wantStdOut) != 0)
dup2 (pipeHandles[1], STDOUT_FILENO); // turns the pipe into stdout
else
dup2 (open ("/dev/null", O_WRONLY), STDOUT_FILENO);
if ((streamFlags & wantStdErr) != 0)
dup2 (pipeHandles[1], STDERR_FILENO);
else
dup2 (open ("/dev/null", O_WRONLY), STDERR_FILENO);
close (pipeHandles[1]);
#endif
if (execvp (exe.toRawUTF8(), argv.getRawDataPointer()))
_exit (-1);
}


+ 3
- 3
source/modules/water/threads/ChildProcess.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_CHILDPROCESS_H_INCLUDED
#define JUCE_CHILDPROCESS_H_INCLUDED
#ifndef WATER_CHILDPROCESS_H_INCLUDED
#define WATER_CHILDPROCESS_H_INCLUDED
#include "../text/StringArray.h"
@@ -120,4 +120,4 @@ private:
}
#endif // JUCE_CHILDPROCESS_H_INCLUDED
#endif // WATER_CHILDPROCESS_H_INCLUDED

+ 0
- 148
source/modules/water/threads/Process.h View File

@@ -1,148 +0,0 @@
/*
==============================================================================
This file is part of the Water library.
Copyright (c) 2016 ROLI Ltd.
Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
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.
==============================================================================
*/
#ifndef JUCE_PROCESS_H_INCLUDED
#define JUCE_PROCESS_H_INCLUDED
#include "../water.h"
namespace water {
//==============================================================================
/** Represents the current executable's process.
This contains methods for controlling the current application at the
process-level.
@see Thread, JUCEApplicationBase
*/
class Process
{
public:
//==============================================================================
enum ProcessPriority
{
LowPriority = 0,
NormalPriority = 1,
HighPriority = 2,
RealtimePriority = 3
};
/** Changes the current process's priority.
@param priority the process priority, where
0=low, 1=normal, 2=high, 3=realtime
*/
static void setPriority (const ProcessPriority priority);
/** Kills the current process immediately.
This is an emergency process terminator that kills the application
immediately - it's intended only for use only when something goes
horribly wrong.
@see JUCEApplicationBase::quit
*/
static void terminate();
//==============================================================================
/** Returns true if this application process is the one that the user is
currently using.
*/
static bool isForegroundProcess();
/** Attempts to make the current process the active one.
(This is not possible on some platforms).
*/
static void makeForegroundProcess();
/** Hides the application (on an OS that supports this, e.g. OSX) */
static void hide();
//==============================================================================
/** Raises the current process's privilege level.
Does nothing if this isn't supported by the current OS, or if process
privilege level is fixed.
*/
static void raisePrivilege();
/** Lowers the current process's privilege level.
Does nothing if this isn't supported by the current OS, or if process
privilege level is fixed.
*/
static void lowerPrivilege();
//==============================================================================
/** Returns true if this process is being hosted by a debugger. */
static bool isRunningUnderDebugger() noexcept;
//==============================================================================
/** Tries to launch the OS's default reader application for a given file or URL. */
static bool openDocument (const String& documentURL, const String& parameters);
/** Tries to launch the OS's default email application to let the user create a message. */
static bool openEmailWithAttachments (const String& targetEmailAddress,
const String& emailSubject,
const String& bodyText,
const StringArray& filesToAttach);
#ifdef CARLA_OS_WIN
//==============================================================================
/** WINDOWS ONLY - This returns the HINSTANCE of the current module.
The return type is a void* to avoid being dependent on windows.h - just cast
it to a HINSTANCE to use it.
In a normal JUCE application, this will be automatically set to the module
handle of the executable.
If you've built a DLL and plan to use any JUCE messaging or windowing classes,
you'll need to make sure you call the setCurrentModuleInstanceHandle()
to provide the correct module handle in your DllMain() function, because
the system relies on the correct instance handle when opening windows.
*/
static void* getCurrentModuleInstanceHandle() noexcept;
/** WINDOWS ONLY - Sets a new module handle to be used by the library.
The parameter type is a void* to avoid being dependent on windows.h, but it actually
expects a HINSTANCE value.
@see getCurrentModuleInstanceHandle()
*/
static void setCurrentModuleInstanceHandle (void* newHandle) noexcept;
#endif
private:
Process();
CARLA_DECLARE_NON_COPY_CLASS (Process)
};
}
#endif // JUCE_PROCESS_H_INCLUDED

+ 3
- 3
source/modules/water/threads/ScopedLock.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_SCOPEDLOCK_H_INCLUDED
#define JUCE_SCOPEDLOCK_H_INCLUDED
#ifndef WATER_SCOPEDLOCK_H_INCLUDED
#define WATER_SCOPEDLOCK_H_INCLUDED
#include "../water.h"
@@ -235,4 +235,4 @@ private:
}
#endif // JUCE_SCOPEDLOCK_H_INCLUDED
#endif // WATER_SCOPEDLOCK_H_INCLUDED

+ 6
- 5
source/modules/water/threads/SpinLock.h View File

@@ -23,10 +23,11 @@
==============================================================================
*/
#ifndef JUCE_SPINLOCK_H_INCLUDED
#define JUCE_SPINLOCK_H_INCLUDED
#ifndef WATER_SPINLOCK_H_INCLUDED
#define WATER_SPINLOCK_H_INCLUDED
#include "../water.h"
#include "ScopedLock.h"
#include "../memory/Atomic.h"
namespace water {
@@ -86,7 +87,7 @@ public:
/** Releases the lock. */
inline void exit() const noexcept
{
jassert (lock.value == 1); // Agh! Releasing a lock that isn't currently held!
CARLA_SAFE_ASSERT_RETURN(lock.value == 1,);
lock = 0;
}
@@ -106,4 +107,4 @@ private:
}
#endif // JUCE_SPINLOCK_H_INCLUDED
#endif // WATER_SPINLOCK_H_INCLUDED

+ 3
- 3
source/modules/water/water.cpp View File

@@ -1,5 +1,5 @@
/*
* Standalone Juce AudioProcessorGraph
* Cross-platform C++ library for Carla, based on Juce v4
* Copyright (C) 2015 ROLI Ltd.
* Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
*
@@ -34,7 +34,7 @@ static Result getResultForLastError()
return Result::fail (String (messageBuffer));
}
static int64 juce_fileSetPosition (void* handle, int64 pos)
static int64 water_fileSetPosition (void* handle, int64 pos)
{
LARGE_INTEGER li;
li.QuadPart = pos;
@@ -60,7 +60,7 @@ static Result getResultForErrno()
static int getFD (void* handle) noexcept { return (int) (pointer_sized_int) handle; }
static void* fdToVoidPointer (int fd) noexcept { return (void*) (pointer_sized_int) fd; }
static int64 juce_fileSetPosition (void* handle, int64 pos)
static int64 water_fileSetPosition (void* handle, int64 pos)
{
if (handle != nullptr && lseek (getFD (handle), pos, SEEK_SET) == pos)
return pos;


+ 8
- 16
source/modules/water/water.h View File

@@ -1,5 +1,5 @@
/*
* Standalone Juce AudioProcessorGraph
* Cross-platform C++ library for Carla, based on Juce v4
* Copyright (C) 2015 ROLI Ltd.
* Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
*
@@ -28,47 +28,39 @@
#define static_jassert(expression) static_assert(expression, #expression);
#if defined (__arm__) || defined (__arm64__)
#define JUCE_ARM 1
#else
#define JUCE_INTEL 1
#endif
//==============================================================================
// Compiler support
#if (__cplusplus >= 201103L || defined (__GXX_EXPERIMENTAL_CXX0X__)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#define WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (JUCE_DELETED_FUNCTION)
#define JUCE_DELETED_FUNCTION = delete
#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (WATER_DELETED_FUNCTION)
#define WATER_DELETED_FUNCTION = delete
#endif
#endif
#if __clang__
#if __has_feature (cxx_rvalue_references)
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#define WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#endif
#if __has_feature (cxx_deleted_functions)
#define JUCE_DELETED_FUNCTION = delete
#define WATER_DELETED_FUNCTION = delete
#endif
#endif
//==============================================================================
// Declare some fake versions of nullptr and noexcept, for older compilers:
#ifndef JUCE_DELETED_FUNCTION
#ifndef WATER_DELETED_FUNCTION
/** This macro can be placed after a method declaration to allow the use of
the C++11 feature "= delete" on all compilers.
On newer compilers that support it, it does the C++11 "= delete", but on
older ones it's just an empty definition.
*/
#define JUCE_DELETED_FUNCTION
#define WATER_DELETED_FUNCTION
#endif
#define NEEDS_TRANS(x) (x)
//==============================================================================
namespace water


+ 1
- 1
source/modules/water/water.mm View File

@@ -1,5 +1,5 @@
/*
* Standalone Juce AudioProcessorGraph
* Cross-platform C++ library for Carla, based on Juce v4
* Copyright (C) 2015 ROLI Ltd.
* Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
*


+ 22
- 24
source/modules/water/xml/XmlDocument.cpp View File

@@ -80,13 +80,13 @@ void XmlDocument::setEmptyTextElementsIgnored (const bool shouldBeIgnored) noexc
namespace XmlIdentifierChars
{
static bool isIdentifierCharSlow (const juce_wchar c) noexcept
static bool isIdentifierCharSlow (const water_uchar c) noexcept
{
return CharacterFunctions::isLetterOrDigit (c)
|| c == '_' || c == '-' || c == ':' || c == '.';
}
static bool isIdentifierChar (const juce_wchar c) noexcept
static bool isIdentifierChar (const water_uchar c) noexcept
{
static const uint32 legalChars[] = { 0, 0x7ff6000, 0x87fffffe, 0x7fffffe, 0 };
@@ -169,9 +169,9 @@ String XmlDocument::getFileContents (const String& filename) const
return String();
}
juce_wchar XmlDocument::readNextChar() noexcept
water_uchar XmlDocument::readNextChar() noexcept
{
const juce_wchar c = input.getAndAdvance();
const water_uchar c = input.getAndAdvance();
if (c == 0)
{
@@ -226,7 +226,6 @@ bool XmlDocument::parseHeader()
if (headerEnd.isEmpty())
return false;
#if JUCE_DEBUG
const String encoding (String (input, headerEnd)
.fromFirstOccurrenceOf ("encoding", false, true)
.fromFirstOccurrenceOf ("=", false, false)
@@ -234,14 +233,13 @@ bool XmlDocument::parseHeader()
.upToFirstOccurrenceOf ("\"", false, false).trim());
/* If you load an XML document with a non-UTF encoding type, it may have been
loaded wrongly.. Since all the files are read via the normal juce file streams,
loaded wrongly.. Since all the files are read via the normal water file streams,
they're treated as UTF-8, so by the time it gets to the parser, the encoding will
have been lost. Best plan is to stick to utf-8 or if you have specific files to
read, use your own code to convert them to a unicode String, and pass that to the
XML parser.
*/
jassert (encoding.isEmpty() || encoding.startsWithIgnoreCase ("utf-"));
#endif
CARLA_SAFE_ASSERT_RETURN (encoding.isEmpty() || encoding.startsWithIgnoreCase ("utf-"), false);
input = headerEnd + 2;
skipNextWhiteSpace();
@@ -259,7 +257,7 @@ bool XmlDocument::parseDTD()
for (int n = 1; n > 0;)
{
const juce_wchar c = readNextChar();
const water_uchar c = readNextChar();
if (outOfData)
return false;
@@ -329,11 +327,11 @@ void XmlDocument::skipNextWhiteSpace()
void XmlDocument::readQuotedString (String& result)
{
const juce_wchar quote = readNextChar();
const water_uchar quote = readNextChar();
while (! outOfData)
{
const juce_wchar c = readNextChar();
const water_uchar c = readNextChar();
if (c == quote)
break;
@@ -350,7 +348,7 @@ void XmlDocument::readQuotedString (String& result)
for (;;)
{
const juce_wchar character = *input;
const water_uchar character = *input;
if (character == quote)
{
@@ -411,7 +409,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements)
{
skipNextWhiteSpace();
const juce_wchar c = *input;
const water_uchar c = *input;
// empty tag..
if (c == '/' && input[1] == '>')
@@ -447,7 +445,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements)
{
skipNextWhiteSpace();
const juce_wchar nextChar = *input;
const water_uchar nextChar = *input;
if (nextChar == '"' || nextChar == '\'')
{
@@ -497,12 +495,12 @@ void XmlDocument::readChildElements (XmlElement& parent)
if (*input == '<')
{
const juce_wchar c1 = input[1];
const water_uchar c1 = input[1];
if (c1 == '/')
{
// our close tag..
const int closeTag = input.indexOf ((juce_wchar) '>');
const int closeTag = input.indexOf ((water_uchar) '>');
if (closeTag >= 0)
input += closeTag + 1;
@@ -517,7 +515,7 @@ void XmlDocument::readChildElements (XmlElement& parent)
for (;;)
{
const juce_wchar c0 = *input;
const water_uchar c0 = *input;
if (c0 == 0)
{
@@ -554,7 +552,7 @@ void XmlDocument::readChildElements (XmlElement& parent)
for (;;)
{
const juce_wchar c = *input;
const water_uchar c = *input;
if (c == '<')
{
@@ -613,7 +611,7 @@ void XmlDocument::readChildElements (XmlElement& parent)
{
for (;; ++input)
{
juce_wchar nextChar = *input;
water_uchar nextChar = *input;
if (nextChar == '\r')
{
@@ -726,12 +724,12 @@ void XmlDocument::readEntity (String& result)
return;
}
result << (juce_wchar) charCode;
result << (water_uchar) charCode;
}
else
{
const String::CharPointerType entityNameStart (input);
const int closingSemiColon = input.indexOf ((juce_wchar) ';');
const int closingSemiColon = input.indexOf ((water_uchar) ';');
if (closingSemiColon < 0)
{
@@ -757,13 +755,13 @@ String XmlDocument::expandEntity (const String& ent)
if (ent[0] == '#')
{
const juce_wchar char1 = ent[1];
const water_uchar char1 = ent[1];
if (char1 == 'x' || char1 == 'X')
return String::charToString (static_cast<juce_wchar> (ent.substring (2).getHexValue32()));
return String::charToString (static_cast<water_uchar> (ent.substring (2).getHexValue32()));
if (char1 >= '0' && char1 <= '9')
return String::charToString (static_cast<juce_wchar> (ent.substring (1).getIntValue()));
return String::charToString (static_cast<water_uchar> (ent.substring (1).getIntValue()));
setLastError ("illegal escape sequence", false);
return String::charToString ('&');


+ 4
- 4
source/modules/water/xml/XmlDocument.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_XMLDOCUMENT_H_INCLUDED
#define JUCE_XMLDOCUMENT_H_INCLUDED
#ifndef WATER_XMLDOCUMENT_H_INCLUDED
#define WATER_XMLDOCUMENT_H_INCLUDED
#include "../text/StringArray.h"
@@ -165,7 +165,7 @@ private:
bool parseHeader();
bool parseDTD();
void skipNextWhiteSpace();
juce_wchar readNextChar() noexcept;
water_uchar readNextChar() noexcept;
XmlElement* readNextElement (bool alsoParseSubElements);
void readChildElements (XmlElement&);
void readQuotedString (String&);
@@ -181,4 +181,4 @@ private:
}
#endif // JUCE_XMLDOCUMENT_H_INCLUDED
#endif // WATER_XMLDOCUMENT_H_INCLUDED

+ 11
- 13
source/modules/water/xml/XmlElement.cpp View File

@@ -31,7 +31,7 @@
namespace water {
inline bool isValidXmlNameStartCharacter (const juce_wchar character) noexcept
inline bool isValidXmlNameStartCharacter (const water_uchar character) noexcept
{
return character == ':'
|| character == '_'
@@ -51,7 +51,7 @@ inline bool isValidXmlNameStartCharacter (const juce_wchar character) noexcept
|| (character >= 0x10000 && character <= 0xeffff);
}
inline bool isValidXmlNameBodyCharacter (const juce_wchar character) noexcept
inline bool isValidXmlNameBodyCharacter (const water_uchar character) noexcept
{
return isValidXmlNameStartCharacter (character)
|| character == '-'
@@ -134,7 +134,7 @@ XmlElement& XmlElement::operator= (const XmlElement& other)
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
XmlElement::XmlElement (XmlElement&& other) noexcept
: nextListItem (static_cast<LinkedListPointer<XmlElement>&&> (other.nextListItem)),
firstChildElement (static_cast<LinkedListPointer<XmlElement>&&> (other.firstChildElement)),
@@ -178,7 +178,7 @@ XmlElement::~XmlElement() noexcept
namespace XmlOutputFunctions
{
#if 0 // (These functions are just used to generate the lookup table used below)
bool isLegalXmlCharSlow (const juce_wchar character) noexcept
bool isLegalXmlCharSlow (const water_uchar character) noexcept
{
if ((character >= 'a' && character <= 'z')
|| (character >= 'A' && character <= 'Z')
@@ -189,7 +189,7 @@ namespace XmlOutputFunctions
do
{
if (((juce_wchar) (uint8) *t) == character)
if (((water_uchar) (uint8) *t) == character)
return true;
}
while (*++t != 0);
@@ -537,7 +537,7 @@ bool XmlElement::getBoolAttribute (StringRef attributeName, const bool defaultRe
{
if (const XmlAttributeNode* att = getAttribute (attributeName))
{
const juce_wchar firstChar = *(att->value.getCharPointer().findEndOfWhitespace());
const water_uchar firstChar = *(att->value.getCharPointer().findEndOfWhitespace());
return firstChar == '1'
|| firstChar == 't'
@@ -854,7 +854,7 @@ bool XmlElement::isTextElement() const noexcept
return tagName.isEmpty();
}
static const String juce_xmltextContentAttributeName ("text");
static const String water_xmltextContentAttributeName ("text");
const String& XmlElement::getText() const noexcept
{
@@ -862,15 +862,13 @@ const String& XmlElement::getText() const noexcept
// isn't actually a text element.. If this contains text sub-nodes, you
// probably want to use getAllSubText instead.
return getStringAttribute (juce_xmltextContentAttributeName);
return getStringAttribute (water_xmltextContentAttributeName);
}
void XmlElement::setText (const String& newText)
{
if (isTextElement())
setAttribute (juce_xmltextContentAttributeName, newText);
else
jassertfalse; // you can only change the text in a text element, not a normal one.
CARLA_SAFE_ASSERT_RETURN(isTextElement(),);
setAttribute (water_xmltextContentAttributeName, newText);
}
String XmlElement::getAllSubText() const
@@ -900,7 +898,7 @@ String XmlElement::getChildElementAllSubText (StringRef childTagName, const Stri
XmlElement* XmlElement::createTextElement (const String& text)
{
XmlElement* const e = new XmlElement ((int) 0);
e->setAttribute (juce_xmltextContentAttributeName, text);
e->setAttribute (water_xmltextContentAttributeName, text);
return e;
}


+ 5
- 5
source/modules/water/xml/XmlElement.h View File

@@ -23,8 +23,8 @@
==============================================================================
*/
#ifndef JUCE_XMLELEMENT_H_INCLUDED
#define JUCE_XMLELEMENT_H_INCLUDED
#ifndef WATER_XMLELEMENT_H_INCLUDED
#define WATER_XMLELEMENT_H_INCLUDED
#include "../containers/LinkedListPointer.h"
#include "../memory/HeapBlock.h"
@@ -166,7 +166,7 @@ public:
/** Creates a (deep) copy of another element. */
XmlElement& operator= (const XmlElement&);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
#if WATER_COMPILER_SUPPORTS_MOVE_SEMANTICS
XmlElement (XmlElement&&) noexcept;
XmlElement& operator= (XmlElement&&) noexcept;
#endif
@@ -742,7 +742,7 @@ private:
String value;
private:
XmlAttributeNode& operator= (const XmlAttributeNode&) JUCE_DELETED_FUNCTION;
XmlAttributeNode& operator= (const XmlAttributeNode&) WATER_DELETED_FUNCTION;
};
friend class XmlDocument;
@@ -766,4 +766,4 @@ private:
}
#endif // JUCE_XMLELEMENT_H_INCLUDED
#endif // WATER_XMLELEMENT_H_INCLUDED

+ 1
- 1
source/native-plugins/Makefile View File

@@ -57,7 +57,7 @@ endif # HAVE_NTK
ifeq ($(LINUX),true)
ZYN_LD_FLAGS += -lrt
else
ZYN_LD_FLAGS += $(MODULEDIR)/juce_core.a
ZYN_LD_FLAGS += $(MODULEDIR)/water.a
endif
else # HAVE_ZYN_UI_DEPS
ZYN_CXX_FLAGS += -DNO_UI


+ 2
- 2
source/plugin/carla-lv2-export.cpp View File

@@ -47,7 +47,7 @@

using water::String;
using water::StringArray;
using water::juce_wchar;
using water::water_uchar;

// -----------------------------------------------------------------------
// Converts a parameter name to an LV2 compatible symbol
@@ -67,7 +67,7 @@ static const String nameToSymbol(const String& name, const uint32_t portIndex)
{
for (int i=0; i < trimmedName.length(); ++i)
{
const juce_wchar c = trimmedName[i];
const water_uchar c = trimmedName[i];

if (i == 0 && std::isdigit(c))
symbol += "_";


+ 1
- 1
source/tests/CarlaUtils1.cpp View File

@@ -520,7 +520,7 @@ static void test_CarlaMathUtils() noexcept
// math functions (extended)

// carla_addFloat, carla_copyFloat & carla_zeroFloat tests skipped
// mostly unused due to juce::FloatVectorOperations
// mostly unused due to water::FloatVectorOperations
}
#endif



Loading…
Cancel
Save