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.

114 lines
3.3KB

  1. /*
  2. * Cross-platform C++ library for Carla, based on Juce v4
  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 "maths/MathsFunctions.h"
  19. #include "misc/Result.h"
  20. //==============================================================================
  21. namespace water
  22. {
  23. #ifdef CARLA_OS_WIN
  24. static Result getResultForLastError()
  25. {
  26. TCHAR messageBuffer [256] = { 0 };
  27. FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
  28. nullptr, GetLastError(), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
  29. messageBuffer, (DWORD) numElementsInArray (messageBuffer) - 1, nullptr);
  30. return Result::fail (String (messageBuffer));
  31. }
  32. static int64 water_fileSetPosition (void* handle, int64 pos)
  33. {
  34. LARGE_INTEGER li;
  35. li.QuadPart = pos;
  36. li.LowPart = SetFilePointer ((HANDLE) handle, (LONG) li.LowPart, &li.HighPart, FILE_BEGIN); // (returns -1 if it fails)
  37. return li.QuadPart;
  38. }
  39. static HINSTANCE currentModuleHandle = nullptr;
  40. HINSTANCE water_getCurrentModuleInstanceHandle() noexcept
  41. {
  42. if (currentModuleHandle == nullptr)
  43. currentModuleHandle = GetModuleHandleA (nullptr);
  44. return currentModuleHandle;
  45. }
  46. #else
  47. static Result getResultForErrno()
  48. {
  49. return Result::fail (String (strerror (errno)));
  50. }
  51. static int getFD (void* handle) noexcept { return (int) (pointer_sized_int) handle; }
  52. static void* fdToVoidPointer (int fd) noexcept { return (void*) (pointer_sized_int) fd; }
  53. static int64 water_fileSetPosition (void* handle, int64 pos)
  54. {
  55. if (handle != nullptr && lseek (getFD (handle), pos, SEEK_SET) == pos)
  56. return pos;
  57. return -1;
  58. }
  59. #endif
  60. }
  61. #include "containers/NamedValueSet.cpp"
  62. #include "containers/Variant.cpp"
  63. #include "files/DirectoryIterator.cpp"
  64. #include "files/File.cpp"
  65. #include "files/FileInputStream.cpp"
  66. #include "files/FileOutputStream.cpp"
  67. #include "files/TemporaryFile.cpp"
  68. #include "maths/Random.cpp"
  69. #include "memory/MemoryBlock.cpp"
  70. #include "midi/MidiBuffer.cpp"
  71. #include "midi/MidiFile.cpp"
  72. #include "midi/MidiMessage.cpp"
  73. #include "midi/MidiMessageSequence.cpp"
  74. #include "misc/Result.cpp"
  75. #include "misc/Time.cpp"
  76. #include "processors/AudioProcessor.cpp"
  77. #include "processors/AudioProcessorGraph.cpp"
  78. #include "streams/FileInputSource.cpp"
  79. #include "streams/InputStream.cpp"
  80. #include "streams/MemoryOutputStream.cpp"
  81. #include "streams/OutputStream.cpp"
  82. #include "text/CharacterFunctions.cpp"
  83. #include "text/Identifier.cpp"
  84. #include "text/StringArray.cpp"
  85. #include "text/StringPool.cpp"
  86. #include "text/String.cpp"
  87. #include "threads/ChildProcess.cpp"
  88. #include "xml/XmlDocument.cpp"
  89. #include "xml/XmlElement.cpp"