@@ -179,8 +179,10 @@ HAVE_X11 = $(shell pkg-config --exists x11 && echo true) | |||
endif | |||
ifeq ($(MACOS),true) | |||
ifneq ($(MACOS_OLD),true) | |||
HAVE_HYLIA = true | |||
endif | |||
endif | |||
ifeq ($(LINUX),true) | |||
HAVE_ALSA = $(shell pkg-config --exists alsa && echo true) | |||
@@ -399,7 +401,9 @@ HYLIA_FLAGS = -DLINK_PLATFORM_MACOSX=1 | |||
JACKBRIDGE_LIBS = -ldl -lpthread | |||
LILV_LIBS = -ldl -lm | |||
RTAUDIO_FLAGS += -D__MACOSX_CORE__ | |||
RTAUDIO_LIBS += -framework CoreAudio | |||
RTMIDI_FLAGS += -D__MACOSX_CORE__ | |||
RTMIDI_LIBS += -framework CoreMIDI | |||
WATER_LIBS = -framework AppKit | |||
endif | |||
@@ -1865,7 +1865,11 @@ void carla_set_chunk_data(uint pluginId, const char* chunkData) | |||
if (plugin->getOptionsEnabled() & CB::PLUGIN_OPTION_USE_CHUNKS) | |||
{ | |||
std::vector<uint8_t> chunk(carla_getChunkFromBase64String(chunkData)); | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
return plugin->setChunkData(chunk.data(), chunk.size()); | |||
#else | |||
return plugin->setChunkData(&chunk.front(), chunk.size()); | |||
#endif | |||
} | |||
carla_stderr2("carla_set_chunk_data(%i, \"%s\") - plugin does not use chunks", pluginId, chunkData); | |||
@@ -762,5 +762,9 @@ int* carla_x11_get_window_pos(uintptr_t winId) | |||
#include "CarlaPipeUtils.cpp" | |||
#if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | |||
# include "water/misc/Time.cpp" | |||
#endif | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
#endif // CARLA_UTILS_CACHED_PLUGINS_ONLY |
@@ -785,7 +785,11 @@ public: | |||
std::vector<uint8_t> chunk(carla_getChunkFromBase64String(chunkDataBase64.toRawUTF8())); | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
plugin->setChunkData(chunk.data(), chunk.size()); | |||
#else | |||
plugin->setChunkData(&chunk.front(), chunk.size()); | |||
#endif | |||
break; | |||
} | |||
@@ -487,7 +487,11 @@ protected: | |||
if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) | |||
{ | |||
std::vector<uint8_t> chunk(carla_getChunkFromBase64String(cdata)); | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
plugin->setChunkData(chunk.data(), chunk.size()); | |||
#else | |||
plugin->setChunkData(&chunk.front(), chunk.size()); | |||
#endif | |||
} | |||
delete[] cdata; | |||
@@ -52,8 +52,10 @@ static void initRtAudioAPIsIfNeeded() | |||
std::vector<RtAudio::Api> apis; | |||
RtAudio::getCompiledApi(apis); | |||
for (const RtAudio::Api& api : apis) | |||
for (std::vector<RtAudio::Api>::const_iterator it = apis.begin(), end=apis.end(); it != end; ++it) | |||
{ | |||
const RtAudio::Api& api(*it); | |||
if (api == RtAudio::UNIX_JACK && ! jackbridge_is_ok()) | |||
continue; | |||
@@ -838,7 +838,11 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave) | |||
if (stateSave.chunk != nullptr && (pData->options & PLUGIN_OPTION_USE_CHUNKS) != 0) | |||
{ | |||
std::vector<uint8_t> chunk(carla_getChunkFromBase64String(stateSave.chunk)); | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
setChunkData(chunk.data(), chunk.size()); | |||
#else | |||
setChunkData(&chunk.front(), chunk.size()); | |||
#endif | |||
} | |||
#ifndef BUILD_BRIDGE | |||
@@ -474,7 +474,11 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(fInfo.chunk.size() > 0, 0); | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
*dataPtr = fInfo.chunk.data(); | |||
#else | |||
*dataPtr = &fInfo.chunk.front(); | |||
#endif | |||
return fInfo.chunk.size(); | |||
} | |||
@@ -770,7 +774,11 @@ public: | |||
// save data internally as well | |||
fInfo.chunk.resize(dataSize); | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
std::memcpy(fInfo.chunk.data(), data, dataSize); | |||
#else | |||
std::memcpy(&fInfo.chunk.front(), data, dataSize); | |||
#endif | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -1301,7 +1301,7 @@ public: | |||
// write URI mappings | |||
uint32_t u = 0; | |||
for (auto it=fCustomURIDs.begin(), end=fCustomURIDs.end(); it != end; ++it, ++u) | |||
for (std::vector<std::string>::iterator it=fCustomURIDs.begin(), end=fCustomURIDs.end(); it != end; ++it, ++u) | |||
{ | |||
if (u < CARLA_URI_MAP_ID_COUNT) | |||
continue; | |||
@@ -4492,7 +4492,11 @@ public: | |||
fLastStateChunk = std::malloc(chunk.size()); | |||
CARLA_SAFE_ASSERT_RETURN(fLastStateChunk != nullptr, nullptr); | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
std::memcpy(fLastStateChunk, chunk.data(), chunk.size()); | |||
#else | |||
std::memcpy(fLastStateChunk, &chunk.front(), chunk.size()); | |||
#endif | |||
*size = chunk.size(); | |||
return fLastStateChunk; | |||
@@ -6258,7 +6262,11 @@ bool CarlaPipeServerLV2::msgReceived(const char* const msg) noexcept | |||
delete[] base64atom; | |||
CARLA_SAFE_ASSERT_RETURN(chunk.size() >= sizeof(LV2_Atom), true); | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
const LV2_Atom* const atom((const LV2_Atom*)chunk.data()); | |||
#else | |||
const LV2_Atom* const atom((const LV2_Atom*)&chunk.front()); | |||
#endif | |||
CARLA_SAFE_ASSERT_RETURN(lv2_atom_total_size(atom) == chunk.size(), true); | |||
try { | |||
@@ -1361,7 +1361,9 @@ public: | |||
if (midiEvent.size > 3) | |||
continue; | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
static_assert(3 <= EngineMidiEvent::kDataSize, "Incorrect data"); | |||
#endif | |||
uint8_t status = uint8_t(MIDI_GET_STATUS_FROM_DATA(midiEvent.data)); | |||
@@ -201,7 +201,11 @@ bool CarlaBridgeUI::msgReceived(const char* const msg) noexcept | |||
delete[] base64atom; | |||
CARLA_SAFE_ASSERT_RETURN(chunk.size() >= sizeof(LV2_Atom), true); | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
const LV2_Atom* const atom((const LV2_Atom*)chunk.data()); | |||
#else | |||
const LV2_Atom* const atom((const LV2_Atom*)&chunk.front()); | |||
#endif | |||
const uint32_t atomTotalSizeCheck(lv2_atom_total_size(atom)); | |||
CARLA_SAFE_ASSERT_RETURN(atomTotalSizeCheck == atomTotalSize, true); | |||
@@ -353,4 +357,8 @@ CARLA_BRIDGE_END_NAMESPACE | |||
#include "CarlaPipeUtils.cpp" | |||
#if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | |||
# include "water/misc/Time.cpp" | |||
#endif | |||
// --------------------------------------------------------------------- |
@@ -34,11 +34,6 @@ ifeq ($(MACOS),true) | |||
BUILD_CXX_FLAGS += -ObjC++ | |||
endif | |||
# vstsdk requires this | |||
ifeq ($(MACOS_OR_WIN32),true) | |||
BUILD_CXX_FLAGS += -Wno-zero-as-null-pointer-constant | |||
endif | |||
32BIT_FLAGS += -DBUILD_BRIDGE | |||
64BIT_FLAGS += -DBUILD_BRIDGE | |||
@@ -76,7 +76,6 @@ static void print_lib_error(const char* const filename) | |||
DISCOVERY_OUT("error", error); | |||
} | |||
#ifndef CARLA_OS_MAC | |||
// -------------------------------------------------------------------------- | |||
// VST stuff | |||
@@ -266,7 +265,6 @@ static intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t | |||
return ret; | |||
} | |||
#endif // ! CARLA_OS_MAC | |||
#ifdef HAVE_LINUXSAMPLER | |||
// -------------------------------------------------------------------------- | |||
@@ -1167,7 +1165,6 @@ static void do_lv2_check(const char* const bundle, const bool doInit) | |||
} | |||
} | |||
#ifndef CARLA_OS_MAC | |||
static void do_vst_check(lib_t& libHandle, const bool doInit) | |||
{ | |||
VST_Function vstFn = lib_symbol<VST_Function>(libHandle, "VSTPluginMain"); | |||
@@ -1434,7 +1431,6 @@ static void do_vst_check(lib_t& libHandle, const bool doInit) | |||
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f); | |||
} | |||
#endif // ! CARLA_OS_MAC | |||
static void do_fluidsynth_check(const char* const filename, const bool doInit) | |||
{ | |||
@@ -106,7 +106,7 @@ $(OBJDIR)/$(MODULENAME).cpp.%64.o: $(MODULENAME).cpp | |||
# ---------------------------------------------------------------------------------------------------------------------------- | |||
$(OBJDIR)/$(MODULENAME).mm.o: $(MODULENAME).cpp | |||
$(OBJDIR)/$(MODULENAME).mm.o: $(MODULENAME).mm $(MODULENAME).cpp | |||
-@mkdir -p $(OBJDIR) | |||
@echo "Compiling $<" | |||
@$(CXX) $< $(BUILD_CXX_FLAGS) -ObjC++ -c -o $@ | |||
@@ -19,6 +19,13 @@ | |||
#include "maths/MathsFunctions.h" | |||
#include "misc/Result.h" | |||
#ifdef CARLA_OS_MAC | |||
# include "text/String.h" | |||
# import <Foundation/NSString.h> | |||
#endif | |||
#include <cerrno> | |||
//============================================================================== | |||
namespace water | |||
{ | |||
@@ -48,7 +55,11 @@ int64 water_fileSetPosition (void* handle, int64 pos) | |||
static inline | |||
Result getResultForErrno() | |||
{ | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
return Result::fail (String (std::strerror (std::errno))); | |||
#else | |||
return Result::fail (String (strerror (errno))); | |||
#endif | |||
} | |||
static inline | |||
@@ -67,4 +78,18 @@ int64 water_fileSetPosition (void* handle, int64 pos) | |||
} | |||
#endif | |||
#ifdef CARLA_OS_MAC | |||
static inline | |||
String nsStringToWater (NSString* s) | |||
{ | |||
return CharPointer_UTF8 ([s UTF8String]); | |||
} | |||
static inline | |||
NSString* waterStringToNS (const String& s) | |||
{ | |||
return [NSString stringWithUTF8String: s.toUTF8()]; | |||
} | |||
#endif | |||
} |
@@ -69,10 +69,10 @@ bool DirectoryIterator::fileMatches (const StringArray& wildCards, const String& | |||
bool DirectoryIterator::next() | |||
{ | |||
return next (nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); | |||
return next (nullptr, nullptr, nullptr, nullptr, nullptr); | |||
} | |||
bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResult, int64* const fileSize, | |||
bool DirectoryIterator::next (bool* const isDirResult, int64* const fileSize, | |||
Time* const modTime, Time* const creationTime, bool* const isReadOnly) | |||
{ | |||
for (;;) | |||
@@ -81,17 +81,16 @@ bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResul | |||
if (subIterator != nullptr) | |||
{ | |||
if (subIterator->next (isDirResult, isHiddenResult, fileSize, modTime, creationTime, isReadOnly)) | |||
if (subIterator->next (isDirResult, fileSize, modTime, creationTime, isReadOnly)) | |||
return true; | |||
subIterator = nullptr; | |||
} | |||
String filename; | |||
bool isDirectory, isHidden = false, shouldContinue = false; | |||
bool isDirectory, shouldContinue = false; | |||
while (fileFinder.next (filename, &isDirectory, | |||
(isHiddenResult != nullptr || (whatToLookFor & File::ignoreHiddenFiles) != 0) ? &isHidden : nullptr, | |||
fileSize, modTime, creationTime, isReadOnly)) | |||
{ | |||
++index; | |||
@@ -102,7 +101,7 @@ bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResul | |||
if (isDirectory) | |||
{ | |||
if (isRecursive && ((whatToLookFor & File::ignoreHiddenFiles) == 0 || ! isHidden)) | |||
if (isRecursive) | |||
subIterator = new DirectoryIterator (File::createFileWithoutCheckingPath (path + filename), | |||
true, wildCard, whatToLookFor); | |||
@@ -117,13 +116,9 @@ bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResul | |||
if (matches && (isRecursive || wildCards.size() > 1)) | |||
matches = fileMatches (wildCards, filename); | |||
if (matches && (whatToLookFor & File::ignoreHiddenFiles) != 0) | |||
matches = ! isHidden; | |||
if (matches) | |||
{ | |||
currentFile = File::createFileWithoutCheckingPath (path + filename); | |||
if (isHiddenResult != nullptr) *isHiddenResult = isHidden; | |||
if (isDirResult != nullptr) *isDirResult = isDirectory; | |||
return true; | |||
@@ -100,7 +100,6 @@ public: | |||
parameters will be filled-in. | |||
*/ | |||
bool next (bool* isDirectory, | |||
bool* isHidden, | |||
int64* fileSize, | |||
Time* modTime, | |||
Time* creationTime, | |||
@@ -128,7 +127,7 @@ private: | |||
~NativeIterator(); | |||
bool next (String& filenameFound, | |||
bool* isDirectory, bool* isHidden, int64* fileSize, | |||
bool* isDirectory, int64* fileSize, | |||
Time* modTime, Time* creationTime, bool* isReadOnly); | |||
class Pimpl; | |||
@@ -39,12 +39,16 @@ | |||
#else | |||
# include <dlfcn.h> | |||
# include <fcntl.h> | |||
# include <fnmatch.h> | |||
# include <pwd.h> | |||
# include <sys/stat.h> | |||
# ifdef CARLA_OS_MAC | |||
# include <mach-o/dyld.h> | |||
# import <Foundation/NSFileManager.h> | |||
# import <Foundation/NSPathUtilities.h> | |||
# import <Foundation/NSString.h> | |||
# else | |||
# include <dirent.h> | |||
# include <fnmatch.h> | |||
# endif | |||
#endif | |||
@@ -1152,7 +1156,7 @@ public: | |||
} | |||
bool next (String& filenameFound, | |||
bool* const isDir, bool* const isHidden, int64* const fileSize, | |||
bool* const isDir, int64* const fileSize, | |||
Time* const modTime, Time* const creationTime, bool* const isReadOnly) | |||
{ | |||
using namespace WindowsFileHelpers; | |||
@@ -1174,7 +1178,6 @@ public: | |||
filenameFound = findData.cFileName; | |||
if (isDir != nullptr) *isDir = ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); | |||
if (isHidden != nullptr) *isHidden = ((findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0); | |||
if (isReadOnly != nullptr) *isReadOnly = ((findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) != 0); | |||
if (fileSize != nullptr) *fileSize = findData.nFileSizeLow + (((int64) findData.nFileSizeHigh) << 32); | |||
if (modTime != nullptr) *modTime = Time (fileTimeToTime (&findData.ftLastWriteTime)); | |||
@@ -1193,7 +1196,7 @@ private: | |||
//===================================================================================================================== | |||
namespace | |||
{ | |||
#if CARLA_OS_MAC | |||
#ifdef CARLA_OS_MAC | |||
typedef struct stat water_statStruct; | |||
#define WATER_STAT stat | |||
#else | |||
@@ -1207,7 +1210,7 @@ namespace | |||
&& WATER_STAT (fileName.toUTF8(), &info) == 0; | |||
} | |||
#if CARLA_OS_MAC | |||
#if 0 //def CARLA_OS_MAC | |||
static int64 getCreationTime (const water_statStruct& s) noexcept { return (int64) s.st_birthtime; } | |||
#else | |||
static int64 getCreationTime (const water_statStruct& s) noexcept { return (int64) s.st_ctime; } | |||
@@ -1383,7 +1386,9 @@ static NSString* getFileLink (const String& path) | |||
bool File::isSymbolicLink() const | |||
{ | |||
return getFileLink (fullPath) != nil; | |||
// FIXME | |||
return false; | |||
//return getFileLink (fullPath) != nil; | |||
} | |||
File File::getLinkedTarget() const | |||
@@ -1396,7 +1401,7 @@ File File::getLinkedTarget() const | |||
bool File::copyInternal (const File& dest) const | |||
{ | |||
@autoreleasepool | |||
//@autoreleasepool | |||
{ | |||
NSFileManager* fm = [NSFileManager defaultManager]; | |||
@@ -1415,7 +1420,7 @@ bool File::copyInternal (const File& dest) const | |||
File File::getSpecialLocation (const SpecialLocationType type) | |||
{ | |||
@autoreleasepool | |||
//@autoreleasepool | |||
{ | |||
String resultPath; | |||
@@ -1463,7 +1468,7 @@ public: | |||
wildCard (wildCard_), | |||
enumerator (nil) | |||
{ | |||
@autoreleasepool | |||
//@autoreleasepool | |||
{ | |||
enumerator = [[[NSFileManager defaultManager] enumeratorAtPath: waterStringToNS (directory.getFullPathName())] retain]; | |||
} | |||
@@ -1475,10 +1480,10 @@ public: | |||
} | |||
bool next (String& filenameFound, | |||
bool* const isDir, bool* const isHidden, int64* const fileSize, | |||
bool* const isDir, int64* const fileSize, | |||
Time* const modTime, Time* const creationTime, bool* const isReadOnly) | |||
{ | |||
@autoreleasepool | |||
//@autoreleasepool | |||
{ | |||
const char* wildcardUTF8 = nullptr; | |||
@@ -1500,9 +1505,6 @@ public: | |||
const String fullPath (parentDir + filenameFound); | |||
updateStatInfoForFile (fullPath, isDir, fileSize, modTime, creationTime, isReadOnly); | |||
if (isHidden != nullptr) | |||
*isHidden = MacFileHelpers::isHiddenFile (fullPath); | |||
return true; | |||
} | |||
} | |||
@@ -1624,7 +1626,7 @@ public: | |||
} | |||
bool next (String& filenameFound, | |||
bool* const isDir, bool* const isHidden, int64* const fileSize, | |||
bool* const isDir, int64* const fileSize, | |||
Time* const modTime, Time* const creationTime, bool* const isReadOnly) | |||
{ | |||
if (dir != nullptr) | |||
@@ -1647,9 +1649,6 @@ public: | |||
updateStatInfoForFile (parentDir + filenameFound, isDir, fileSize, modTime, creationTime, isReadOnly); | |||
if (isHidden != nullptr) | |||
*isHidden = filenameFound.startsWithChar ('.'); | |||
return true; | |||
} | |||
} | |||
@@ -1675,10 +1674,10 @@ DirectoryIterator::NativeIterator::NativeIterator (const File& directory, const | |||
DirectoryIterator::NativeIterator::~NativeIterator() {} | |||
bool DirectoryIterator::NativeIterator::next (String& filenameFound, | |||
bool* isDir, bool* isHidden, int64* fileSize, | |||
bool* isDir, int64* fileSize, | |||
Time* modTime, Time* creationTime, bool* isReadOnly) | |||
{ | |||
return pimpl->next (filenameFound, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly); | |||
return pimpl->next (filenameFound, isDir, fileSize, modTime, creationTime, isReadOnly); | |||
} | |||
} |
@@ -831,7 +831,7 @@ public: | |||
#endif | |||
//============================================================================== | |||
#ifdef CARLA_OS_MAC | |||
#if 0 //def CARLA_OS_MAC | |||
/** OSX ONLY - Finds the OSType of a file from the its resources. */ | |||
OSType getMacOSType() const; | |||
@@ -62,8 +62,10 @@ public: | |||
/** Destructor. */ | |||
inline ~Atomic() noexcept | |||
{ | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
// This class can only be used for types which are 32 or 64 bits in size. | |||
static_jassert (sizeof (Type) == 4 || sizeof (Type) == 8); | |||
#endif | |||
} | |||
/** Atomically reads and returns the current value. */ | |||
@@ -28,6 +28,10 @@ | |||
#include "../water.h" | |||
#ifdef CARLA_OS_MAC | |||
# include <libkern/OSByteOrder.h> | |||
#endif | |||
namespace water { | |||
//============================================================================== | |||
@@ -28,7 +28,9 @@ | |||
#include <ctime> | |||
#include <sys/time.h> | |||
#ifdef CARLA_OS_WIN | |||
#if defined(CARLA_OS_MAC) | |||
# include <mach/mach_time.h> | |||
#elif defined(CARLA_OS_WIN) | |||
# include <mmsystem.h> | |||
#endif | |||
@@ -37,13 +39,44 @@ namespace water { | |||
namespace TimeHelpers | |||
{ | |||
static uint32 lastMSCounterValue = 0; | |||
#ifdef CARLA_OS_MAC | |||
/* NB: these are kept outside the HiResCounterInfo struct and initialised to 1 to avoid | |||
division-by-zero errors if some other static constructor calls us before this file's | |||
static constructors have had a chance to fill them in correctly.. | |||
*/ | |||
static uint64 hiResCounterNumerator = 0, hiResCounterDenominator = 1; | |||
struct HiResCounterInfo { | |||
HiResCounterInfo() | |||
{ | |||
mach_timebase_info_data_t timebase; | |||
(void) mach_timebase_info (&timebase); | |||
if (timebase.numer % 1000000 == 0) | |||
{ | |||
hiResCounterNumerator = timebase.numer / 1000000; | |||
hiResCounterDenominator = timebase.denom; | |||
} | |||
else | |||
{ | |||
hiResCounterNumerator = timebase.numer; | |||
hiResCounterDenominator = timebase.denom * (uint64) 1000000; | |||
} | |||
} | |||
}; | |||
static HiResCounterInfo hiResCounterInfo; | |||
#endif | |||
} | |||
//============================================================================== | |||
static uint32 water_millisecondsSinceStartup() noexcept | |||
{ | |||
#ifdef CARLA_OS_WIN | |||
#if defined(CARLA_OS_MAC) | |||
return (uint32) ((mach_absolute_time() * TimeHelpers::hiResCounterNumerator) / TimeHelpers::hiResCounterDenominator); | |||
#elif defined(CARLA_OS_WIN) | |||
return (uint32) timeGetTime(); | |||
#else | |||
timespec t; | |||
@@ -137,7 +137,9 @@ int64 InputStream::readInt64BigEndian() | |||
float InputStream::readFloat() | |||
{ | |||
// the union below relies on these types being the same size... | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
static_jassert (sizeof (int32) == sizeof (float)); | |||
#endif | |||
union { int32 asInt; float asFloat; } n; | |||
n.asInt = (int32) readInt(); | |||
return n.asFloat; | |||
@@ -34,6 +34,13 @@ | |||
#include <locale> | |||
#include <iostream> | |||
#ifdef CARLA_OS_MAC | |||
// FIXME | |||
// # import <CoreData/CoreData.h> | |||
#endif | |||
// #import <Carbon/UnicodeConverter.h> | |||
namespace water { | |||
NewLine newLine; | |||
@@ -1951,6 +1958,56 @@ String String::fromUTF8 (const char* const buffer, int bufferSizeBytes) | |||
return String(); | |||
} | |||
#ifdef CARLA_OS_MAC | |||
String String::convertToPrecomposedUnicode() const | |||
{ | |||
#if 0 | |||
UnicodeMapping map; | |||
map.unicodeEncoding = CreateTextEncoding (kTextEncodingUnicodeDefault, | |||
kUnicodeNoSubset, | |||
kTextEncodingDefaultFormat); | |||
map.otherEncoding = CreateTextEncoding (kTextEncodingUnicodeDefault, | |||
kUnicodeCanonicalCompVariant, | |||
kTextEncodingDefaultFormat); | |||
map.mappingVersion = kUnicodeUseLatestMapping; | |||
UnicodeToTextInfo conversionInfo = 0; | |||
String result; | |||
if (CreateUnicodeToTextInfo (&map, &conversionInfo) == noErr) | |||
{ | |||
const size_t bytesNeeded = CharPointer_UTF16::getBytesRequiredFor (getCharPointer()); | |||
HeapBlock<char> tempOut; | |||
tempOut.calloc (bytesNeeded + 4); | |||
ByteCount bytesRead = 0; | |||
ByteCount outputBufferSize = 0; | |||
if (ConvertFromUnicodeToText (conversionInfo, | |||
bytesNeeded, (ConstUniCharArrayPtr) toUTF16().getAddress(), | |||
kUnicodeDefaultDirectionMask, | |||
0, 0, 0, 0, | |||
bytesNeeded, &bytesRead, | |||
&outputBufferSize, tempOut) == noErr) | |||
{ | |||
result = String (CharPointer_UTF16 ((CharPointer_UTF16::CharType*) tempOut.getData())); | |||
} | |||
DisposeUnicodeToTextInfo (&conversionInfo); | |||
} | |||
return result; | |||
#else | |||
return *this; | |||
#endif | |||
} | |||
#endif | |||
//============================================================================== | |||
StringRef::StringRef() noexcept : text ((const String::CharPointerType::CharType*) "\0\0\0") | |||
{ | |||
@@ -1063,7 +1063,7 @@ public: | |||
void swapWith (String& other) noexcept; | |||
//============================================================================== | |||
#ifdef CARLA_OS_MAC | |||
#if 0 //def CARLA_OS_MAC | |||
/** OSX ONLY - Creates a String from an OSX CFString. */ | |||
static String fromCFString (CFStringRef cfString); | |||
@@ -1072,7 +1072,9 @@ public: | |||
finished with it. | |||
*/ | |||
CFStringRef toCFString() const; | |||
#endif | |||
#ifdef CARLA_OS_MAC | |||
/** OSX ONLY - Returns a copy of this string in which any decomposed unicode characters have | |||
been converted to their precomposed equivalents. */ | |||
String convertToPrecomposedUnicode() const; | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Native Plugins | |||
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2012-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -23,6 +23,7 @@ | |||
# define DISTRHO_PLUGIN_HAS_UI 0 | |||
#endif | |||
#include "CarlaMathUtils.hpp" | |||
#include "CarlaJuceUtils.hpp" | |||
// Plugin Code | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Native Plugins | |||
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2012-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -23,6 +23,7 @@ | |||
# define DISTRHO_PLUGIN_HAS_UI 0 | |||
#endif | |||
#include "CarlaMathUtils.hpp" | |||
#include "CarlaJuceUtils.hpp" | |||
// Plugin Code | |||
@@ -23,6 +23,7 @@ | |||
# define DISTRHO_PLUGIN_HAS_UI 0 | |||
#endif | |||
#include "CarlaMathUtils.hpp" | |||
#include "CarlaJuceUtils.hpp" | |||
// Plugin Code | |||
@@ -23,6 +23,7 @@ | |||
# define DISTRHO_PLUGIN_HAS_UI 0 | |||
#endif | |||
#include "CarlaMathUtils.hpp" | |||
#include "CarlaJuceUtils.hpp" | |||
// Plugin Code | |||
@@ -23,6 +23,7 @@ | |||
# define DISTRHO_PLUGIN_HAS_UI 0 | |||
#endif | |||
#include "CarlaMathUtils.hpp" | |||
#include "CarlaJuceUtils.hpp" | |||
// Plugin Code | |||
@@ -32,13 +32,16 @@ | |||
#endif | |||
#include <clocale> | |||
#include <ctime> | |||
#include <fcntl.h> | |||
#if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | |||
# include "water/misc/Time.h" | |||
# include "water/text/String.h" | |||
#else | |||
# include <ctime> | |||
#endif | |||
#ifndef CARLA_OS_WIN | |||
# include <cerrno> | |||
# include <signal.h> | |||
# include <sys/wait.h> | |||
@@ -965,7 +968,7 @@ const char* CarlaPipeCommon::_readline() const noexcept | |||
char c; | |||
char* ptr = pData->tmpBuf; | |||
ssize_t ret; | |||
ssize_t ret = -1; | |||
pData->tmpStr.clear(); | |||