Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.7KB

  1. /*
  2. * Standalone Juce AudioProcessorGraph
  3. * Copyright (C) 2015 ROLI Ltd.
  4. * Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 2 of
  9. * the License, or any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  17. */
  18. #include "water.h"
  19. #include "CarlaMutex.hpp"
  20. #include <locale>
  21. #include <ctime>
  22. #include <cctype>
  23. #include <cstdarg>
  24. #include <iostream>
  25. #include <sys/time.h>
  26. #ifdef CARLA_OS_WIN
  27. #include <mmsystem.h>
  28. #include <shlobj.h>
  29. #else
  30. #include <dlfcn.h>
  31. #include <fcntl.h>
  32. #include <pwd.h>
  33. #include <signal.h>
  34. #include <sys/stat.h>
  35. #include <sys/wait.h>
  36. #ifdef CARLA_OS_MAC
  37. #else
  38. #include <dirent.h>
  39. #include <fnmatch.h>
  40. #endif
  41. #endif
  42. // #include <wctype.h>
  43. #include "misc/Result.h"
  44. //==============================================================================
  45. namespace water
  46. {
  47. #ifdef CARLA_OS_WIN
  48. static Result getResultForLastError()
  49. {
  50. TCHAR messageBuffer [256] = { 0 };
  51. FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
  52. nullptr, GetLastError(), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
  53. messageBuffer, (DWORD) numElementsInArray (messageBuffer) - 1, nullptr);
  54. return Result::fail (String (messageBuffer));
  55. }
  56. static int64 juce_fileSetPosition (void* handle, int64 pos)
  57. {
  58. LARGE_INTEGER li;
  59. li.QuadPart = pos;
  60. li.LowPart = SetFilePointer ((HANDLE) handle, (LONG) li.LowPart, &li.HighPart, FILE_BEGIN); // (returns -1 if it fails)
  61. return li.QuadPart;
  62. }
  63. static void* currentModuleHandle = nullptr;
  64. void* Process::getCurrentModuleInstanceHandle() noexcept
  65. {
  66. if (currentModuleHandle == nullptr)
  67. currentModuleHandle = GetModuleHandleA (nullptr);
  68. return currentModuleHandle;
  69. }
  70. #else
  71. static Result getResultForErrno()
  72. {
  73. return Result::fail (String (strerror (errno)));
  74. }
  75. static int getFD (void* handle) noexcept { return (int) (pointer_sized_int) handle; }
  76. static void* fdToVoidPointer (int fd) noexcept { return (void*) (pointer_sized_int) fd; }
  77. static int64 juce_fileSetPosition (void* handle, int64 pos)
  78. {
  79. if (handle != 0 && lseek (getFD (handle), pos, SEEK_SET) == pos)
  80. return pos;
  81. return -1;
  82. }
  83. #endif
  84. }
  85. #include "containers/NamedValueSet.cpp"
  86. #include "containers/Variant.cpp"
  87. #include "files/DirectoryIterator.cpp"
  88. #include "files/File.cpp"
  89. #include "files/FileInputStream.cpp"
  90. #include "files/FileOutputStream.cpp"
  91. #include "files/TemporaryFile.cpp"
  92. #include "maths/Random.cpp"
  93. #include "memory/MemoryBlock.cpp"
  94. #include "midi/MidiBuffer.cpp"
  95. #include "midi/MidiFile.cpp"
  96. #include "midi/MidiMessage.cpp"
  97. #include "midi/MidiMessageSequence.cpp"
  98. #include "misc/Result.cpp"
  99. #include "misc/Time.cpp"
  100. #include "processors/AudioProcessor.cpp"
  101. #include "processors/AudioProcessorGraph.cpp"
  102. #include "streams/FileInputSource.cpp"
  103. #include "streams/InputStream.cpp"
  104. #include "streams/MemoryOutputStream.cpp"
  105. #include "streams/OutputStream.cpp"
  106. #include "text/CharacterFunctions.cpp"
  107. #include "text/Identifier.cpp"
  108. #include "text/StringArray.cpp"
  109. #include "text/StringPool.cpp"
  110. #include "text/String.cpp"
  111. #include "threads/ChildProcess.cpp"
  112. #include "xml/XmlDocument.cpp"
  113. #include "xml/XmlElement.cpp"