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.

137 lines
3.8KB

  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 <locale>
  20. #include <ctime>
  21. #include <cctype>
  22. #include <cstdarg>
  23. #include <iostream>
  24. #include <sys/time.h>
  25. #ifdef CARLA_OS_WIN
  26. #include <mmsystem.h>
  27. #include <shlobj.h>
  28. #else
  29. #include <dlfcn.h>
  30. #include <fcntl.h>
  31. #include <pwd.h>
  32. #include <signal.h>
  33. #include <sys/stat.h>
  34. #include <sys/wait.h>
  35. #ifdef CARLA_OS_MAC
  36. #else
  37. #include <dirent.h>
  38. #include <fnmatch.h>
  39. #endif
  40. #endif
  41. // #include <wctype.h>
  42. //==============================================================================
  43. namespace water
  44. {
  45. #ifdef CARLA_OS_WIN
  46. static Result getResultForLastError()
  47. {
  48. TCHAR messageBuffer [256] = { 0 };
  49. FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
  50. nullptr, GetLastError(), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
  51. messageBuffer, (DWORD) numElementsInArray (messageBuffer) - 1, nullptr);
  52. return Result::fail (String (messageBuffer));
  53. }
  54. static int64 juce_fileSetPosition (void* handle, int64 pos)
  55. {
  56. LARGE_INTEGER li;
  57. li.QuadPart = pos;
  58. li.LowPart = SetFilePointer ((HANDLE) handle, (LONG) li.LowPart, &li.HighPart, FILE_BEGIN); // (returns -1 if it fails)
  59. return li.QuadPart;
  60. }
  61. static void* currentModuleHandle = nullptr;
  62. void* JUCE_CALLTYPE Process::getCurrentModuleInstanceHandle() noexcept
  63. {
  64. if (currentModuleHandle == nullptr)
  65. currentModuleHandle = GetModuleHandleA (nullptr);
  66. return currentModuleHandle;
  67. }
  68. #else
  69. static Result getResultForErrno()
  70. {
  71. return Result::fail (String (strerror (errno)));
  72. }
  73. static int getFD (void* handle) noexcept { return (int) (pointer_sized_int) handle; }
  74. static void* fdToVoidPointer (int fd) noexcept { return (void*) (pointer_sized_int) fd; }
  75. static int64 juce_fileSetPosition (void* handle, int64 pos)
  76. {
  77. if (handle != 0 && lseek (getFD (handle), pos, SEEK_SET) == pos)
  78. return pos;
  79. return -1;
  80. }
  81. #endif
  82. #include "memory/juce_MemoryBlock.cpp"
  83. #include "text/juce_CharacterFunctions.cpp"
  84. #include "text/juce_String.cpp"
  85. #include "containers/juce_NamedValueSet.cpp"
  86. #include "containers/juce_Variant.cpp"
  87. #include "files/juce_DirectoryIterator.cpp"
  88. #include "files/juce_File.cpp"
  89. #include "files/juce_TemporaryFile.cpp"
  90. #include "midi/juce_MidiBuffer.cpp"
  91. #include "midi/juce_MidiMessage.cpp"
  92. #include "maths/juce_Random.cpp"
  93. #include "misc/juce_Result.cpp"
  94. #include "processors/juce_AudioProcessor.cpp"
  95. #include "processors/juce_AudioProcessorGraph.cpp"
  96. #include "streams/juce_FileInputSource.cpp"
  97. #include "streams/juce_FileInputStream.cpp"
  98. #include "streams/juce_FileOutputStream.cpp"
  99. #include "streams/juce_InputStream.cpp"
  100. #include "streams/juce_MemoryOutputStream.cpp"
  101. #include "streams/juce_OutputStream.cpp"
  102. #include "text/juce_Identifier.cpp"
  103. #include "text/juce_StringArray.cpp"
  104. #include "text/juce_StringPool.cpp"
  105. #include "threads/juce_ChildProcess.cpp"
  106. #include "time/juce_Time.cpp"
  107. #include "xml/juce_XmlElement.cpp"
  108. #include "xml/juce_XmlDocument.cpp"
  109. }