Browse Source

Actually update vst3sdk

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
0b156da722
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
100 changed files with 2944 additions and 6306 deletions
  1. +0
    -220
      source/includes/vst3sdk/CMakeLists.txt
  2. +1
    -1
      source/includes/vst3sdk/LICENSE.txt
  3. +190
    -29
      source/includes/vst3sdk/README.md
  4. +0
    -74
      source/includes/vst3sdk/base/CMakeLists.txt
  5. +1
    -1
      source/includes/vst3sdk/base/LICENSE.txt
  6. +6
    -0
      source/includes/vst3sdk/base/README.md
  7. +2
    -11
      source/includes/vst3sdk/base/source/baseiids.cpp
  8. +1
    -1
      source/includes/vst3sdk/base/source/classfactoryhelpers.h
  9. +15
    -15
      source/includes/vst3sdk/base/source/fbuffer.cpp
  10. +1
    -1
      source/includes/vst3sdk/base/source/fbuffer.h
  11. +0
    -322
      source/includes/vst3sdk/base/source/fcleanup.h
  12. +0
    -344
      source/includes/vst3sdk/base/source/fcommandline.h
  13. +152
    -108
      source/includes/vst3sdk/base/source/fdebug.cpp
  14. +154
    -120
      source/includes/vst3sdk/base/source/fdebug.h
  15. +0
    -264
      source/includes/vst3sdk/base/source/fdynlib.cpp
  16. +0
    -112
      source/includes/vst3sdk/base/source/fdynlib.h
  17. +7
    -6
      source/includes/vst3sdk/base/source/fobject.cpp
  18. +2
    -2
      source/includes/vst3sdk/base/source/fobject.h
  19. +0
    -202
      source/includes/vst3sdk/base/source/fstdmethods.h
  20. +2
    -2
      source/includes/vst3sdk/base/source/fstreamer.cpp
  21. +2
    -2
      source/includes/vst3sdk/base/source/fstreamer.h
  22. +88
    -99
      source/includes/vst3sdk/base/source/fstring.cpp
  23. +10
    -10
      source/includes/vst3sdk/base/source/fstring.h
  24. +0
    -130
      source/includes/vst3sdk/base/source/hexbinary.h
  25. +0
    -329
      source/includes/vst3sdk/base/source/timer.cpp
  26. +0
    -165
      source/includes/vst3sdk/base/source/timer.h
  27. +87
    -33
      source/includes/vst3sdk/base/source/updatehandler.cpp
  28. +14
    -6
      source/includes/vst3sdk/base/source/updatehandler.h
  29. +38
    -38
      source/includes/vst3sdk/base/thread/include/flock.h
  30. +23
    -19
      source/includes/vst3sdk/base/thread/source/flock.cpp
  31. +1
    -1
      source/includes/vst3sdk/pluginterfaces/LICENSE.txt
  32. +7
    -0
      source/includes/vst3sdk/pluginterfaces/README.md
  33. +40
    -0
      source/includes/vst3sdk/pluginterfaces/base/coreiids.cpp
  34. +3
    -7
      source/includes/vst3sdk/pluginterfaces/base/falignpop.h
  35. +9
    -5
      source/includes/vst3sdk/pluginterfaces/base/falignpush.h
  36. +107
    -25
      source/includes/vst3sdk/pluginterfaces/base/fplatform.h
  37. +8
    -8
      source/includes/vst3sdk/pluginterfaces/base/fstrdefs.h
  38. +9
    -9
      source/includes/vst3sdk/pluginterfaces/base/ftypes.h
  39. +57
    -76
      source/includes/vst3sdk/pluginterfaces/base/funknown.cpp
  40. +107
    -88
      source/includes/vst3sdk/pluginterfaces/base/funknown.h
  41. +6
    -0
      source/includes/vst3sdk/pluginterfaces/base/futils.h
  42. +94
    -3
      source/includes/vst3sdk/pluginterfaces/base/fvariant.h
  43. +0
    -96
      source/includes/vst3sdk/pluginterfaces/base/geoconstants.h
  44. +0
    -47
      source/includes/vst3sdk/pluginterfaces/base/ierrorcontext.h
  45. +41
    -3
      source/includes/vst3sdk/pluginterfaces/base/ipluginbase.h
  46. +0
    -161
      source/includes/vst3sdk/pluginterfaces/base/keycodes.h
  47. +0
    -32
      source/includes/vst3sdk/pluginterfaces/base/pluginbasefwd.h
  48. +67
    -32
      source/includes/vst3sdk/pluginterfaces/base/smartpointer.h
  49. +43
    -0
      source/includes/vst3sdk/pluginterfaces/base/typesizecheck.h
  50. +0
    -64
      source/includes/vst3sdk/pluginterfaces/base/ucolorspec.h
  51. +16
    -16
      source/includes/vst3sdk/pluginterfaces/base/ustring.cpp
  52. +91
    -43
      source/includes/vst3sdk/pluginterfaces/gui/iplugview.h
  53. +9
    -4
      source/includes/vst3sdk/pluginterfaces/gui/iplugviewcontentscalesupport.h
  54. +0
    -151
      source/includes/vst3sdk/pluginterfaces/test/itest.h
  55. +2
    -1
      source/includes/vst3sdk/pluginterfaces/vst/ivstattributes.h
  56. +9
    -2
      source/includes/vst3sdk/pluginterfaces/vst/ivstaudioprocessor.h
  57. +2
    -3
      source/includes/vst3sdk/pluginterfaces/vst/ivstautomationstate.h
  58. +0
    -1
      source/includes/vst3sdk/pluginterfaces/vst/ivstchannelcontextinfo.h
  59. +20
    -32
      source/includes/vst3sdk/pluginterfaces/vst/ivstcomponent.h
  60. +21
    -17
      source/includes/vst3sdk/pluginterfaces/vst/ivstcontextmenu.h
  61. +36
    -2
      source/includes/vst3sdk/pluginterfaces/vst/ivsteditcontroller.h
  62. +52
    -40
      source/includes/vst3sdk/pluginterfaces/vst/ivstevents.h
  63. +65
    -1
      source/includes/vst3sdk/pluginterfaces/vst/ivsthostapplication.h
  64. +1
    -1
      source/includes/vst3sdk/pluginterfaces/vst/ivstinterappaudio.h
  65. +2
    -1
      source/includes/vst3sdk/pluginterfaces/vst/ivstmessage.h
  66. +8
    -3
      source/includes/vst3sdk/pluginterfaces/vst/ivstmidicontrollers.h
  67. +57
    -0
      source/includes/vst3sdk/pluginterfaces/vst/ivstmidilearn.h
  68. +9
    -7
      source/includes/vst3sdk/pluginterfaces/vst/ivstnoteexpression.h
  69. +4
    -3
      source/includes/vst3sdk/pluginterfaces/vst/ivstparameterchanges.h
  70. +130
    -0
      source/includes/vst3sdk/pluginterfaces/vst/ivstphysicalui.h
  71. +64
    -0
      source/includes/vst3sdk/pluginterfaces/vst/ivstpluginterfacesupport.h
  72. +1
    -1
      source/includes/vst3sdk/pluginterfaces/vst/ivstplugview.h
  73. +0
    -1
      source/includes/vst3sdk/pluginterfaces/vst/ivstprefetchablesupport.h
  74. +0
    -1
      source/includes/vst3sdk/pluginterfaces/vst/ivstprocesscontext.h
  75. +0
    -1
      source/includes/vst3sdk/pluginterfaces/vst/ivstrepresentation.h
  76. +53
    -65
      source/includes/vst3sdk/pluginterfaces/vst/ivsttestplugprovider.h
  77. +5
    -1
      source/includes/vst3sdk/pluginterfaces/vst/ivstunits.h
  78. +0
    -430
      source/includes/vst3sdk/pluginterfaces/vst/vstpresetkeys.h
  79. +0
    -1
      source/includes/vst3sdk/pluginterfaces/vst/vstpshpack4.h
  80. +825
    -0
      source/includes/vst3sdk/pluginterfaces/vst/vstspeaker.h
  81. +11
    -687
      source/includes/vst3sdk/pluginterfaces/vst/vsttypes.h
  82. +0
    -85
      source/includes/vst3sdk/public.sdk/CMakeLists.txt
  83. +1
    -1
      source/includes/vst3sdk/public.sdk/LICENSE.txt
  84. +15
    -0
      source/includes/vst3sdk/public.sdk/README.md
  85. +1
    -1
      source/includes/vst3sdk/public.sdk/source/common/memorystream.cpp
  86. +1
    -1
      source/includes/vst3sdk/public.sdk/source/common/memorystream.h
  87. +4
    -22
      source/includes/vst3sdk/public.sdk/source/common/pluginview.cpp
  88. +3
    -3
      source/includes/vst3sdk/public.sdk/source/common/pluginview.h
  89. +0
    -105
      source/includes/vst3sdk/public.sdk/source/main/dllmain.cpp
  90. +0
    -80
      source/includes/vst3sdk/public.sdk/source/main/linuxmain.cpp
  91. +0
    -3
      source/includes/vst3sdk/public.sdk/source/main/macexport.exp
  92. +0
    -113
      source/includes/vst3sdk/public.sdk/source/main/macmain.cpp
  93. +0
    -278
      source/includes/vst3sdk/public.sdk/source/main/pluginfactoryvst3.cpp
  94. +0
    -175
      source/includes/vst3sdk/public.sdk/source/main/pluginfactoryvst3.h
  95. +0
    -4
      source/includes/vst3sdk/public.sdk/source/main/winexport.def
  96. +0
    -105
      source/includes/vst3sdk/public.sdk/source/vst/hosting/eventlist.cpp
  97. +21
    -9
      source/includes/vst3sdk/public.sdk/source/vst/hosting/hostclasses.cpp
  98. +10
    -5
      source/includes/vst3sdk/public.sdk/source/vst/hosting/hostclasses.h
  99. +0
    -284
      source/includes/vst3sdk/public.sdk/source/vst/hosting/module.cpp
  100. +0
    -193
      source/includes/vst3sdk/public.sdk/source/vst/hosting/module.h

+ 0
- 220
source/includes/vst3sdk/CMakeLists.txt View File

@@ -1,220 +0,0 @@

cmake_minimum_required (VERSION 3.4.3)

#-------------------------------------------------------------------------------
# Includes
#-------------------------------------------------------------------------------

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

include(Global)
include(AddVST3Library)
include(Bundle)
include(ExportedSymbols)
include(PrefixHeader)
include(PlatformIOS)

# do not build VST2 by default
option(SMTG_CREATE_VST2_VERSION "Use VST2" OFF)

#-------------------------------------------------------------------------------
# SDK Project
#-------------------------------------------------------------------------------
set(VST_SDK TRUE)
project(vstsdk)

if (LINUX)
option(SMTG_ADD_ADDRESS_SANITIZER_CONFIG "Add AddressSanitizer Config (Linux only)" OFF)
if(SMTG_ADD_ADDRESS_SANITIZER_CONFIG)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES};ASan")
add_compile_options($<$<CONFIG:ASan>:-DDEVELOPMENT=1>)
add_compile_options($<$<CONFIG:ASan>:-fsanitize=address>)
add_compile_options($<$<CONFIG:ASan>:-DVSTGUI_LIVE_EDITING=1>)
add_compile_options($<$<CONFIG:ASan>:-g>)
add_compile_options($<$<CONFIG:ASan>:-O0>)
set(ASAN_LIBRARY asan)
link_libraries($<$<CONFIG:ASan>:${ASAN_LIBRARY}>)
endif()
endif()

if(UNIX)
if(XCODE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
elseif(APPLE)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -stdlib=libc++")
link_libraries(c++)
else()
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar")
link_libraries(stdc++fs pthread dl)
endif()

elseif(WIN)
add_definitions(-D_UNICODE)
add_compile_options(/fp:fast)
add_compile_options($<$<CONFIG:Release>:/Oi>) # Enable Intrinsic Functions (Yes)
add_compile_options($<$<CONFIG:Release>:/Ot>) # Favor Size Or Speed (Favor fast code)
#add_compile_options($<$<CONFIG:Release>:/Ox>) # Optimization (/O2: Maximise Speed /0x: Full Optimization)
add_compile_options($<$<CONFIG:Release>:/GF>) # Enable String Pooling
add_compile_options($<$<CONFIG:Release>:/EHa>) # Enable C++ Exceptions
add_compile_options($<$<CONFIG:Release>:/Oy>) # Omit Frame Pointers
endif()

set(ROOT "${CMAKE_CURRENT_SOURCE_DIR}")

# here you can define where the VST3 SDK is located
set(SDK_ROOT "${ROOT}")

# here you can define where the VSTGUI is located
set(VSTGUI_ROOT "${ROOT}")

include_directories(${ROOT} ${SDK_ROOT})

set(SDK_IDE_LIBS_FOLDER FOLDER "Libraries")
set(SDK_IDE_PLUGIN_EXAMPLES_FOLDER FOLDER "PlugInExamples")
set(SDK_IDE_HOSTING_EXAMPLES_FOLDER FOLDER "HostingExamples")

#-------------------------------------------------------------------------------
if(MAC AND XCODE)
if(NOT SMTG_COREAUDIO_SDK_PATH)
# Check if the CoreAudio SDK is next to the VST3SDK:
if(EXISTS "${SDK_ROOT}/../CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp")
set(SMTG_COREAUDIO_SDK_PATH "${SDK_ROOT}/../CoreAudio")
else()
if(EXISTS "${SDK_ROOT}/external.apple.coreaudio/AudioUnits/AUPublic/AUBase/AUBase.cpp")
set(SMTG_COREAUDIO_SDK_PATH "${SDK_ROOT}/external.apple.coreaudio")
endif()
endif()
else()
if(NOT IS_ABSOLUTE ${SMTG_COREAUDIO_SDK_PATH})
get_filename_component(SMTG_COREAUDIO_SDK_PATH "${SDK_ROOT}/${SMTG_COREAUDIO_SDK_PATH}" ABSOLUTE)
endif()
if(NOT EXISTS "${SMTG_COREAUDIO_SDK_PATH}/AudioUnits/AUPublic/AUBase/AUBase.cpp")
message(FATAL_ERROR "SMTG_COREAUDIO_SDK_PATH is set but does not point to an expected location")
endif()
endif()
if(SMTG_COREAUDIO_SDK_PATH)
message(STATUS "SMTG_COREAUDIO_SDK_PATH is set to : " ${SMTG_COREAUDIO_SDK_PATH})
endif()
endif()

#-------------------------------------------------------------------------------
# Projects
#-------------------------------------------------------------------------------

add_subdirectory(base)
add_subdirectory(public.sdk)
add_subdirectory(public.sdk/source/vst/auwrapper)
add_subdirectory(public.sdk/source/vst/auwrapper/again)
add_subdirectory(public.sdk/source/vst/interappaudio)
add_subdirectory(public.sdk/samples/vst/again)
add_subdirectory(public.sdk/samples/vst/adelay)
add_subdirectory(public.sdk/samples/vst/channelcontext)
add_subdirectory(public.sdk/samples/vst/hostchecker)
add_subdirectory(public.sdk/samples/vst/editorhost)
add_subdirectory(public.sdk/samples/vst/mda-vst3)
add_subdirectory(public.sdk/samples/vst/note_expression_synth)
add_subdirectory(public.sdk/samples/vst/note_expression_text)
add_subdirectory(public.sdk/samples/vst/pitchnames)
add_subdirectory(public.sdk/samples/vst/prefetchablesupport)
add_subdirectory(public.sdk/samples/vst/programchange)
add_subdirectory(public.sdk/samples/vst/validator)
add_subdirectory(public.sdk/samples/vst/InterAppAudio)

set(VSTGUI_DISABLE_UNITTESTS 1)
add_subdirectory(vstgui4/vstgui)

#-------------------------------------------------------------------------------
# VSTGUI Support Library
#-------------------------------------------------------------------------------
add_compile_options($<$<CONFIG:Debug>:-DVSTGUI_LIVE_EDITING=1>)
set(VST3_VSTGUI_SOURCES
${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3groupcontroller.cpp
${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3groupcontroller.h
${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3padcontroller.cpp
${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3padcontroller.h
${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3editor.cpp
${VSTGUI_ROOT}/vstgui4/vstgui/plugin-bindings/vst3editor.h
${SDK_ROOT}/public.sdk/source/vst/vstguieditor.cpp
)
add_library(vstgui_support STATIC ${VST3_VSTGUI_SOURCES})
target_include_directories(vstgui_support PUBLIC ${VSTGUI_ROOT}/vstgui4)
target_link_libraries(vstgui_support PRIVATE vstgui_uidescription)
if(MAC)
if(XCODE)
target_link_libraries(vstgui_support PRIVATE "-framework Cocoa" "-framework OpenGL" "-framework Accelerate" "-framework QuartzCore" "-framework Carbon")
else()
find_library(COREFOUNDATION_FRAMEWORK CoreFoundation)
find_library(COCOA_FRAMEWORK Cocoa)
find_library(OPENGL_FRAMEWORK OpenGL)
find_library(ACCELERATE_FRAMEWORK Accelerate)
find_library(QUARTZCORE_FRAMEWORK QuartzCore)
find_library(CARBON_FRAMEWORK Carbon)
target_link_libraries(vstgui_support PRIVATE ${COREFOUNDATION_FRAMEWORK} ${COCOA_FRAMEWORK} ${OPENGL_FRAMEWORK} ${ACCELERATE_FRAMEWORK} ${QUARTZCORE_FRAMEWORK} ${CARBON_FRAMEWORK})
endif()
endif()

#-------------------------------------------------------------------------------
# IDE sorting
#-------------------------------------------------------------------------------
set_target_properties(vstgui_support PROPERTIES ${SDK_IDE_LIBS_FOLDER})
set_target_properties(sdk PROPERTIES ${SDK_IDE_LIBS_FOLDER})
set_target_properties(base PROPERTIES ${SDK_IDE_LIBS_FOLDER})
set_target_properties(vstgui PROPERTIES ${SDK_IDE_LIBS_FOLDER})
set_target_properties(vstgui_uidescription PROPERTIES ${SDK_IDE_LIBS_FOLDER})

if (TARGET again)
set_target_properties(again PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if (TARGET againsimple)
set_target_properties(againsimple PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if (TARGET adelay)
set_target_properties(adelay PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if (TARGET channelcontext)
set_target_properties(channelcontext PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if (TARGET hostchecker)
set_target_properties(hostchecker PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if (TARGET mda-vst3)
set_target_properties(mda-vst3 PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if (TARGET noteexpressionsynth)
set_target_properties(noteexpressionsynth PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if (TARGET noteexpressiontext)
set_target_properties(noteexpressiontext PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if (TARGET pitchnames)
set_target_properties(pitchnames PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if (TARGET prefetchablesupport)
set_target_properties(prefetchablesupport PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if (TARGET programchange)
set_target_properties(programchange PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()

if (TARGET editorhost)
set_target_properties(editorhost PROPERTIES ${SDK_IDE_HOSTING_EXAMPLES_FOLDER})
endif()
if (TARGET validator)
set_target_properties(validator PROPERTIES ${SDK_IDE_HOSTING_EXAMPLES_FOLDER})
endif ()

if(MAC AND XCODE)
if(SMTG_COREAUDIO_SDK_PATH)
set_target_properties(auwrapper PROPERTIES ${SDK_IDE_LIBS_FOLDER})
set_target_properties(again_au PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
if(IOS_DEVELOPMENT_TEAM)
set_target_properties(sdk_ios PROPERTIES ${SDK_IDE_LIBS_FOLDER})
set_target_properties(base_ios PROPERTIES ${SDK_IDE_LIBS_FOLDER})
set_target_properties(interappaudio PROPERTIES ${SDK_IDE_LIBS_FOLDER})
set_target_properties(noteexpressionsynth_ios PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
endif()
endif()

+ 1
- 1
source/includes/vst3sdk/LICENSE.txt View File

@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
This license applies only to files referencing this license,
for other files of the Software Development Kit the respective embedded license text


+ 190
- 29
source/includes/vst3sdk/README.md View File

@@ -1,83 +1,123 @@
# Welcome to VST SDK 3.6.7
## The VST SDK package contains:
# Welcome to VST SDK 3.6.x
## Table Of Contents
1. [The VST SDK package](#100)
1. [System requirements](#200)
1. [About VST Plug-ins in general](#300)
1. [About VST 3](#400)
1. [How to build VST 3](#500)
1. [Contributing](#600)
1. [License & Usage guidelines](#700)
<div id='100'/>
## The VST SDK package contains
- The VST 3 API
- VST 3 Implementation Helper Classes
- AU and VST2 wrappers
- AAX, AU and VST 2 wrappers
- VST 3 Plug-ins Examples
The full VST 3 SDK is available [here!](https://www.steinberg.net/en/company/developers.html). It contains a VST 3 Plug-in Test Host Application/Validator.
The full VST 3 SDK is available [here!](https://www.steinberg.net/en/company/developers.html). It contains :
- a VST 3 Plug-in Test Host Application/Validator,
- the **Steinberg VST 3 Plug-In SDK Licensing Agreement** that you have to sign if you want to develop or host VST 3 Plug-Ins.
<div id='200'/>
## System requirements
Supported OS:
- Microsoft Windows 7-10
- Apple OSX 10.7-10.12
- Apple OSX 10.9-10.13
- Apple iOS 8-9
- Linux (Preview)
- Linux (Beta version)
Supported IDE:
- Visual Studio 2013/2015
- Xcode 6/7
- Visual Studio 2015/2017/2019
- minimum Xcode 7
- Qt Creator
---
<div id='300'/>
## About VST Plug-ins in general
A VST Plug-in is an audio processing component that is utilized within a host application. This host application provides the audio or/and event streams that are processed by the Plug-in's code. Generally speaking, a VST Plug-in can take a stream of audio data, apply a process to the audio, and return the result to the host application. A VST Plug-in performs its process normally using the processor of the computer. The audio stream is broken down into a series of blocks. The host supplies the blocks in sequence. The host and its current environment control the block-size. The VST Plug-in maintains the status of all its own parameters relating to the running process: The host does not maintain any information about what the Plug-in did with the last block of data it processed.
From the host application's point of view, a VST Plug-in is a black box with an arbitrary number of inputs, outputs (Event (MIDI) or Audio), and associated parameters. The host needs no implicit knowledge of the Plug-in's process to be able to use it. The Plug-in process can use whatever parameters it wishes, internally to the process, but depending on the capabilities of the host, it can allow the changes to user parameters to be automated by the host.
The source code of a VST Plug-in is platform independent, but the delivery system depends on the platform architecture:
- On **Windows**, a VST Plug-in is a multi-threaded DLL (Dynamic Link Library).
- On **Windows**, a VST Plug-in is a multi-threaded DLL (Dynamic Link Library), recently packaged into a folder structur.
- On **Mac OS X**, a VST Plug-in is a Mach-O Bundle
- On **Linux**, a VST Plug-in is a package
To learn more about VST you can subscribe to the [VST Developer Forum](https://sdk.steinberg.net) - check the 3rd Party Developer Support section at [www.steinberg.net](www.steinberg.net).
To learn more about VST you can subscribe to the [VST Developer Forum](https://sdk.steinberg.net) - check the 3rd Party Developer Support section at [www.steinberg.net](http://www.steinberg.net).
---
<div id='400'/>
## About VST 3
VST 3 is a general rework of the long-serving VST Plug-in interface. It is not compatible with the older VST versions, but it includes some new features and possibilities. We have redesigned the API to make it not only far easier and more reliable for developers to work with, but have also provided completely new possibilities for Plug-ins. These include:
### 1. Improved Performance with the Silence Flag
### 1. Improved Performance with the Silence Flag
Processing can optionally be applied to Plug-ins only when audio signals are present on their respective inputs, so VST 3 Plug-ins can apply their processing economically and only when it is needed.
### 2. Multiple Dynamic I/Os
VST 3 Plug-ins are no longer limited to a fixed number of inputs and outputs, and their I/O configuration can dynamically adapt to the channel configuration. Side-chains are also very easily realizable. This includes the possibility to deactivate unused buses after loading and even reactivate those when needed. This cleans up the mixer and further helps to reduce CPU load.
### 2. Multiple Dynamic I/Os
VST 3 Plug-ins are no longer limited to a fixed number of inputs and outputs, and their I/O configuration can dynamically adapt to the channel configuration. Side-chains are also very easily realizable. This includes the possibility to deactivate unused buses after loading and even reactivate those when needed. This cleans up the mixer and further helps to reduce CPU load.
### 3. Sample-accurate Automation
VST 3 also features vastly improved parameter automation with sample accuracy and support for ramped automation data, allowing completely accurate and rapid parameter automation changes.
### 3. Sample-accurate Automation
VST 3 also features vastly improved parameter automation with sample accuracy and support for ramped automation data, allowing completely accurate and rapid parameter automation changes.
### 4. Logical Parameter Organization
### 4. Logical Parameter Organization
The VST 3 Plug-in parameters are displayed in a tree structure. Parameters are grouped into sections which represent the structure of the Plug-in. Plug-ins can communicate their internal structure for the purpose of overview, but also for some associated functionality (eg. program-lists).
The VST 3 Plug-in parameters are displayed in a tree structure. Parameters are grouped into sections which represent the structure of the Plug-in. Plug-ins can communicate their internal structure for the purpose of overview, but also for some associated functionality (eg. program-lists).
### 5. Resizeable UI Editor
VST 3 defines a way to allow resizing of the Plug-in editor by a user.
### 5. Resizeable UI Editor
### 6. Mouse Over Support
The Host could ask the Plug-in which parameter is under the mouse.
VST 3 defines a way to allow resizing of the Plug-in editor by a user.
### 6. Mouse Over Support
The Host could ask the Plug-in which parameter is under the mouse.
### 7. Context Menu Support
VST 3 defines a way to allow the host to add its own entries in the Plug-in context menu of a specific parameter.
### 8. Channel Context Information
A VST 3 Plug-in could access some channel information where it is instantiated: name, color,...
### 9. Note Expression
VST 3 defines with Note Expression a new way of event controller editing. The Plug-in is able to break free from the limitations of MIDI controller events by providing access to new VST 3 controller events that circumvent the laws of MIDI and provide articulation information for each individual note (event) in a polyphonic arrangement according to its noteId.
### 9. Note Expression
VST 3 defines with Note Expression a new way of event controller editing. The Plug-in is able to break free from the limitations of MIDI controller events by providing access to new VST 3 controller events that circumvent the laws of MIDI and provide articulation information for each individual note (event) in a polyphonic arrangement according to its noteId.
### 10. 3D Support
VST 3 supports new speaker configurations like Atmos, Auro 3D or 22.2.
### 11. Factory Concept
VST 3 supports new speaker configurations like Ambisonic, Atmos, Auro 3D or 22.2.
### 11. Factory Concept
VST 3 Plug-in library could export multiple Plug-ins and in this way replaces the shell concept of VST 2 (kPlugCategShell).
### 12. Support Remote control Representation
VST 3 Plug-in can deliver a specific parameter mapping for remote controls like Nuage.
### 13. Others
While designing VST 3, we performed a careful analysis of the existing functionality of VST and rewrote the interfaces from scratch. In doing so, we focused a lot on providing clear interfaces and their documentation in order to avoid usage errors from the deepest possible layer.
Some more features implemented specifically for developers include:
- More stable technical Host/Plug-in environment
- Advanced technical definition of the standard
- Modular approach
@@ -86,7 +126,128 @@ Some more features implemented specifically for developers include:
- Multiple Plug-ins per Library
- Test Host included
- Automated Testing Environment
- Validator (small command line Test Host) and Plug-in examples code included.
- Validator (small command line Test Host) and Plug-in examples code included
---
<div id='500'/>
## How to build VST3
### Get the source code from GitHub
<pre>git clone --recursive https://github.com/steinbergmedia/vst3sdk.git
</pre>
### Adding VST2 version
The VST2 SDK is not part anymore of the VST3 SDK, you have to use an older version of the SDK and copy the VST2_SDK folder into the VST_SDK folder.
In order to build a VST2 version of the Plug-in and a VST3 at the same time, you need to copy the VST2 folder into the VST3 folder, simply run the following commands:
- for macOS:
<pre>
cd TheFolderWhereYouDownloadTheSDK
./copy_vst2_to_vst3_sdk.sh
</pre>
- for Windows:
<pre>
cd TheFolderWhereYouDownloadTheSDK
copy_vst2_to_vst3_sdk.bat
</pre>
### Build the examples on Linux
- Create a folder for the build and move to this folder (using cd):
<pre>
mkdir build
cd build
</pre>
- Generate the Solution/Projects: provide the path of the Project where CMakeLists.txt is located:
<pre>
cmake ../vst3sdk
</pre>
- Now you can build the Plug-in:
<pre>
make
(or alternatively for example for release)
cmake --build . --config Release
</pre>
### Build the examples on macOS
- Create a folder for the build and move to this folder (using cd):
<pre>
mkdir build
cd build
</pre>
- Generate the Solution/Projects: provide the path of the Project where CMakeLists.txt is located:
<pre>
For XCode:
cmake -GXcode ../vst3sdk
Without XCode (here debug variant):
cmake -DCMAKE_BUILD_TYPE=Debug ../
</pre>
- Now you can build the Plug-in (you can use XCode too):
<pre>
xcodebuild
(or alternatively for example for release)
cmake --build . --config Release
</pre>
### Build the examples on Windows
- Create a folder for the build and move to this folder (using cd):
<pre>
mkdir build
cd build
</pre>
- Generate the Solution/Projects: provide the path of the Project where CMakeLists.txt is located:
<pre>
cmake.exe -G"Visual Studio 15 2017 Win64" ../vst3sdk
</pre>
- Now you can build the Plug-in (you can use Visual Studio too):
<pre>
msbuild.exe vstsdk.sln
(or alternatively for example for release)
cmake --build . --config Release
</pre>
### Build using cmake-gui
- start the cmake-gui Application
- "Browse Source...": select the folder VST3_SDK
- "Browse Build...": select a folder where the outputs (projects/...) will be created. Typically a folder named "build"
- you can check the SMTG Options
- Press "Configure"
- Press "Generate" and the project will be created
---
<div id='600'/>
## Contributing
For bug reports and features requests, please visit the [VST Developer Forum](https://sdk.steinberg.net)
---
## License
More details are found at [www.steinberg.net/sdklicenses_vst3](www.steinberg.net/sdklicenses_vst3)
<div id='700'/>
## License & Usage guidelines
More details are found at [www.steinberg.net/sdklicenses_vst3](http://www.steinberg.net/sdklicenses_vst3)

+ 0
- 74
source/includes/vst3sdk/base/CMakeLists.txt View File

@@ -1,74 +0,0 @@

set(base_sources
source/baseiids.cpp
source/classfactoryhelpers.h
source/fbuffer.cpp
source/fbuffer.h
source/fcleanup.h
source/fcommandline.h
source/fdebug.cpp
source/fdebug.h
source/fdynlib.cpp
source/fdynlib.h
source/fobject.cpp
source/fobject.h
source/flock.cpp
source/flock.h
source/fstreamer.cpp
source/fstreamer.h
source/fstring.cpp
source/fstring.h
source/timer.cpp
source/timer.h
source/updatehandler.cpp
source/updatehandler.h
)

set(base_sources_ext
source/basefwd.h
source/classfactory.cpp
source/classfactory.h
source/fatomic.cpp
source/fatomic.h
source/fbitset.cpp
source/fbitset.h
source/fcontainer.h
source/fcpu.cpp
source/fcpu.h
source/fcriticalperformance.cpp
source/fcriticalperformance.h
source/finitializer.cpp
source/finitializer.h
source/fmemory.cpp
source/fmemory.h
source/fpoint.cpp
source/fpoint.h
source/frect.cpp
source/frect.h
source/fregion.cpp
source/fregion.h
source/frwlock_generic.h
source/frwlock_macosx.h
source/frwlock_windows.h
source/fstdmethods.h
source/fstringmethods.h
source/fstringstream.h
source/fthread.cpp
source/fthread.h
source/funknownfactory.h
source/hexbinary.h
source/istreamwrapper.cpp
source/istreamwrapper.h
source/tringbuffer.h
)
if (VST_SDK)
add_library(base STATIC ${base_sources})
else()
add_library(base STATIC ${base_sources} ${base_sources_ext})
endif()

# iOS target
if(MAC AND XCODE AND IOS_DEVELOPMENT_TEAM)
add_library(base_ios STATIC ${base_sources})
smtg_set_platform_ios(base_ios)
endif()

+ 1
- 1
source/includes/vst3sdk/base/LICENSE.txt View File

@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:


+ 6
- 0
source/includes/vst3sdk/base/README.md View File

@@ -0,0 +1,6 @@
# Welcome to VST SDK 3 base
Here you can find some helper classes useful for developing VST3 Plug-Ins.
## License & Usage guidelines
More details are found at [www.steinberg.net/sdklicenses_vst3](http://www.steinberg.net/sdklicenses_vst3)

+ 2
- 11
source/includes/vst3sdk/base/source/baseiids.cpp View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -37,25 +37,16 @@

#include "pluginterfaces/base/funknown.h"
#include "pluginterfaces/base/istringresult.h"
#include "pluginterfaces/base/iupdatehandler.h"
#include "pluginterfaces/base/ipersistent.h"
#include "pluginterfaces/base/icloneable.h"
#include "pluginterfaces/base/ibstream.h"


namespace Steinberg {

DEF_CLASS_IID (FUnknown)
DEF_CLASS_IID (IString)
DEF_CLASS_IID (IStringResult)

DEF_CLASS_IID (IDependent)
DEF_CLASS_IID (IUpdateHandler)
DEF_CLASS_IID (IPersistent)
DEF_CLASS_IID (IAttributes)
DEF_CLASS_IID (IAttributes2)

DEF_CLASS_IID (ICloneable)

DEF_CLASS_IID (ISizeableStream)
//------------------------------------------------------------------------
} // namespace Steinberg

+ 1
- 1
source/includes/vst3sdk/base/source/classfactoryhelpers.h View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:


+ 15
- 15
source/includes/vst3sdk/base/source/fbuffer.cpp View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -43,7 +43,7 @@ namespace Steinberg {

//-------------------------------------------------------------------------------------
Buffer::Buffer ()
: buffer (0)
: buffer (nullptr)
, memSize (0)
, fillSize (0)
, delta (defaultDelta)
@@ -51,7 +51,7 @@ Buffer::Buffer ()

//-------------------------------------------------------------------------------------
Buffer::Buffer (uint32 s, uint8 initVal)
: buffer (0)
: buffer (nullptr)
, memSize (s)
, fillSize (0)
, delta (defaultDelta)
@@ -67,7 +67,7 @@ Buffer::Buffer (uint32 s, uint8 initVal)

//-------------------------------------------------------------------------------------
Buffer::Buffer (uint32 s)
: buffer (0)
: buffer (nullptr)
, memSize (s)
, fillSize (0)
, delta (defaultDelta)
@@ -81,7 +81,7 @@ Buffer::Buffer (uint32 s)

//-------------------------------------------------------------------------------------
Buffer::Buffer (const void* b , uint32 s)
: buffer (0)
: buffer (nullptr)
, memSize (s)
, fillSize (s)
, delta (defaultDelta)
@@ -100,7 +100,7 @@ Buffer::Buffer (const void* b , uint32 s)

//-------------------------------------------------------------------------------------
Buffer::Buffer (const Buffer& bufferR)
: buffer (0)
: buffer (nullptr)
, memSize (bufferR.memSize)
, fillSize (bufferR.fillSize)
, delta (bufferR.delta)
@@ -120,7 +120,7 @@ Buffer::~Buffer ()
{
if (buffer)
::free (buffer);
buffer = 0;
buffer = nullptr;
}

//-------------------------------------------------------------------------------------
@@ -302,7 +302,7 @@ bool Buffer::makeHexString (String& result)
unsigned char* data = uint8Ptr ();
uint32 bytes = getSize ();

if (data == 0 || bytes == 0)
if (data == nullptr || bytes == 0)
return false;

char8* stringBuffer = (char8*)malloc ((bytes * 2) + 1);
@@ -338,7 +338,7 @@ bool Buffer::makeHexString (String& result)
bool Buffer::fromHexString (const char8* string)
{
flush ();
if (string == 0)
if (string == nullptr)
return false;

int32 len = strlen8 (string);
@@ -477,7 +477,7 @@ bool Buffer::setSize (uint32 newSize)
if (newSize > 0)
{
int8* newBuffer = (int8*) ::realloc (buffer, newSize);
if (newBuffer == 0)
if (newBuffer == nullptr)
{
newBuffer = (int8*)::malloc (newSize);
if (newBuffer)
@@ -492,7 +492,7 @@ bool Buffer::setSize (uint32 newSize)
else
{
::free (buffer);
buffer = 0;
buffer = nullptr;
}
}
else
@@ -501,7 +501,7 @@ bool Buffer::setSize (uint32 newSize)
else
{
::free (buffer);
buffer = 0;
buffer = nullptr;
}
}
else
@@ -515,7 +515,7 @@ bool Buffer::setSize (uint32 newSize)
fillSize = memSize;
}

return (newSize > 0) == (buffer != 0);
return (newSize > 0) == (buffer != nullptr);
}

//-------------------------------------------------------------------------------------
@@ -582,7 +582,7 @@ void Buffer::take (Buffer& from)
memSize = from.memSize;
fillSize = from.fillSize;
buffer = from.buffer;
from.buffer = 0;
from.buffer = nullptr;
from.memSize = 0;
from.fillSize = 0;
}
@@ -591,7 +591,7 @@ void Buffer::take (Buffer& from)
int8* Buffer::pass ()
{
int8* res = buffer;
buffer = 0;
buffer = nullptr;
memSize = 0;
fillSize = 0;
return res;


+ 1
- 1
source/includes/vst3sdk/base/source/fbuffer.h View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:


+ 0
- 322
source/includes/vst3sdk/base/source/fcleanup.h View File

@@ -1,322 +0,0 @@
//------------------------------------------------------------------------
// Project : SDK Base
// Version : 1.0
//
// Category : Helpers
// Filename : base/source/fcleanup.h
// Created by : Steinberg, 2008
// Description : Template classes for automatic resource cleanup
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#pragma once

#include <stdlib.h>

namespace Steinberg {

/** Template definition for classes that help guarding against memory leaks.
A stack allocated object of this type automatically deletes an at construction time passed
dynamically allocated single object when it reaches the end of its scope. \n\n
Intended usage:
\code
{
int* pointerToInt = new int;
Steinberg::FDeleter<int> deleter (pointerToInt);

// Do something with the variable behind pointerToInt.

} // No memory leak here, destructor of deleter cleans up the integer.
\endcode
*/
//------------------------------------------------------------------------
template <class T>
struct FDeleter
{
/// Constructor. _toDelete is a pointer to the dynamically allocated object that is to be
/// deleted when this FDeleter object's destructor is executed.
FDeleter (T* _toDelete) : toDelete (_toDelete) {}
/// Destructor. Calls delete on the at construction time passed pointer.
~FDeleter ()
{
if (toDelete)
delete toDelete;
}
T* toDelete; ///< Remembers the object that is to be deleted during destruction.
};

/** Template definition for classes that help guarding against memory leaks.
A stack allocated object of this type automatically deletes an at construction time passed
dynamically allocated array of objects when it reaches the end of its scope. \n\n
Intended usage:
\code
{
int* pointerToIntArray = new int[10];
Steinberg::FArrayDeleter<int> deleter (pointerToIntArray);

// Do something with the array behind pointerToIntArray.

} // No memory leak here, destructor of deleter cleans up the integer array.
\endcode
*/
//------------------------------------------------------------------------
template <class T>
struct FArrayDeleter
{
/// Constructor. _arrayToDelete is a pointer to the dynamically allocated array of objects that
/// is to be deleted when this FArrayDeleter object's destructor is executed.
FArrayDeleter (T* _arrayToDelete) : arrayToDelete (_arrayToDelete) {}

/// Destructor. Calls delete[] on the at construction time passed pointer.
~FArrayDeleter ()
{
if (arrayToDelete)
delete[] arrayToDelete;
}

T* arrayToDelete; ///< Remembers the array of objects that is to be deleted during destruction.
};

/** Template definition for classes that help guarding against dangling pointers.
A stack allocated object of this type automatically resets an at construction time passed
pointer to null when it reaches the end of its scope. \n\n
Intended usage:
\code
int* pointerToInt = 0;
{
int i = 1;
pointerToInt = &i;
Steinberg::FPtrNuller<int> ptrNuller (pointerToInt);

// Do something with pointerToInt.

} // No dangling pointer here, pointerToInt is reset to 0 by destructor of ptrNuller.
\endcode
*/
//------------------------------------------------------------------------
template <class T>
struct FPtrNuller
{
/// Constructor. _toNull is a reference to the pointer that is to be reset to NULL when this
/// FPtrNuller object's destructor is executed.
FPtrNuller (T*& _toNull) : toNull (_toNull) {}
/// Destructor. Calls delete[] on the at construction time passed pointer.
~FPtrNuller () { toNull = 0; }

T*& toNull; ///< Remembers the pointer that is to be set to NULL during destruction.
};

/** Template definition for classes that help resetting an object's value.
A stack allocated object of this type automatically resets the value of an at construction time
passed object to null when it reaches the end of its scope. \n\n Intended usage: \code int theObject
= 0;
{
Steinberg::FNuller<int> theNuller (theObject);

theObject = 1;

} // Here the destructor of theNuller resets the value of theObject to 0.
\endcode
*/
//------------------------------------------------------------------------
template <class T>
struct FNuller
{
/// Constructor. _toNull is a reference to the object that is to be assigned 0 when this FNuller
/// object's destructor is executed.
FNuller (T& _toNull) : toNull (_toNull) {}
/// Destructor. Assigns 0 to the at construction time passed object reference.
~FNuller () { toNull = 0; }

T& toNull; ///< Remembers the object that is to be assigned 0 during destruction.
};

/** Class definition for objects that help resetting boolean variables.
A stack allocated object of this type automatically sets an at construction time passed
boolean variable immediately to TRUE and resets the same variable to FALSE when it
reaches the end of its own scope. \n\n
Intended usage:
\code
bool theBoolean = false;
{
Steinberg::FBoolSetter theBoolSetter (theBoolean);
// Here the constructor of theBoolSetter sets theBoolean to TRUE.

// Do something.

} // Here the destructor of theBoolSetter resets theBoolean to FALSE.
\endcode
*/
//------------------------------------------------------------------------
template <class T>
struct FBooleanSetter
{
/// Constructor. _toSet is a reference to the boolean that is set to TRUE immediately in this
/// constructor call and gets reset to FALSE when this FBoolSetter object's destructor is
/// executed.
FBooleanSetter (T& _toSet) : toSet (_toSet) { toSet = true; }
/// Destructor. Resets the at construction time passed boolean to FALSE.
~FBooleanSetter () { toSet = false; }

T& toSet; ///< Remembers the boolean that is to be reset during destruction.
};

typedef FBooleanSetter<bool> FBoolSetter;

/** Class definition for objects that help setting boolean variables.
A stack allocated object of this type automatically sets an at construction time passed
boolean variable to TRUE if the given condition is met. At the end of its own scope the
stack object will reset the same boolean variable to FALSE, if it wasn't set so already. \n\n
Intended usage:
\code
bool theBoolean = false;
{
bool creativityFirst = true;
Steinberg::FConditionalBoolSetter theCBSetter (theBoolean, creativityFirst);
// Here the constructor of theCBSetter sets theBoolean to the value of creativityFirst.

// Do something.

} // Here the destructor of theCBSetter resets theBoolean to FALSE.
\endcode
*/
//------------------------------------------------------------------------
struct FConditionalBoolSetter
{
/// Constructor. _toSet is a reference to the boolean that is to be set. If the in the second
/// parameter given condition is TRUE then also _toSet is set to TRUE immediately.
FConditionalBoolSetter (bool& _toSet, bool condition) : toSet (_toSet)
{
if (condition)
toSet = true;
}
/// Destructor. Resets the at construction time passed boolean to FALSE.
~FConditionalBoolSetter () { toSet = false; }

bool& toSet; ///< Remembers the boolean that is to be reset during destruction.
};

/** Template definition for classes that help closing resources.
A stack allocated object of this type automatically calls the close method of an at
construction time passed object when it reaches the end of its scope.
It goes without saying that the given type needs to have a close method. \n\n
Intended usage:
\code
struct CloseableObject
{
void close() {};
};

{
CloseableObject theObject;
Steinberg::FCloser<CloseableObject> theCloser (&theObject);

// Do something.

} // Here the destructor of theCloser calls the close method of theObject.
\endcode
*/
template <class T>
struct FCloser
{
/// Constructor. _obj is the pointer on which close is to be called when this FCloser object's
/// destructor is executed.
FCloser (T* _obj) : obj (_obj) {}
/// Destructor. Calls the close function on the at construction time passed pointer.
~FCloser ()
{
if (obj)
obj->close ();
}

T* obj; ///< Remembers the pointer on which close is to be called during destruction.
};

/** Class definition for objects that help guarding against memory leaks.
A stack allocated object of this type automatically frees the "malloced" memory behind an at
construction time passed pointer when it reaches the end of its scope.
*/
//------------------------------------------------------------------------
/*! \class FMallocReleaser
*/
//------------------------------------------------------------------------
class FMallocReleaser
{
public:
/// Constructor. _data is the pointer to the memory on which free is to be called when this
/// FMallocReleaser object's destructor is executed.
FMallocReleaser (void* _data) : data (_data) {}
/// Destructor. Calls the free function on the at construction time passed pointer.
~FMallocReleaser ()
{
if (data)
free (data);
}
//------------------------------------------------------------------------
protected:
void* data; ///< Remembers the pointer on which free is to be called during destruction.
};

//------------------------------------------------------------------------
} // namespace Steinberg


#if MAC
typedef const void* CFTypeRef;
extern "C" {
extern void CFRelease (CFTypeRef cf);
}

namespace Steinberg {

/** Class definition for objects that helps releasing CoreFoundation objects.
A stack allocated object of this type automatically releases an at construction time
passed CoreFoundation object when it reaches the end of its scope.

Only available on Macintosh platform.
*/
//------------------------------------------------------------------------
/*! \class CFReleaser
*/
//------------------------------------------------------------------------
class CFReleaser
{
public:
/// Constructor. _obj is the reference to an CoreFoundation object which is to be released when this CFReleaser object's destructor is executed.
CFReleaser (CFTypeRef _obj) : obj (_obj) {}
/// Destructor. Releases the at construction time passed object.
~CFReleaser () { if (obj) CFRelease (obj); }
protected:
CFTypeRef obj; ///< Remembers the object which is to be released during destruction.
};

//------------------------------------------------------------------------
} // namespace Steinberg

#endif // MAC

+ 0
- 344
source/includes/vst3sdk/base/source/fcommandline.h View File

@@ -1,344 +0,0 @@
//------------------------------------------------------------------------
// Project : SDK Base
// Version : 1.0
//
// Category : Helpers
// Filename : base/source/fcommandline.h
// Created by : Steinberg, 2007
// Description : Very simple command-line parser.
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

//------------------------------------------------------------------------
/** @file base/source/fcommandline.h
Very simple command-line parser.
@see Steinberg::CommandLine */
//------------------------------------------------------------------------
#pragma once

#include <deque>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>

namespace Steinberg {
//------------------------------------------------------------------------
/** Very simple command-line parser.

Parses the command-line into a CommandLine::VariablesMap.\n
The command-line parser uses CommandLine::Descriptions to define the available options.

@b Example:
\code
#include "base/source/fcommandline.h"
#include <iostream>

int main (int argc, char* argv[])
{
using namespace std;
using namespace Steinberg;

CommandLine::Descriptions desc;
CommandLine::VariablesMap valueMap;

desc.addOptions ("myTool")
("help", "produce help message")
("opt1", string(), "option 1")
("opt2", string(), "option 2")
;
CommandLine::parse (argc, argv, desc, valueMap);

if (valueMap.hasError () || valueMap.count ("help"))
{
cout << desc << "\n";
return 1;
}
if (valueMap.count ("opt1"))
{
cout << "Value of option 1 " << valueMap["opt1"] << "\n";
}
if (valueMap.count ("opt2"))
{
cout << "Value of option 2 " << valueMap["opt2"] << "\n";
}
return 0;
}
\endcode
@note
This is a "header only" implementation.\n
If you need the declarations in more than one cpp file, you have to define
@c SMTG_NO_IMPLEMENTATION in all but one file.

*/
//------------------------------------------------------------------------
namespace CommandLine {
//------------------------------------------------------------------------
/** Command-line parsing result.
This is the result of the parser.\n
- Use hasError() to check for errors.\n
- To test if a option was specified on the command-line use: count()\n
- To retrieve the value of an options, use operator [](const VariablesMapContainer::key_type k)\n
*/
//------------------------------------------------------------------------
class VariablesMap
{
bool mParaError;
typedef std::map<std::string, std::string> VariablesMapContainer;
VariablesMapContainer mVariablesMapContainer;
public:
VariablesMap () : mParaError (false) {} ///< Constructor. Creates a empty VariablesMap.
bool hasError () const { return mParaError; } ///< Returns @c true when an error has occurred.
void setError () { mParaError = true; } ///< Sets the error state to @c true.
std::string& operator [](const VariablesMapContainer::key_type k); ///< Retrieve the value of option @c k.
const std::string& operator [](const VariablesMapContainer::key_type k) const; ///< Retrieve the value of option @c k.
VariablesMapContainer::size_type count (const VariablesMapContainer::key_type k) const; ///< Returns @c != @c 0 if command-line contains option @c k.
};

//! type of the list of elements on the command line that are not handled by options parsing
typedef std::vector<std::string> FilesVector;

//------------------------------------------------------------------------
/** The description of one single command-line option.
Normally you rarely use a Description directly.\n
In most cases you will use the Descriptions::addOptions (const std::string&) method to create and add descriptions.
*/
//------------------------------------------------------------------------
class Description : public std::string
{
public:
Description (const std::string& name, const std::string& help, const std::string& valueType ); ///< Construct a Description
std::string mHelp; ///< The help string for this option.
std::string mType; ///< The type of this option (kBool, kString).
static const std::string kBool;
static const std::string kString;
};
//------------------------------------------------------------------------
/** List of command-line option descriptions.
Use addOptions(const std::string&) to add Descriptions.
*/
//------------------------------------------------------------------------
class Descriptions
{
typedef std::deque<Description> DescriptionsList;
DescriptionsList mDescriptions;
std::string mCaption;
public:
Descriptions& addOptions (const std::string& caption = ""); ///< Sets the command-line tool caption and starts adding Descriptions.
bool parse (int ac, char* av[], VariablesMap& result, FilesVector* files = 0) const; ///< Parse the command-line.
void print (std::ostream& os) const; ///< Print a brief description for the command-line tool into the stream @c os.
Descriptions& operator() (const std::string& name, const std::string& help); ///< Add a new switch. Only
template <typename Type> Descriptions& operator() (const std::string& name, const Type& inType, std::string help); ///< Add a new option of type @c inType. Currently only std::string is supported.
};
//------------------------------------------------------------------------
// If you need the declarations in more than one cpp file you have to define
// SMTG_NO_IMPLEMENTATION in all but one file.
//------------------------------------------------------------------------
#ifndef SMTG_NO_IMPLEMENTATION

//------------------------------------------------------------------------
/*! If command-line contains option @c k more than once, only the last value will survive. */
//------------------------------------------------------------------------
std::string& VariablesMap::operator [](const VariablesMapContainer::key_type k)
{
return mVariablesMapContainer[k];
}

//------------------------------------------------------------------------
/*! If command-line contains option @c k more than once, only the last value will survive. */
//------------------------------------------------------------------------
const std::string& VariablesMap::operator [](const VariablesMapContainer::key_type k) const
{
return (*const_cast<VariablesMap*>(this))[k];
}
//------------------------------------------------------------------------
VariablesMap::VariablesMapContainer::size_type VariablesMap::count (const VariablesMapContainer::key_type k) const
{
return mVariablesMapContainer.count (k);
}

//------------------------------------------------------------------------
/** Add a new option with a string as parameter. */
//------------------------------------------------------------------------
template <> Descriptions& Descriptions::operator() (const std::string& name, const std::string& inType, std::string help)
{
mDescriptions.push_back (Description (name, help, inType));
return *this;
}
bool parse (int ac, char* av[], const Descriptions& desc, VariablesMap& result, FilesVector* files = 0); ///< Parse the command-line.
std::ostream& operator<< (std::ostream& os, const Descriptions& desc); ///< Make Descriptions stream able.

const std::string Description::kBool = "bool";
const std::string Description::kString = "string";

//------------------------------------------------------------------------
/*! In most cases you will use the Descriptions::addOptions (const std::string&) method to create and add descriptions.
@param[in] name of the option.
@param[in] help a help description for this option.
@param[out] valueType Description::kBool or Description::kString.
*/
//------------------------------------------------------------------------
Description::Description (const std::string& name, const std::string& help, const std::string& valueType)
: std::string (name)
, mHelp (help)
, mType (valueType)
{
}

//------------------------------------------------------------------------
/*! Returning a reverence to *this, enables chaining of calls to operator()(const std::string&, const std::string&).
@param[in] name of the added option.
@param[in] help a help description for this option.
@return a reverence to *this.
*/
Descriptions& Descriptions::operator() (const std::string& name, const std::string& help)
{
mDescriptions.push_back (Description (name, help, Description::kBool));
return *this;
}
//------------------------------------------------------------------------
/*! <b>Usage example:</b>
@code
CommandLine::Descriptions desc;
desc.addOptions ("myTool") // Set caption to "myTool"
("help", "produce help message") // add switch -help
("opt1", string(), "option 1") // add string option -opt1
("opt2", string(), "option 2") // add string option -opt2
;
@endcode
@note
The operator() is used for every additional option.
@param[in] caption the caption of the command-line tool.
@return a reverense to *this.
*/
//------------------------------------------------------------------------
Descriptions& Descriptions::addOptions (const std::string& caption)
{
mCaption = caption;
return *this;
}

//------------------------------------------------------------------------
/*! @param[in] ac count of command-line parameters
@param[in] av command-line as array of strings
@param[out] result the parsing result
@param[out] files optional list of elements on the command line that are not handled by options parsing
*/
//------------------------------------------------------------------------
bool Descriptions::parse (int ac, char* av[], VariablesMap& result, FilesVector* files) const
{
using namespace std;

int i;
for (i = 1; i < ac; i++)
{
string current = av[i];
if (current[0] == '-')
{
int pos = current[1] == '-' ? 2 : 1;
current = current.substr (pos, string::npos);

DescriptionsList::const_iterator found =
find (mDescriptions.begin (), mDescriptions.end (), current);
if (found != mDescriptions.end ())
{
result[*found] = "true";
if (found->mType != Description::kBool)
{
if (((i + 1) < ac) && *av[i + 1] != '-')
{
result[*found] = av[++i];
}
else
{
result[*found] = "error!";
result.setError ();
return false;
}
}
}
else
{
result.setError ();
return false;
}

}
else if (files)
files->push_back (av[i]);
}
return true;
}
//------------------------------------------------------------------------
/*! The description includes the help strings for all options. */
//------------------------------------------------------------------------
void Descriptions::print (std::ostream& os) const
{
if (!mCaption.empty())
os << mCaption << ":\n";

unsigned int i;
for (i = 0; i < mDescriptions.size (); ++i)
{
const Description& opt = mDescriptions[i];
os << "-" << opt << ":\t" << opt.mHelp << "\n";
}
}
//------------------------------------------------------------------------
std::ostream& operator<< (std::ostream& os, const Descriptions& desc)
{
desc.print (os);
return os;
}

//------------------------------------------------------------------------
/*! @param[in] ac count of command-line parameters
@param[in] av command-line as array of strings
@param[in] desc Descriptions including all allowed options
@param[out] result the parsing result
@param[out] files optional list of elements on the command line that are not handled by options parsing
*/
bool parse (int ac, char* av[], const Descriptions& desc, VariablesMap& result, FilesVector* files)
{
return desc.parse (ac, av, result, files);
}
#endif

} //namespace CommandLine
} //namespace Steinberg

+ 152
- 108
source/includes/vst3sdk/base/source/fdebug.cpp View File

@@ -11,28 +11,28 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------
@@ -41,85 +41,114 @@

#if DEVELOPMENT

#include <cstdio>
#include <assert.h>
#include <cstdarg>
#include <cstdio>

#if WINDOWS
#if SMTG_OS_WINDOWS
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#define _WIN32_WINNT 0x0400
#endif
#include <windows.h>
#include <intrin.h>
#include <windows.h>
#define vsnprintf _vsnprintf
#define snprintf _snprintf

#elif MAC
#include <mach/mach_time.h>
#include <mach/mach_init.h>
#elif SMTG_OS_MACOS
#include <errno.h>
#include <mach/mach_init.h>
#include <mach/mach_time.h>
#include <new>
#include <signal.h>
#include <stdbool.h>
#include <sys/sysctl.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/sysctl.h>
#include <signal.h>

static bool AmIBeingDebugged (void);

#define THREAD_ALLOC_WATCH 0 // check allocations on specific threads
#define THREAD_ALLOC_WATCH 0 // check allocations on specific threads

#if THREAD_ALLOC_WATCH
mach_port_t watchThreadID = 0;
#endif
#if THREAD_ALLOC_WATCH
mach_port_t watchThreadID = 0;
#endif

#endif

AssertionHandler gAssertionHandler = 0;
AssertionHandler gAssertionHandler = nullptr;
AssertionHandler gPreAssertionHook = nullptr;
DebugPrintLogger gDebugPrintLogger = nullptr;

namespace boost {
// Define the boost assertion handler to redirect to our assertion handler,
// otherwise it just calls abort(). Note that we don't need to include any boost
// headers for this, it just provides the handler.
void assertion_failed (char const* expr, char const* function, char const* file, long line)
{
#if DEVELOPMENT
char message[512];
snprintf (message, 512, "%s at %s, %s:%ld", expr, function, file, line);
if (gAssertionHandler)
{
FDebugBreak (message);
}
else
{
assert (!(const char *)message);
}
#endif
}
}

//--------------------------------------------------------------------------
static const int kDebugPrintfBufferSize = 10000;
static bool neverDebugger = false; // so I can switch it off in the debugger...
static const int kDebugPrintfBufferSize = 10000;
static bool neverDebugger = false; // so I can switch it off in the debugger...

//--------------------------------------------------------------------------
static void printDebugString (const char* string)
static void printDebugString (const char* string)
{
if (!string)
return;
#if MAC
fprintf (stderr, "%s", string);
#elif WINDOWS
OutputDebugStringA (string);
#endif
}

if (gDebugPrintLogger)
{
gDebugPrintLogger (string);
}
else
{
#if SMTG_OS_MACOS
fprintf (stderr, "%s", string);
#elif SMTG_OS_WINDOWS
OutputDebugStringA (string);
#endif
}
}

//--------------------------------------------------------------------------
// printf style debugging output
//--------------------------------------------------------------------------
void FDebugPrint (const char *format, ...)
void FDebugPrint (const char* format, ...)
{
char string[kDebugPrintfBufferSize];
va_list marker;
va_start (marker, format);
vsnprintf (string, kDebugPrintfBufferSize, format, marker);
printDebugString (string);
}


#if WINDOWS
#if SMTG_OS_WINDOWS
#define AmIBeingDebugged IsDebuggerPresent
#endif

#if LINUX
#if SMTG_OS_LINUX
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
//--------------------------------------------------------------------------
static inline bool AmIBeingDebugged ()
{
// TODO: check if GDB or LLDB is attached
// TODO: check if GDB or LLDB is attached
return true;
}
#endif
@@ -127,7 +156,7 @@ static inline bool AmIBeingDebugged ()
//--------------------------------------------------------------------------
// printf style debugging output
//--------------------------------------------------------------------------
void FDebugBreak (const char *format, ...)
void FDebugBreak (const char* format, ...)
{
char string[kDebugPrintfBufferSize];
va_list marker;
@@ -136,27 +165,36 @@ void FDebugBreak (const char *format, ...)

printDebugString (string);

// The Pre-assertion hook is always called, even if we're not running in the debugger,
// so that we can log asserts without displaying them
if (gPreAssertionHook)
{
gPreAssertionHook (string);
}

if (neverDebugger)
return;
if (AmIBeingDebugged ())
{
{
// do not crash if no debugger present
// If there is an assertion handler defined then let this override the UI
// and tell us whether we want to break into the debugger
bool breakIntoDebugger = true;
if (gAssertionHandler && gAssertionHandler (string) == false)
if (gAssertionHandler && gAssertionHandler (string) == false)
{
breakIntoDebugger = false;
}
}

if (breakIntoDebugger)
if (breakIntoDebugger)
{
#if WINDOWS
__debugbreak (); // intrinsic version of DebugBreak()
#if SMTG_OS_WINDOWS
__debugbreak (); // intrinsic version of DebugBreak()
#elif __ppc64__ || __ppc__ || __arm__
kill (getpid (), SIGINT);
#elif __i386__ || __x86_64__
{ __asm__ volatile ("int3"); }
{
__asm__ volatile ("int3");
}
#endif
}
}
@@ -165,106 +203,112 @@ void FDebugBreak (const char *format, ...)
//--------------------------------------------------------------------------
void FPrintLastError (const char* file, int line)
{
#if WINDOWS
LPVOID lpMessageBuffer;
FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR) &lpMessageBuffer, 0, NULL);
#if SMTG_OS_WINDOWS
LPVOID lpMessageBuffer;
FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
GetLastError (), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&lpMessageBuffer, 0, NULL);
FDebugPrint ("%s(%d) : %s\n", file, line, lpMessageBuffer);
LocalFree (lpMessageBuffer);
#endif

#if MAC
#if !__MACH__
extern int errno;
#endif
FDebugPrint ("%s(%d) : Errno %d\n", file, line, errno);
#endif
}


#endif

#if SMTG_OS_MACOS
#if !__MACH__
extern int errno;
#endif
FDebugPrint ("%s(%d) : Errno %d\n", file, line, errno);
#endif
}

#if MAC
#if SMTG_OS_MACOS

//------------------------------------------------------------------------
void* operator new (size_t size, int, const char *file, int line)
void* operator new (size_t size, int, const char* file, int line)
{
#if THREAD_ALLOC_WATCH
#if THREAD_ALLOC_WATCH
mach_port_t threadID = mach_thread_self ();
if (watchThreadID == threadID)
{
FDebugPrint ("Watched Thread Allocation : %s (Line:%d)\n", file ? file : "Unknown", line);
}
#endif
try {
return ::operator new (size);
} catch (std::bad_alloc exception) { FDebugPrint ("bad_alloc exception : %s (Line:%d)", file ? file : "Unknown", line); }
#endif
try
{
return ::operator new (size);
}
catch (std::bad_alloc exception)
{
FDebugPrint ("bad_alloc exception : %s (Line:%d)", file ? file : "Unknown", line);
}
return (void*)-1;
}

//------------------------------------------------------------------------
void* operator new [](size_t size, int, const char *file, int line)
void* operator new[] (size_t size, int, const char* file, int line)
{
#if THREAD_ALLOC_WATCH
#if THREAD_ALLOC_WATCH
mach_port_t threadID = mach_thread_self ();
if (watchThreadID == threadID)
{
FDebugPrint ("Watched Thread Allocation : %s (Line:%d)\n", file ? file : "Unknown", line);
}
#endif
try {
return ::operator new [](size);
} catch (std::bad_alloc exception) { FDebugPrint ("bad_alloc exception : %s (Line:%d)", file ? file : "Unknown", line);}
#endif
try
{
return ::operator new[] (size);
}
catch (std::bad_alloc exception)
{
FDebugPrint ("bad_alloc exception : %s (Line:%d)", file ? file : "Unknown", line);
}
return (void*)-1;
}

//------------------------------------------------------------------------
void operator delete(void* p, int, const char *file, int line)
void operator delete (void* p, int, const char* file, int line)
{
::operator delete (p);
::operator delete (p);
}

//------------------------------------------------------------------------
void operator delete[](void* p, int, const char *file, int line)
void operator delete[] (void* p, int, const char* file, int line)
{
::operator delete[] (p);
::operator delete[] (p);
}

//------------------------------------------------------------------------
// from Technical Q&A QA1361 (http://developer.apple.com/qa/qa2004/qa1361.html)
//------------------------------------------------------------------------
bool AmIBeingDebugged(void)
// Returns true if the current process is being debugged (either
// running under the debugger or has a debugger attached post facto).
bool AmIBeingDebugged (void)
// Returns true if the current process is being debugged (either
// running under the debugger or has a debugger attached post facto).
{
int mib[4];
struct kinfo_proc info;
size_t size;

// Initialize the flags so that, if sysctl fails for some bizarre
// reason, we get a predictable result.
int mib[4];
struct kinfo_proc info;
size_t size;

info.kp_proc.p_flag = 0;
// Initialize the flags so that, if sysctl fails for some bizarre
// reason, we get a predictable result.

// Initialize mib, which tells sysctl the info we want, in this case
// we're looking for information about a specific process ID.
info.kp_proc.p_flag = 0;

mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[3] = getpid();
// Initialize mib, which tells sysctl the info we want, in this case
// we're looking for information about a specific process ID.

// Call sysctl.
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[3] = getpid ();

size = sizeof(info);
sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
// Call sysctl.

// We're being debugged if the P_TRACED flag is set.
size = sizeof (info);
sysctl (mib, sizeof (mib) / sizeof (*mib), &info, &size, NULL, 0);

return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
// We're being debugged if the P_TRACED flag is set.
return ((info.kp_proc.p_flag & P_TRACED) != 0);
}

#endif // MAC
#endif // SMTG_OS_MACOS

#endif // DEVELOPMENT

+ 154
- 120
source/includes/vst3sdk/base/source/fdebug.h View File

@@ -11,7 +11,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -53,7 +53,7 @@
#include "pluginterfaces/base/ftypes.h"
#include <string.h>

#if MAC
#if SMTG_OS_MACOS
#include <new>
#endif

@@ -71,132 +71,145 @@
#endif

//-----------------------------------------------------------------------------
#if WINDOWS

#undef ASSERT
#if SMTG_OS_WINDOWS

/** Disable compiler warning:
* C4291: "No matching operator delete found; memory will not be freed if initialization throws an exception.
* A placement new is used for which there is no placement delete." */
#if DEVELOPMENT && defined (_MSC_VER)
#pragma warning(disable:4291)
#pragma warning(disable:4985)
* C4291: "No matching operator delete found; memory will not be freed if initialization throws an
* exception. A placement new is used for which there is no placement delete." */
#if DEVELOPMENT && defined(_MSC_VER)
#pragma warning(disable : 4291)
#pragma warning(disable : 4985)
#endif

#endif // WINDOWS
#endif // SMTG_OS_WINDOWS

#if DEVELOPMENT
//-----------------------------------------------------------------------------
/** If "f" is not true and a debugger is present, send an error string to the debugger for display and
cause a breakpoint exception to occur in the current process. ASSERT is removed completely in RELEASE configuration.
So do not pass methods calls to this macro that are expected to exist in the RELEASE build (for method calls that need
to be present in a RELEASE build, use the VERIFY macros instead)*/
#define ASSERT(f) if (!(f)) FDebugBreak ("%s(%d) : Assert failed: %s\n", __FILE__, __LINE__, #f);

/** Send "comment" string to the debugger for display. */
#define WARNING(comment) FDebugPrint ("%s(%d) : %s\n", __FILE__, __LINE__, comment);

/** Send the last error string to the debugger for display. */
#define PRINTSYSERROR FPrintLastError(__FILE__, __LINE__);

/** If a debugger is present, send string "s" to the debugger for display and
cause a breakpoint exception to occur in the current process. */
#define DEBUGSTR(s) FDebugBreak(s);

/** Use VERIFY for calling methods "f" having a bool result (expecting them to return 'true')
The call of "f" is not removed in RELEASE builds, only the result verification. eg: VERIFY (isValid ()) */
#define VERIFY(f) ASSERT(f)

/** Use VERIFY_IS for calling methods "f" and expect a certain result "r".
The call of "f" is not removed in RELEASE builds, only the result verification. eg: VERIFY_IS (callMethod (), kResultOK) */
#define VERIFY_IS(f,r) if ((f) != (r)) FDebugBreak ("%s(%d) : Assert failed: %s\n", __FILE__, __LINE__, #f);
/** Use VERIFY_NOT for calling methods "f" and expect the result to be anything else but "r".
The call of "f" is not removed in RELEASE builds, only the result verification. eg: VERIFY_NOT (callMethod (), kResultError) */
#define VERIFY_NOT(f,r) if ((f) == (r)) FDebugBreak ("%s(%d) : Assert failed: %s\n", __FILE__, __LINE__, #f);

/** @name Shortcut macros for sending strings to the debugger for display.
First parameter is always the format string (printf like).
*/
///@{
#define DBPRT0(a) FDebugPrint(a);
#define DBPRT1(a,b) FDebugPrint(a,b);
#define DBPRT2(a,b,c) FDebugPrint(a,b,c);
#define DBPRT3(a,b,c,d) FDebugPrint(a,b,c,d);
#define DBPRT4(a,b,c,d,e) FDebugPrint(a,b,c,d,e);
#define DBPRT5(a,b,c,d,e,f) FDebugPrint(a,b,c,d,e,f);
///@}
/** @name Helper functions for the above defined macros.
You shouldn't use them directly (if you do so, don't forget "#if DEVELOPMENT")!
It is recommended to use the macros instead.
*/
///@{
void FDebugPrint (const char *format, ...);
void FDebugBreak (const char *format, ...);
void FPrintLastError (const char* file, int line);
///@}

/** @name Provide a custom assertion handler
*/
///@{
typedef bool (*AssertionHandler)(const char* message);
extern AssertionHandler gAssertionHandler;
///@}

/** Definition of memory allocation macros:
Use "NEW" to allocate storage for individual objects.
Use "NEWVEC" to allocate storage for an array of objects. */
#if MAC
void* operator new (size_t, int, const char *, int);
void* operator new [] (size_t, int, const char *, int);
void operator delete (void* p, int, const char *file, int line);
void operator delete[] (void* p, int, const char *file, int line);

#ifndef NEW
#define NEW new (1, __FILE__, __LINE__)
#define NEWVEC new (1, __FILE__, __LINE__)
#endif

#define DEBUG_NEW DEBUG_NEW_LEAKS

#elif WINDOWS && defined (_MSC_VER)
#ifndef NEW
void * operator new (size_t, int, const char *, int);
#define NEW new (1, __FILE__, __LINE__)
#define NEWVEC new (1, __FILE__, __LINE__)
#endif
#else
#ifndef NEW
#define NEW new
#define NEWVEC new
#endif
#endif
//-----------------------------------------------------------------------------
/** If "f" is not true and a debugger is present, send an error string to the debugger for display
and cause a breakpoint exception to occur in the current process. SMTG_ASSERT is removed
completely in RELEASE configuration. So do not pass methods calls to this macro that are expected
to exist in the RELEASE build (for method calls that need to be present in a RELEASE build, use
the VERIFY macros instead)*/
#define SMTG_ASSERT(f) \
if (!(f)) \
FDebugBreak ("%s(%d) : Assert failed: %s\n", __FILE__, __LINE__, #f);

/** Send "comment" string to the debugger for display. */
#define SMTG_WARNING(comment) FDebugPrint ("%s(%d) : %s\n", __FILE__, __LINE__, comment);

/** Send the last error string to the debugger for display. */
#define SMTG_PRINTSYSERROR FPrintLastError (__FILE__, __LINE__);

/** If a debugger is present, send string "s" to the debugger for display and
cause a breakpoint exception to occur in the current process. */
#define SMTG_DEBUGSTR(s) FDebugBreak (s);

/** Use VERIFY for calling methods "f" having a bool result (expecting them to return 'true')
The call of "f" is not removed in RELEASE builds, only the result verification. eg: SMTG_VERIFY
(isValid ()) */
#define SMTG_VERIFY(f) SMTG_ASSERT (f)

/** Use VERIFY_IS for calling methods "f" and expect a certain result "r".
The call of "f" is not removed in RELEASE builds, only the result verification. eg:
SMTG_VERIFY_IS (callMethod (), kResultOK) */
#define SMTG_VERIFY_IS(f, r) \
if ((f) != (r)) \
FDebugBreak ("%s(%d) : Assert failed: %s\n", __FILE__, __LINE__, #f);

/** Use VERIFY_NOT for calling methods "f" and expect the result to be anything else but "r".
The call of "f" is not removed in RELEASE builds, only the result verification. eg:
SMTG_VERIFY_NOT (callMethod (), kResultError) */
#define SMTG_VERIFY_NOT(f, r) \
if ((f) == (r)) \
FDebugBreak ("%s(%d) : Assert failed: %s\n", __FILE__, __LINE__, #f);

/** @name Shortcut macros for sending strings to the debugger for display.
First parameter is always the format string (printf like).
*/

///@{
#define SMTG_DBPRT0(a) FDebugPrint (a);
#define SMTG_DBPRT1(a, b) FDebugPrint (a, b);
#define SMTG_DBPRT2(a, b, c) FDebugPrint (a, b, c);
#define SMTG_DBPRT3(a, b, c, d) FDebugPrint (a, b, c, d);
#define SMTG_DBPRT4(a, b, c, d, e) FDebugPrint (a, b, c, d, e);
#define SMTG_DBPRT5(a, b, c, d, e, f) FDebugPrint (a, b, c, d, e, f);
///@}

/** @name Helper functions for the above defined macros.

You shouldn't use them directly (if you do so, don't forget "#if DEVELOPMENT")!
It is recommended to use the macros instead.
*/
///@{
void FDebugPrint (const char* format, ...);
void FDebugBreak (const char* format, ...);
void FPrintLastError (const char* file, int line);
///@}

/** @name Provide a custom assertion handler and debug print handler, eg
so that we can provide an assert with a custom dialog, or redirect
the debug output to a file or stream.
*/
///@{
typedef bool (*AssertionHandler) (const char* message);
extern AssertionHandler gAssertionHandler;
extern AssertionHandler gPreAssertionHook;
typedef void (*DebugPrintLogger) (const char* message);
extern DebugPrintLogger gDebugPrintLogger;
///@}

/** Definition of memory allocation macros:
Use "NEW" to allocate storage for individual objects.
Use "NEWVEC" to allocate storage for an array of objects. */
#if SMTG_OS_MACOS
void* operator new (size_t, int, const char*, int);
void* operator new[] (size_t, int, const char*, int);
void operator delete (void* p, int, const char* file, int line);
void operator delete[] (void* p, int, const char* file, int line);
#ifndef NEW
#define NEW new (1, __FILE__, __LINE__)
#define NEWVEC new (1, __FILE__, __LINE__)
#endif

#define DEBUG_NEW DEBUG_NEW_LEAKS

#elif SMTG_OS_WINDOWS && defined(_MSC_VER)
#ifndef NEW
void* operator new (size_t, int, const char*, int);
#define NEW new (1, __FILE__, __LINE__)
#define NEWVEC new (1, __FILE__, __LINE__)
#endif

#else
/** if DEVELOPMENT is not set, these macros will do nothing. */
#define ASSERT(f)
#define WARNING(s)
#define PRINTSYSERROR
#define DEBUGSTR(s)
#define VERIFY(f) f;
#define VERIFY_IS(f,r) f;
#define VERIFY_NOT(f,r) f;

#define DBPRT0(a)
#define DBPRT1(a,b)
#define DBPRT2(a,b,c)
#define DBPRT3(a,b,c,d)
#define DBPRT4(a,b,c,d,e)
#define DBPRT5(a,b,c,d,e,f)

#ifndef NEW
#define NEW new
#define NEWVEC new
#endif
#ifndef NEW
#define NEW new
#define NEWVEC new
#endif
#endif

#else
/** if DEVELOPMENT is not set, these macros will do nothing. */
#define SMTG_ASSERT(f)
#define SMTG_WARNING(s)
#define SMTG_PRINTSYSERROR
#define SMTG_DEBUGSTR(s)
#define SMTG_VERIFY(f) f;
#define SMTG_VERIFY_IS(f, r) f;
#define SMTG_VERIFY_NOT(f, r) f;

#define SMTG_DBPRT0(a)
#define SMTG_DBPRT1(a, b)
#define SMTG_DBPRT2(a, b, c)
#define SMTG_DBPRT3(a, b, c, d)
#define SMTG_DBPRT4(a, b, c, d, e)
#define SMTG_DBPRT5(a, b, c, d, e, f)

#ifndef NEW
#define NEW new
#define NEWVEC new

#endif
#endif

#if SMTG_CPPUNIT_TESTING
@@ -204,3 +217,24 @@
#else
#define SMTG_IS_TEST false
#endif

#if !SMTG_RENAME_ASSERT
#if SMTG_OS_WINDOWS
#undef ASSERT
#endif

#define ASSERT SMTG_ASSERT
#define WARNING SMTG_WARNING
#define DEBUGSTR SMTG_DEBUGSTR
#define VERIFY SMTG_VERIFY
#define VERIFY_IS SMTG_VERIFY_IS
#define VERIFY_NOT SMTG_VERIFY_NOT
#define PRINTSYSERROR SMTG_PRINTSYSERROR

#define DBPRT0 SMTG_DBPRT0
#define DBPRT1 SMTG_DBPRT1
#define DBPRT2 SMTG_DBPRT2
#define DBPRT3 SMTG_DBPRT3
#define DBPRT4 SMTG_DBPRT4
#define DBPRT5 SMTG_DBPRT5
#endif

+ 0
- 264
source/includes/vst3sdk/base/source/fdynlib.cpp View File

@@ -1,264 +0,0 @@
//------------------------------------------------------------------------
// Project : SDK Base
// Version : 1.0
//
// Category : Helpers
// Filename : base/source/fdynlib.cpp
// Created by : Steinberg, 1998
// Description : Dynamic library loading
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#include "base/source/fdynlib.h"
#include "pluginterfaces/base/fstrdefs.h"
#include "base/source/fstring.h"

#if WINDOWS
#include <windows.h>

#elif MAC
#include <mach-o/dyld.h>
#include <CoreFoundation/CoreFoundation.h>

#if !TARGET_OS_IPHONE
static const Steinberg::tchar kUnixDelimiter = STR ('/');
#endif
#endif

namespace Steinberg {

#if MAC
#include <dlfcn.h>

// we ignore for the moment that the NSAddImage functions are deprecated
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

static bool CopyProcessPath (Steinberg::String& name)
{
Dl_info info;
if (dladdr ((const void*)CopyProcessPath, &info))
{
if (info.dli_fname)
{
name.assign (info.dli_fname);
#ifdef UNICODE
name.toWideString ();
#endif
return true;
}
}
return false;
}

#endif

//------------------------------------------------------------------------
// FDynLibrary
//------------------------------------------------------------------------
FDynLibrary::FDynLibrary (const tchar* n, bool addExtension)
: isloaded (false)
, instance (0)
{
if (n)
init (n, addExtension);
}

//------------------------------------------------------------------------
FDynLibrary::~FDynLibrary ()
{
unload ();
}

//------------------------------------------------------------------------
bool FDynLibrary::init (const tchar* n, bool addExtension)
{
if (isLoaded ())
return true;

Steinberg::String name (n);
#if WINDOWS
if (addExtension)
name.append (STR (".dll"));

instance = LoadLibrary (name);
if (instance)
isloaded = true;
#elif MAC
isBundle = false;
// first check if it is a bundle
if (addExtension)
name.append (STR (".bundle"));
if (name.getChar16 (0) != STR('/')) // no absoltue path
{
Steinberg::String p;
if (CopyProcessPath (p))
{
Steinberg::int32 index = p.findLast (STR ('/'));
p.remove (index+1);
name = p + name;
}
}
CFStringRef fsString = (CFStringRef)name.toCFStringRef ();
CFURLRef url = CFURLCreateWithFileSystemPath (NULL, fsString, kCFURLPOSIXPathStyle, true);
if (url)
{
CFBundleRef bundle = CFBundleCreate (NULL, url);
if (bundle)
{
if (CFBundleLoadExecutable (bundle))
{
isBundle = true;
instance = (void*)bundle;
}
else
CFRelease (bundle);
}
CFRelease (url);
}
CFRelease (fsString);

name.assign (n);

#if !TARGET_OS_IPHONE
if (!isBundle)
{
// now we check for a dynamic library
firstSymbol = NULL;
if (addExtension)
{
name.append (STR (".dylib"));
}
// Only if name is a relative path we use the Process Path as root:
if (name[0] != kUnixDelimiter)
{
Steinberg::String p;
if (CopyProcessPath (p))
{
Steinberg::int32 index = p.findLast (STR ("/"));
p.remove (index+1);
p.append (name);
p.toMultiByte (Steinberg::kCP_Utf8);
instance = (void*) NSAddImage (p, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
}
}
// Last but not least let the system search for it
//
if (instance == 0)
{
name.toMultiByte (Steinberg::kCP_Utf8);
instance = (void*) NSAddImage (name, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
}
}
#endif // !TARGET_OS_IPHONE

if (instance)
isloaded = true;

#endif

return isloaded;
}

//------------------------------------------------------------------------
bool FDynLibrary::unload ()
{
if (!isLoaded ())
return false;

#if WINDOWS
FreeLibrary ((HINSTANCE)instance);
#elif MAC
if (isBundle)
{
if (CFGetRetainCount ((CFTypeRef)instance) == 1)
CFBundleUnloadExecutable ((CFBundleRef)instance);
CFRelease ((CFBundleRef)instance);
}
else
{
// we don't use this anymore as the darwin dyld can't unload dynamic libraries yet and may crash
/* if (firstSymbol)
{
NSModule module = NSModuleForSymbol ((NSSymbol)firstSymbol);
if (module)
NSUnLinkModule (module, NSUNLINKMODULE_OPTION_NONE);
}*/
}
#endif
instance = 0;
isloaded = false;
return true;
}


//------------------------------------------------------------------------
void* FDynLibrary::getProcAddress (const char* name)
{
if (!isloaded)
return 0;
#if WINDOWS
return (void*)GetProcAddress ((HINSTANCE)instance, name);
#elif MAC
if (isBundle)
{
CFStringRef functionName = CFStringCreateWithCString (NULL, name, kCFStringEncodingASCII);
void* result = CFBundleGetFunctionPointerForName ((CFBundleRef)instance, functionName);
CFRelease (functionName);
return result;
}
#if !TARGET_OS_IPHONE
else
{
char* symbolName = (char*) malloc (strlen (name) + 2);
strcpy (symbolName, "_");
strcat (symbolName, name);
NSSymbol symbol;
symbol = NSLookupSymbolInImage ((const struct mach_header*)instance, symbolName, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
free (symbolName);
if (symbol)
{
if (firstSymbol == NULL)
firstSymbol = symbol;
return NSAddressOfSymbol (symbol);
}
}
#endif // !TARGET_OS_IPHONE

#endif

return 0;
}

//------------------------------------------------------------------------
} // namespace Steinberg

+ 0
- 112
source/includes/vst3sdk/base/source/fdynlib.h View File

@@ -1,112 +0,0 @@
//------------------------------------------------------------------------
// Project : SDK Base
// Version : 1.0
//
// Category : Helpers
// Filename : base/source/fdynlib.h
// Created by : Steinberg, 1998
// Description : Dynamic library loading
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

//------------------------------------------------------------------------
/** @file base/source/fdynlib.h
Platform independent dynamic library loading. */
//------------------------------------------------------------------------
#pragma once

#include "pluginterfaces/base/ftypes.h"
#include "base/source/fobject.h"

namespace Steinberg {

//------------------------------------------------------------------------
/** Platform independent dynamic library loader. */
//------------------------------------------------------------------------
class FDynLibrary : public FObject
{
public:
//------------------------------------------------------------------------
/** Constructor.
Loads the specified dynamic library.

@param[in] name the path of the library to load.
@param[in] addExtension if @c true append the platform dependent default extension to @c name.

@remarks
- If @c name specifies a full path, the FDynLibrary searches only that path for the library.
- If @c name specifies a relative path or a name without path,
FDynLibrary uses a standard search strategy of the current platform to find the library;
- If @c name is @c NULL the library is not loaded.
- Use init() to load the library. */
FDynLibrary (const tchar* name = 0, bool addExtension = true);
/** Destructor.
The destructor unloads the library.*/
~FDynLibrary ();

/** Loads the library if not already loaded.
This function is normally called by FDynLibrary().
@remarks If the library is already loaded, this call has no effect. */
bool init (const tchar* name, bool addExtension = true);

/** Returns the address of the procedure @c name */
void* getProcAddress (const char* name);

/** Returns true when the library was successfully loaded. */
bool isLoaded () {return isloaded;}

/** Unloads the library if it is loaded.
This function is called by ~FDynLibrary (). */
bool unload ();
/** Returns the platform dependent representation of the library instance. */
void* getPlatformInstance () const { return instance; }

#if MAC
/** Returns @c true if the library is a bundle (Mac only). */
bool isBundleLib () const {return isBundle;}
#endif

//------------------------------------------------------------------------
OBJ_METHODS(FDynLibrary, FObject)
protected:
bool isloaded;

void* instance;

#if MAC
void* firstSymbol;
bool isBundle;
#endif
};

//------------------------------------------------------------------------
} // namespace Steinberg

+ 7
- 6
source/includes/vst3sdk/base/source/fobject.cpp View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -36,7 +36,7 @@
//-----------------------------------------------------------------------------

#include "base/source/fobject.h"
#include "base/source/flock.h"
#include "base/thread/include/flock.h"

#include <vector>

@@ -68,7 +68,7 @@ uint32 PLUGIN_API FObject::addRef ()

//------------------------------------------------------------------------
uint32 PLUGIN_API FObject::release ()
{
{
if (FUnknownPrivate::atomicAdd (refCount, -1) == 0)
{
refCount = -1000;
@@ -128,14 +128,14 @@ namespace Singleton
typedef std::vector<FObject**> ObjectVector;
ObjectVector* singletonInstances = 0;
bool singletonsTerminated = false;
FLock* singletonsLock;
Steinberg::Base::Thread::FLock* singletonsLock;

bool isTerminated () {return singletonsTerminated;}

void lockRegister ()
{
if (!singletonsLock) // assume first call not from multiple threads
singletonsLock = NEW FLock;
singletonsLock = NEW Steinberg::Base::Thread::FLock;
singletonsLock->lock ();
}
void unlockRegister ()
@@ -145,7 +145,7 @@ namespace Singleton

void registerInstance (FObject** o)
{
ASSERT (singletonsTerminated == false)
SMTG_ASSERT (singletonsTerminated == false)
if (singletonsTerminated == false)
{
if (singletonInstances == 0)
@@ -167,6 +167,7 @@ namespace Singleton
{
FObject** obj = (*it);
(*obj)->release ();
*obj = 0;
obj = 0;
}



+ 2
- 2
source/includes/vst3sdk/base/source/fobject.h View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -112,7 +112,7 @@ public:
virtual void changed (int32 msg = kChanged); ///< Inform all dependents, that the object has changed.
virtual void deferUpdate (int32 msg = kChanged); ///< Similar to triggerUpdates, except only delivered in idle (usefull in collecting updates).
virtual void updateDone (int32 /* msg */) {} ///< empty virtual method that should be overridden by derived classes
virtual bool isEqualInstance (IDependent* d) {return static_cast<IDependent*> (this) == d;}
virtual bool isEqualInstance (FUnknown* d) {return this == d;}
static void setUpdateHandler (IUpdateHandler* handler) {gUpdateHandler = handler;} ///< set method for the local attribute
static IUpdateHandler* getUpdateHandler () {return gUpdateHandler;} ///< get method for the local attribute


+ 0
- 202
source/includes/vst3sdk/base/source/fstdmethods.h View File

@@ -1,202 +0,0 @@
//------------------------------------------------------------------------
// Project : SDK Base
// Version : 1.0
//
// Category : Helpers
// Filename : base/source/fstdmethods.h
// Created by : Steinberg, 2007
// Description : Convenient macros to create setter and getter methods.
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

//------------------------------------------------------------------------
/** @file base/source/fstdmethods.h
Convenient macros to create setter and getter methods. */
//------------------------------------------------------------------------
#pragma once

//----------------------------------------------------------------------------------
/** @name Methods for flags.
Macros to create setter and getter methods for flags.

Usage example with DEFINE_STATE:
\code
class MyClass
{
public:
MyClass () : flags (0) {}
DEFINE_FLAG (flags, isFlagged, 1<<0)
DEFINE_FLAG (flags, isMine, 1<<1)
private:
uint32 flags;
};
void someFunction ()
{
MyClass c;
if (c.isFlagged ()) // check the flag
c.isFlagged (false); // set the flag
}
\endcode
*/
//----------------------------------------------------------------------------------
///@{

/** Create Methods with @c get and @c set prefix. */
#define DEFINE_STATE(flagVar,methodName,value)\
void set##methodName (bool state) { if (state) flagVar |= (value); else flagVar &= ~(value); }\
bool get##methodName ()const { return (flagVar & (value)) != 0; }

/** Create Methods with @c get prefix.
There is only a 'get' method. */
#define DEFINE_GETSTATE(flagVar,methodName,value)\
bool get##methodName ()const { return (flagVar & (value)) != 0; }

/** Create Methods.
Same name for the getter and setter. */
#define DEFINE_FLAG(flagVar,methodName,value)\
void methodName (bool state) { if (state) flagVar |= (value); else flagVar &= ~(value); }\
bool methodName ()const { return (flagVar & (value)) != 0; }

/** Create Methods.
There is only a 'get' method. */
#define DEFINE_GETFLAG(flagVar,methodName,value)\
bool methodName ()const { return (flagVar & (value)) != 0; }


/** Create @c static Methods.
Same name for the getter and setter. */
#define DEFINE_FLAG_STATIC(flagVar,methodName,value)\
static void methodName (bool __state) { if (__state) flagVar |= (value); else flagVar &= ~(value); }\
static bool methodName () { return (flagVar & (value)) != 0; }
///@}

//----------------------------------------------------------------------------------
/** @name Methods for data members.
Macros to create setter and getter methods for class members.
<b>Examples:</b>
\code
class MyClass
{
public:
DATA_MEMBER (double, distance, Distance)
STRING_MEMBER (Steinberg::String, name, Name)
SHARED_MEMBER (FUnknown, userData, UserData)
CLASS_MEMBER (Steinberg::Buffer, bufferData, BufferData)
POINTER_MEMBER (Steinberg::FObject, refOnly, RefOnly)
};
\endcode
*/
//--------------------------------------------------------------------------------------
///@{

/** Build-in member (pass by value). */
#define DATA_MEMBER(type,varName,methodName)\
public:void set##methodName (type v) { varName = v;}\
type get##methodName ()const { return varName; }\
protected: type varName; public:

//** Object member (pass by reference). */
#define CLASS_MEMBER(type,varName,methodName)\
public:void set##methodName (const type& v){ varName = v;}\
const type& get##methodName () const { return varName; }\
protected: type varName; public:

//** Simple pointer. */
#define POINTER_MEMBER(type,varName,methodName)\
public:void set##methodName (type* ptr){ varName = ptr;}\
type* get##methodName ()const { return varName; }\
private: type* varName; public:

//** Shared member - FUnknown / FObject / etc */
#define SHARED_MEMBER(type,varName,methodName)\
public:void set##methodName (type* v){ varName = v;}\
type* get##methodName ()const { return varName; }\
private: IPtr<type> varName; public:

//** Owned member - FUnknown / FObject / CmObject etc */
#define OWNED_MEMBER(type,varName,methodName)\
public:void set##methodName (type* v){ varName = v;}\
type* get##methodName ()const { return varName; }\
private: OPtr<type> varName; public:

//** tchar* / String class member - set by const tchar*, return by reference */
#define STRING_MEMBER(type,varName,methodName)\
public:void set##methodName (const tchar* v){ varName = v;}\
const type& get##methodName () const { return varName; }\
protected: type varName; public:

//** char8* / String class member - set by const char8*, return by reference */
#define STRING8_MEMBER(type,varName,methodName)\
public:void set##methodName (const char8* v){ varName = v;}\
const type& get##methodName () const { return varName; }\
protected: type varName; public:

//** Standard String Member Steinberg::String */
#define STRING_MEMBER_STD(varName,methodName) STRING_MEMBER(Steinberg::String,varName,methodName)
#define STRING8_MEMBER_STD(varName,methodName) STRING8_MEMBER(Steinberg::String,varName,methodName)

///@}


// obsolete names
#define DEFINE_VARIABLE(type,varName,methodName) DATA_MEMBER(type,varName,methodName)
#define DEFINE_POINTER(type,varName,methodName) POINTER_MEMBER(type,varName,methodName)
#define DEFINE_MEMBER(type,varName,methodName) CLASS_MEMBER(type,varName,methodName)





//------------------------------------------------------------------------
// for implementing comparison operators using a class member or a compare method:
//------------------------------------------------------------------------
#define COMPARE_BY_MEMBER_METHODS(className,memberName) \
bool operator == (const className& other) const {return (memberName == other.memberName);} \
bool operator != (const className& other) const {return (memberName != other.memberName);} \
bool operator < (const className& other) const {return (memberName < other.memberName);} \
bool operator > (const className& other) const {return (memberName > other.memberName);} \
bool operator <= (const className& other) const {return (memberName <= other.memberName);} \
bool operator >= (const className& other) const {return (memberName >= other.memberName);}

#define COMPARE_BY_MEMORY_METHODS(className) \
bool operator == (const className& other) const {return memcmp (this, &other, sizeof (className)) == 0;} \
bool operator != (const className& other) const {return memcmp (this, &other, sizeof (className)) != 0;} \
bool operator < (const className& other) const {return memcmp (this, &other, sizeof (className)) < 0;} \
bool operator > (const className& other) const {return memcmp (this, &other, sizeof (className)) > 0;} \
bool operator <= (const className& other) const {return memcmp (this, &other, sizeof (className)) <= 0;} \
bool operator >= (const className& other) const {return memcmp (this, &other, sizeof (className)) >= 0;}

#define COMPARE_BY_COMPARE_METHOD(className,methodName) \
bool operator == (const className& other) const {return methodName (other) == 0;} \
bool operator != (const className& other) const {return methodName (other) != 0;} \
bool operator < (const className& other) const {return methodName (other) < 0;} \
bool operator > (const className& other) const {return methodName (other) > 0;} \
bool operator <= (const className& other) const {return methodName (other) <= 0; } \
bool operator >= (const className& other) const {return methodName (other) >= 0; }

+ 2
- 2
source/includes/vst3sdk/base/source/fstreamer.cpp View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -671,7 +671,7 @@ bool FStreamer::writeStr8 (const char8* s)
return false;

if (length > 0)
return writeRaw (s, sizeof (char8) * length) == sizeof (char8) * length;
return writeRaw (s, sizeof (char8) * length) == static_cast<TSize>(sizeof (char8) * length);

return true;
}


+ 2
- 2
source/includes/vst3sdk/base/source/fstreamer.h View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -72,7 +72,7 @@ public:
/** @name Streams are byteOrder aware. */
///@{
inline void setByteOrder (int32 e) { byteOrder = (int16)e; }
inline int32 getByteOrder () { return byteOrder; }
inline int32 getByteOrder () const { return byteOrder; }
///@}

/** @name read and write int8 and char. */


+ 88
- 99
source/includes/vst3sdk/base/source/fstring.cpp View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -41,12 +41,12 @@
#include "pluginterfaces/base/fvariant.h"

#include <cstdlib>
#include <ctype.h>
#include <cctype>
#include <cstdio>
#include <stdarg.h>
#include <cstdarg>
#include <utility>

#if WINDOWS
#if SMTG_OS_WINDOWS
#include <windows.h>
#pragma warning (disable : 4244)
#pragma warning (disable : 4267)
@@ -67,7 +67,7 @@
#define kPrintfBufferSize 4096
#endif

#if MAC
#if SMTG_OS_MACOS
#include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFString.h>
#include <CoreFoundation/CFStringEncodingExt.h>
@@ -198,9 +198,9 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
dest[usedBytes] = 0;
return result;
}
#endif // MAC
#endif // SMTG_OS_MACOS

#if WINDOWS
#if SMTG_OS_WINDOWS
#define stricmp16 wcsicmp
#define strnicmp16 wcsnicmp
#define strrchr16 wcsrchr
@@ -230,7 +230,7 @@ static bool fromCFStringRef (Steinberg::char8* dest, Steinberg::int32 destSize,
#define wtol _wtol
#define wtof _wtof

#elif LINUX
#elif SMTG_OS_LINUX
#include <codecvt>
#include <locale>
#include <cstring>
@@ -287,7 +287,6 @@ static inline int strnicmp16 (const Steinberg::char16* s1, const Steinberg::char
//-----------------------------------------------------------------------------
static inline int sprintf16 (Steinberg::char16* wcs, const Steinberg::char16* format, ...)
{
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return 0;
}
@@ -311,12 +310,11 @@ static inline int vsnwprintf (Steinberg::char16* wcs, size_t maxlen,
//-----------------------------------------------------------------------------
static inline Steinberg::char16* strrchr16 (const Steinberg::char16* str, Steinberg::char16 c)
{
#warning DEPRECATED No Linux implementation
assert(false && "DEPRECATED No Linux implementation");
return nullptr;
}

#elif MAC
#elif SMTG_OS_MACOS
#define tstrtoi64 strtoll
#define stricmp strcasecmp
#define strnicmp strncasecmp
@@ -749,8 +747,6 @@ int32 ConstString::compareAt (uint32 index, const ConstString& str, int32 n, Com
else
return strnicmp (toCompare, str, n);
}

return 0;
}
else if (isWide && str.isWide)
{
@@ -780,8 +776,6 @@ int32 ConstString::compareAt (uint32 index, const ConstString& str, int32 n, Com
else
return strnicmp16 (toCompare, str.text16 (), n);
}

return 0;
}
else
{
@@ -800,7 +794,6 @@ int32 ConstString::compareAt (uint32 index, const ConstString& str, int32 n, Com
return tmp.compareAt (index, str, n, mode);
}
}
return 0; // should never be reached
}

//------------------------------------------------------------------------
@@ -834,7 +827,6 @@ Steinberg::int32 ConstString::naturalCompare (const ConstString& str, CompareMod
return strnatcmp16 (tmp.text16 (), str.text16 (), isCaseSensitive (mode));
}
}
return 0; // should never be reached
}

//-----------------------------------------------------------------------------
@@ -884,8 +876,6 @@ bool ConstString::startsWith (const ConstString& str, CompareMode mode /*= kCase
return strncmp16 (tmp.buffer16, str.buffer16, str.length ()) == 0;
return strnicmp16 (tmp.buffer16, str.buffer16, str.length ()) == 0;
}
ASSERT(false)
return false; // should never be reached
}

//-----------------------------------------------------------------------------
@@ -935,8 +925,6 @@ bool ConstString::endsWith (const ConstString& str, CompareMode mode /*= kCaseSe
return strncmp16 (tmp.buffer16 + (tmp.length () - str.length ()), str.buffer16, str.length ()) == 0;
return strnicmp16 (tmp.buffer16 + (tmp.length () - str.length ()), str.buffer16, str.length ()) == 0;
}
ASSERT(false)
return false; // should never be reached
}

//-----------------------------------------------------------------------------
@@ -1578,11 +1566,11 @@ bool ConstString::scanFloat (double& value, uint32 offset, bool scanToEnd) const
//-----------------------------------------------------------------------------
char16 ConstString::toLower (char16 c)
{
#if WINDOWS
#if SMTG_OS_WINDOWS
WCHAR temp[2] = {c, 0};
::CharLowerW (temp);
return temp[0];
#elif MAC
#elif SMTG_OS_MACOS
// only convert characters which in lowercase are also single characters
UniChar characters [2] = {0};
characters[0] = c;
@@ -1595,8 +1583,7 @@ char16 ConstString::toLower (char16 c)
return characters[0];
}
return c;
#elif LINUX
#warning DEPRECATED No Linux implementation
#elif SMTG_OS_LINUX
assert(false && "DEPRECATED No Linux implementation");
return c;
#else
@@ -1607,11 +1594,11 @@ char16 ConstString::toLower (char16 c)
//-----------------------------------------------------------------------------
char16 ConstString::toUpper (char16 c)
{
#if WINDOWS
#if SMTG_OS_WINDOWS
WCHAR temp[2] = {c, 0};
::CharUpperW (temp);
return temp[0];
#elif MAC
#elif SMTG_OS_MACOS
// only convert characters which in uppercase are also single characters (don't translate a sharp-s which would result in SS)
UniChar characters [2] = {0};
characters[0] = c;
@@ -1624,8 +1611,7 @@ char16 ConstString::toUpper (char16 c)
return characters[0];
}
return c;
#elif LINUX
#warning DEPRECATED No Linux implementation
#elif SMTG_OS_LINUX
assert(false && "DEPRECATED No Linux implementation");
return c;
#else
@@ -1638,7 +1624,7 @@ char8 ConstString::toLower (char8 c)
{
if ((c >= 'A') && (c <= 'Z'))
return c + ('a' - 'A');
#if WINDOWS
#if SMTG_OS_WINDOWS
CHAR temp[2] = {c, 0};
::CharLowerA (temp);
return temp[0];
@@ -1652,7 +1638,7 @@ char8 ConstString::toUpper (char8 c)
{
if ((c >= 'a') && (c <= 'z'))
return c - ('a' - 'A');
#if WINDOWS
#if SMTG_OS_WINDOWS
CHAR temp[2] = {c, 0};
::CharUpperA (temp);
return temp[0];
@@ -1713,7 +1699,7 @@ bool ConstString::isCharAlphaNum (const char8 character)
//-----------------------------------------------------------------------------
bool ConstString::isCharAlphaNum (const char16 character)
{
return iswalnum (character) != 0; // this may not work on MacOSX when another locale is set inside the c-lib
return iswalnum (character) != 0; // this may not work on macOSX when another locale is set inside the c-lib
}

//-----------------------------------------------------------------------------
@@ -1725,7 +1711,7 @@ bool ConstString::isCharDigit (const char8 character)
//-----------------------------------------------------------------------------
bool ConstString::isCharDigit (const char16 character)
{
return iswdigit (character) != 0; // this may not work on MacOSX when another locale is set inside the c-lib
return iswdigit (character) != 0; // this may not work on macOSX when another locale is set inside the c-lib
}

//-----------------------------------------------------------------------------
@@ -1790,7 +1776,7 @@ int32 ConstString::getTrailingNumberIndex (uint32 width) const
// now either all are digits or i is on the first non digit
if (i < endIndex)
{
if (width > 0 && (endIndex - i != width))
if (width > 0 && (endIndex - i != static_cast<int32> (width)))
return -1;

return i + 1;
@@ -1848,7 +1834,7 @@ bool ConstString::isAsciiString () const
}


#if MAC
#if SMTG_OS_MACOS
uint32 kDefaultSystemEncoding = kCFStringEncodingMacRoman;
//-----------------------------------------------------------------------------
static CFStringEncoding MBCodePageToCFStringEncoding (uint32 codePage)
@@ -1879,28 +1865,30 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
return 0;
}
int32 result = 0;
#if WINDOWS
#if SMTG_OS_WINDOWS
result = MultiByteToWideChar (sourceCodePage, MB_ERR_INVALID_CHARS, source, -1, dest, charCount);
#endif

#if MAC
CFStringRef cfStr = (CFStringRef)::toCFStringRef (source, MBCodePageToCFStringEncoding (sourceCodePage));
#if SMTG_OS_MACOS
CFStringRef cfStr =
(CFStringRef)::toCFStringRef (source, MBCodePageToCFStringEncoding (sourceCodePage));
if (cfStr)
{
CFRange range = {0, CFStringGetLength (cfStr)};
CFIndex usedBytes;
if (CFStringGetBytes (cfStr, range, kCFStringEncodingUnicode, ' ', false, (UInt8*)dest, charCount * 2, &usedBytes) > 0)
if (CFStringGetBytes (cfStr, range, kCFStringEncodingUnicode, ' ', false, (UInt8*)dest,
charCount * 2, &usedBytes) > 0)
{
result = static_cast<int32>(usedBytes/2 + 1);
result = static_cast<int32> (usedBytes / 2 + 1);
if (dest)
dest[usedBytes/2] = 0;
dest[usedBytes / 2] = 0;
}

CFRelease (cfStr);
}
#endif

#if LINUX
#if SMTG_OS_LINUX
if (sourceCodePage == kCP_ANSI || sourceCodePage == kCP_Utf8)
{
if (dest == nullptr)
@@ -1921,24 +1909,23 @@ int32 ConstString::multiByteToWideString (char16* dest, const char8* source, int
}
}
else
{
#warning DEPRECATED No Linux implementation
{
assert(false && "DEPRECATED No Linux implementation");
}

#endif

ASSERT (result > 0)
SMTG_ASSERT (result > 0)
return result;
}

//-----------------------------------------------------------------------------
int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString, int32 charCount, uint32 destCodePage)
{
#if WINDOWS
#if SMTG_OS_WINDOWS
return WideCharToMultiByte (destCodePage, 0, wideString, -1, dest, charCount, 0, 0);

#elif MAC
#elif SMTG_OS_MACOS
int32 result = 0;
if (wideString != 0)
{
@@ -1948,18 +1935,18 @@ int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString,
if (cfStr)
{
if (fromCFStringRef (dest, charCount, cfStr, MBCodePageToCFStringEncoding (destCodePage)))
result = static_cast<int32>(strlen (dest) + 1);
result = static_cast<int32> (strlen (dest) + 1);
CFRelease (cfStr);
}
}
else
{
return static_cast<int32>(CFStringGetMaximumSizeForEncoding (strlen16 (wideString), MBCodePageToCFStringEncoding (destCodePage)));
return static_cast<int32> (CFStringGetMaximumSizeForEncoding (strlen16 (wideString), MBCodePageToCFStringEncoding (destCodePage)));
}
}
return result;

#elif LINUX
#elif SMTG_OS_LINUX
int32 result = 0;
if (destCodePage == kCP_Utf8)
{
@@ -2002,8 +1989,7 @@ int32 ConstString::wideStringToMultiByte (char8* dest, const char16* wideString,
}
}
else
{
#warning DEPRECATED No Linux implementation
{
assert(false && "DEPRECATED No Linux implementation");
}
return result;
@@ -2022,15 +2008,17 @@ bool ConstString::isNormalized (UnicodeNormalization n)
if (isWide == false)
return false;

#if WINDOWS
#if SMTG_OS_WINDOWS
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;
int32 normCharCount = FoldString (MAP_PRECOMPOSED, buffer16, len, 0, 0);
uint32 normCharCount = static_cast<uint32> (FoldString (MAP_PRECOMPOSED, buffer16, len, 0, 0));
return (normCharCount == len);
#else
return false;
#endif

#elif MAC
#elif SMTG_OS_MACOS
if (n != kUnicodeNormC)
return false;

@@ -2038,10 +2026,9 @@ bool ConstString::isNormalized (UnicodeNormalization n)
CFIndex charCount = CFStringGetLength (cfStr);
CFRelease (cfStr);
return (charCount == len);

#endif

#else
return false;
#endif
}

//-----------------------------------------------------------------------------
@@ -2128,7 +2115,7 @@ String::String (String&& str)
//-----------------------------------------------------------------------------
String& String::operator= (String&& str)
{
ASSERT (buffer == 0 || buffer != str.buffer);
SMTG_ASSERT (buffer == 0 || buffer != str.buffer);
tryFreeBuffer ();
isWide = str.isWide;
@@ -2182,7 +2169,7 @@ bool String::toWideString (uint32 sourceCodePage)
}

#define SMTG_STRING_CHECK_CONVERSION 1
#define SMTG_STRING_CHECK_CONVERSION_NO_BREAK 0
#define SMTG_STRING_CHECK_CONVERSION_NO_BREAK 1

#if SMTG_STRING_CHECK_CONVERSION_NO_BREAK
#define SMTG_STRING_CHECK_MSG FDebugPrint
@@ -2279,17 +2266,17 @@ bool String::normalize (UnicodeNormalization n)
if (buffer16 == 0)
return true;

#if WINDOWS
#if SMTG_OS_WINDOWS
#ifdef UNICODE
if (n != kUnicodeNormC)
return false;

int32 normCharCount = FoldString (MAP_PRECOMPOSED, buffer16, len, 0, 0);
uint32 normCharCount = static_cast<uint32> (FoldString (MAP_PRECOMPOSED, buffer16, len, 0, 0));
if (normCharCount == len)
return true;

char16* newString = (char16*)malloc ((normCharCount + 1) * sizeof (char16));
int32 converterCount = FoldString (MAP_PRECOMPOSED, buffer16, len, newString, normCharCount + 1);
uint32 converterCount = static_cast<uint32> (FoldString (MAP_PRECOMPOSED, buffer16, len, newString, normCharCount + 1));
if (converterCount != normCharCount)
{
free (newString);
@@ -2300,9 +2287,11 @@ bool String::normalize (UnicodeNormalization n)
buffer16 = newString;
updateLength ();
return true;
#else
return false;
#endif

#elif MAC
#elif SMTG_OS_MACOS
CFMutableStringRef origStr = (CFMutableStringRef)toCFStringRef (0xFFFF, true);
if (origStr)
{
@@ -2319,10 +2308,10 @@ bool String::normalize (UnicodeNormalization n)
CFRelease (origStr);
return result;
}

#endif

return false;
#else
return false;
#endif
}

//-----------------------------------------------------------------------------
@@ -2346,11 +2335,11 @@ bool String::resize (uint32 newLength, bool wide, bool fill)
}
else
{
TSize newCharSize = wide ? sizeof (char16) : sizeof (char8);
TSize oldCharSize = (isWide != 0) ? sizeof (char16) : sizeof (char8);
size_t newCharSize = wide ? sizeof (char16) : sizeof (char8);
size_t oldCharSize = (isWide != 0) ? sizeof (char16) : sizeof (char8);

TSize newBufferSize = (newLength + 1) * newCharSize;
TSize oldBufferSize = (len + 1) * oldCharSize;
size_t newBufferSize = (newLength + 1) * newCharSize;
size_t oldBufferSize = (len + 1) * oldCharSize;

isWide = wide ? 1 : 0;

@@ -2441,12 +2430,12 @@ bool String::setChar8 (uint32 index, char8 c)
if (multiByteToWideString (dest, src, 2) > 0)
buffer16[index] = dest[0];
}
ASSERT (buffer16[len] == 0)
SMTG_ASSERT (buffer16[len] == 0)
}
else
{
buffer8[index] = c;
ASSERT (buffer8[len] == 0)
SMTG_ASSERT (buffer8[len] == 0)
}

if (c == 0)
@@ -2485,11 +2474,11 @@ bool String::setChar16 (uint32 index, char16 c)
if (isWide)
{
buffer16[index] = c;
ASSERT (buffer16[len] == 0)
SMTG_ASSERT (buffer16[len] == 0)
}
else
{
ASSERT (buffer8[len] == 0)
SMTG_ASSERT (buffer8[len] == 0)
char16 src[] = {c, 0};
char8 dest[8] = {0};
if (wideStringToMultiByte (dest, src, 2) > 0 && dest[1] == 0)
@@ -2534,7 +2523,7 @@ String& String::assign (const char8* str, int32 n, bool isTerminated)
if (buffer8 && n > 0)
{
memcpy (buffer8, str, n * sizeof (char8));
ASSERT (buffer8[n] == 0)
SMTG_ASSERT (buffer8[n] == 0)
}
isWide = 0;
len = n;
@@ -2561,7 +2550,7 @@ String& String::assign (const char16* str, int32 n, bool isTerminated)
if (buffer16 && n > 0)
{
memcpy (buffer16, str, n * sizeof (char16));
ASSERT (buffer16[n] == 0)
SMTG_ASSERT (buffer16[n] == 0)
}
isWide = 1;
len = n;
@@ -2577,7 +2566,7 @@ String& String::assign (char8 c, int32 n)
if (buffer8 && n > 0)
{
memset (buffer8, c, n * sizeof (char8));
ASSERT (buffer8[n] == 0)
SMTG_ASSERT (buffer8[n] == 0)
}
isWide = 0;
len = n;
@@ -2595,7 +2584,7 @@ String& String::assign (char16 c, int32 n)
{
for (int32 i = 0; i < n; i++)
buffer16[i] = c;
ASSERT (buffer16[n] == 0)
SMTG_ASSERT (buffer16[n] == 0)
}
isWide = 1;
len = n;
@@ -2642,7 +2631,7 @@ String& String::append (const char8* str, int32 n)
if (buffer)
{
memcpy (buffer8 + len, str, n * sizeof (char8));
ASSERT (buffer8[newlen] == 0)
SMTG_ASSERT (buffer8[newlen] == 0)
}

len += n;
@@ -2677,7 +2666,7 @@ String& String::append (const char16* str, int32 n)
if (buffer16)
{
memcpy (buffer16 + len, str, n * sizeof (char16));
ASSERT (buffer16[newlen] == 0)
SMTG_ASSERT (buffer16[newlen] == 0)
}

len += n;
@@ -2711,7 +2700,7 @@ String& String::append (const char8 c, int32 n)
if (buffer)
{
memset (buffer8 + len, c, n * sizeof (char8));
ASSERT (buffer8[newlen] == 0)
SMTG_ASSERT (buffer8[newlen] == 0)
}

len += n;
@@ -2743,7 +2732,7 @@ String& String::append (const char16 c, int32 n)
{
for (int32 i = len; i < newlen; i++)
buffer16[i] = c;
ASSERT (buffer16[newlen] == 0)
SMTG_ASSERT (buffer16[newlen] == 0)
}

len += n;
@@ -2788,7 +2777,7 @@ String& String::insertAt (uint32 idx, const char8* str, int32 n)
if (idx < len)
memmove (buffer8 + idx + n, buffer8 + idx, (len - idx) * sizeof (char8));
memcpy (buffer8 + idx, str, n * sizeof (char8));
ASSERT (buffer8[newlen] == 0)
SMTG_ASSERT (buffer8[newlen] == 0)
}

len += n;
@@ -2822,7 +2811,7 @@ String& String::insertAt (uint32 idx, const char16* str, int32 n)
if (idx < len)
memmove (buffer16 + idx + n, buffer16 + idx, (len - idx) * sizeof (char16));
memcpy (buffer16 + idx, str, n * sizeof (char16));
ASSERT (buffer16[newlen] == 0)
SMTG_ASSERT (buffer16[newlen] == 0)
}

len += n;
@@ -2930,8 +2919,8 @@ int32 String::replace (const char8* toReplace, const char8* toReplaceWith, bool
int32 idx = findFirst (toReplace, -1, m);
if (idx > -1)
{
int32 toReplaceLen = static_cast<int32>(strlen (toReplace));
int32 toReplaceWithLen = static_cast<int32>(strlen (toReplaceWith));
int32 toReplaceLen = static_cast<int32> (strlen (toReplace));
int32 toReplaceWithLen = static_cast<int32> (strlen (toReplaceWith));
while (idx > -1)
{
replace (idx, toReplaceLen, toReplaceWith, toReplaceWithLen);
@@ -3039,7 +3028,7 @@ bool String::replaceChars16 (const char16* toReplace, char16 toReplaceBy)

if (toReplaceA.length () > 1)
{
WARNING("cannot replace non ASCII chars on non Wide String")
SMTG_WARNING("cannot replace non ASCII chars on non Wide String")
return false;
}

@@ -3112,7 +3101,7 @@ static uint32 performTrim (T* str, uint32 length, F func, bool funcResult)
while ((*p) && ((func (*p) != 0) == funcResult))
p++;

toRemoveAtHead = static_cast<uint32>(p - str);
toRemoveAtHead = static_cast<uint32> (p - str);

if (toRemoveAtHead < length)
{
@@ -3328,7 +3317,7 @@ String& String::printf (const char8* format, ...)
va_list marker;
va_start (marker, format);
vsnprintf (string, kPrintfBufferSize, format, marker);
vsnprintf (string, kPrintfBufferSize-1, format, marker);
return assign (string);
}

@@ -3341,7 +3330,7 @@ String& String::printf (const char16* format, ...)
va_list marker;
va_start (marker, format);
vsnwprintf (string, kPrintfBufferSize, format, marker);
vsnwprintf (string, kPrintfBufferSize-1, format, marker);
return assign (string);
}

@@ -3350,7 +3339,7 @@ String& String::vprintf (const char8* format, va_list args)
{
char8 string[kPrintfBufferSize];

vsnprintf (string, kPrintfBufferSize, format, args);
vsnprintf (string, kPrintfBufferSize-1, format, args);
return assign (string);
}

@@ -3359,7 +3348,7 @@ String& String::vprintf (const char16* format, va_list args)
{
char16 string[kPrintfBufferSize];

vsnwprintf (string, kPrintfBufferSize, format, args);
vsnwprintf (string, kPrintfBufferSize-1, format, args);
return assign (string);
}

@@ -3509,7 +3498,7 @@ void String::toLower ()
{
if (isWide)
{
#if MAC
#if SMTG_OS_MACOS
CFMutableStringRef cfStr = CFStringCreateMutableWithExternalCharactersNoCopy (kCFAllocator, (UniChar*)buffer16, len, len+1, kCFAllocatorNull);
CFStringLowercase (cfStr, NULL);
CFRelease (cfStr);
@@ -3554,7 +3543,7 @@ void String::toUpper ()
{
if (isWide)
{
#if MAC
#if SMTG_OS_MACOS
CFMutableStringRef cfStr = CFStringCreateMutableWithExternalCharactersNoCopy (kCFAllocator, (UniChar*)buffer16, len, len+1, kCFAllocatorNull);
CFStringUppercase (cfStr, NULL);
CFRelease (cfStr);
@@ -3754,7 +3743,7 @@ const String& String::fromPascalString (const unsigned char* buf)
return *this;
}

#if MAC
#if SMTG_OS_MACOS

//-----------------------------------------------------------------------------
bool String::fromCFStringRef (const void* cfStr, uint32 encoding)
@@ -3767,7 +3756,7 @@ bool String::fromCFStringRef (const void* cfStr, uint32 encoding)
{
CFRange range = { 0, CFStringGetLength (strRef)};
CFIndex usedBytes;
if (resize (static_cast<int32>(range.length + 1), true))
if (resize (static_cast<int32> (range.length + 1), true))
{
if (encoding == 0xFFFF)
encoding = kCFStringEncodingUnicode;
@@ -3785,12 +3774,12 @@ bool String::fromCFStringRef (const void* cfStr, uint32 encoding)
return false;
if (encoding == 0xFFFF)
encoding = kCFStringEncodingASCII;
int32 len = static_cast<int32>(CFStringGetLength (strRef) * 2);
int32 len = static_cast<int32> (CFStringGetLength (strRef) * 2);
if (resize (++len, false))
{
if (CFStringGetCString (strRef, buffer8, len, encoding))
{
this->len = static_cast<int32>(strlen (buffer8));
this->len = static_cast<int32> (strlen (buffer8));
return true;
}
}


+ 10
- 10
source/includes/vst3sdk/base/source/fstring.h View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -125,16 +125,16 @@ public:
virtual ~ConstString () {} ///< Destructor.

// access -----------------------------------------------------------------
virtual int32 length () const {return len;} ///< Return length of string
inline bool isEmpty () const {return buffer == 0 || len == 0;} ///< Return true if sting is empty
virtual int32 length () const {return static_cast<int32> (len);} ///< Return length of string
inline bool isEmpty () const {return buffer == 0 || len == 0;} ///< Return true if string is empty

operator const char8* () const {return text8 ();} ///< Returns pointer to string of type char8 (no modification allowed)
operator const char16* () const {return text16 ();} ///< Returns pointer to string of type char16(no modification allowed)
inline tchar operator[] (short idx) const {return getChar (idx);} ///< Returns character at 'idx'
inline tchar operator[] (long idx) const {return getChar (static_cast<uint32>(idx));}
inline tchar operator[] (int idx) const {return getChar (idx);}
inline tchar operator[] (short idx) const {return getChar (static_cast<uint32> (idx));} ///< Returns character at 'idx'
inline tchar operator[] (long idx) const {return getChar (static_cast<uint32> (idx));}
inline tchar operator[] (int idx) const {return getChar (static_cast<uint32> (idx));}
inline tchar operator[] (unsigned short idx) const {return getChar (idx);}
inline tchar operator[] (unsigned long idx) const {return getChar (static_cast<uint32>(idx));}
inline tchar operator[] (unsigned long idx) const {return getChar (static_cast<uint32> (idx));}
inline tchar operator[] (unsigned int idx) const {return getChar (idx);}

inline virtual const char8* text8 () const; ///< Returns pointer to string of type char8
@@ -278,7 +278,7 @@ public:

bool isNormalized (UnicodeNormalization = kUnicodeNormC); ///< On PC only kUnicodeNormC is working

#if MAC
#if SMTG_OS_MACOS
virtual void* toCFStringRef (uint32 encoding = 0xFFFF, bool mutableCFString = false) const; ///< CFString conversion
#endif
//-------------------------------------------------------------------------
@@ -447,7 +447,7 @@ public:
void fromUTF8 (const char8* utf8String); ///< Assigns from UTF8 string
bool normalize (UnicodeNormalization = kUnicodeNormC); ///< On PC only kUnicodeNormC is working

#if MAC
#if SMTG_OS_MACOS
virtual bool fromCFStringRef (const void*, uint32 encoding = 0xFFFF); ///< CFString conversion
#endif
//-------------------------------------------------------------------------
@@ -533,7 +533,7 @@ inline tchar ConstString::getCharAt (uint32 index) const
return getChar16 (index);
#endif

return getChar8 (index);
return static_cast<tchar> (getChar8 (index));
}

//-----------------------------------------------------------------------------


+ 0
- 130
source/includes/vst3sdk/base/source/hexbinary.h View File

@@ -1,130 +0,0 @@
//-------------------------------------------------------------------------------------
// Project : SDK Base
// Version : 1.0
//
// Category : Helpers
// Filename : base/source/hexbinary.h
// Created by : Steinberg, 1/2012
// Description : HexBinary encoding and decoding
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

//----------------------------------------------------------------------------------
/** @file base/source/hexbinary.h
HexBinary encoding and decoding. */
//----------------------------------------------------------------------------------
#pragma once

#include "base/source/fbuffer.h"

namespace Steinberg {

//------------------------------------------------------------------------------
namespace HexBinary
{
//------------------------------------------------------------------------------
/** convert the HexBinary input buffer to binary. Note that it is appended to the result buffer. */
//------------------------------------------------------------------------------
inline bool decode (const void* input, int32 inputSize, Buffer& result)
{
if ((inputSize & 1) == 1)
return false;

result.grow (result.getSize () + inputSize / 2);

const char8* ptr = (const char8*)input;
uint8 current = 0;
for (int32 i = 0; i < inputSize; i++, ptr++)
{
current *= 16;
if (*ptr >= 48 && *ptr <= 57) // 0, 1, 2, .., 9
{
current += *ptr - 48;
}
else if (*ptr >= 65 && *ptr <= 70) // A, B, .., F
{
current += *ptr - 55;
}
else if (*ptr >= 97 && *ptr <= 102) // a, b, .., f
{
current += *ptr - 87;
}
else
{
// malformed
return false;
}
if (i % 2)
{
if (result.put (current) == false)
return false;
current = 0;
}
}
return true;
}

//------------------------------------------------------------------------------
/** convert the binary input buffer to HexBinary. Note that it is appended to the result buffer. */
//------------------------------------------------------------------------------
inline bool encode (const void* input, int32 inputSize, Buffer& result)
{
result.grow (result.getSize () + inputSize * 2);

const char8* ptr = (const char8*)input;
for (int32 i = 0; i < inputSize; i++, ptr++)
{
char8 high = (*ptr & 0xF0) >> 4;
char8 low = (*ptr & 0x0F);
if (high > 9)
{
if (result.put ((char8)(high + 55)) == false)
return false;
}
else
{
if (result.put ((char8)(high + 48)) == false)
return false;
}
if (low > 9)
{
if (result.put ((char8)(low + 55)) == false)
return false;
}
else
{
if (result.put ((char8)(low + 48)) == false)
return false;
}
}
return true;
}
//------------------------------------------------------------------------
} // namespace HexBinary
} // namespace Steinberg

+ 0
- 329
source/includes/vst3sdk/base/source/timer.cpp View File

@@ -1,329 +0,0 @@
//------------------------------------------------------------------------
// Project : SDK Base
// Version : 1.0
//
// Category : Helpers
// Filename : base/source/timer.cpp
// Created by : Steinberg, 05/2006
// Description : Timer class for receiving triggers at regular intervals
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#include "base/source/timer.h"

namespace Steinberg {
static bool timersEnabled = true;

//------------------------------------------------------------------------
DisableDispatchingTimers::DisableDispatchingTimers ()
{
oldState = timersEnabled;
timersEnabled = false;
}

//------------------------------------------------------------------------
DisableDispatchingTimers::~DisableDispatchingTimers ()
{
timersEnabled = oldState;
}

//------------------------------------------------------------------------
namespace SystemTime {

//------------------------------------------------------------------------
struct ZeroStartTicks
{
static const uint64 startTicks;

static int32 getTicks32 ()
{
return static_cast<int32> (SystemTime::getTicks64 () - startTicks);
}
};
const uint64 ZeroStartTicks::startTicks = SystemTime::getTicks64 ();

//------------------------------------------------------------------------
int32 getTicks ()
{
return ZeroStartTicks::getTicks32 ();
}

//------------------------------------------------------------------------
} // namespace SystemTime
} // namespace Steinberg


#if MAC
#include <CoreFoundation/CoreFoundation.h>
#include <mach/mach_time.h>

#ifdef verify
#undef verify
#endif

namespace Steinberg {

namespace SystemTime {
struct MachTimeBase {
private:
struct mach_timebase_info timebaseInfo;

MachTimeBase ()
{
mach_timebase_info (&timebaseInfo);
}

static const MachTimeBase& instance ()
{
static MachTimeBase gInstance;
return gInstance;
}
public:
static double getTimeNanos ()
{
const MachTimeBase& timeBase = instance ();
double absTime = static_cast<double> (mach_absolute_time ());
double d = (absTime / timeBase.timebaseInfo.denom) * timeBase.timebaseInfo.numer; // nano seconds
return d;
}
};

//------------------------------------------------------------------------
uint64 getTicks64 ()
{
return static_cast<uint64> (MachTimeBase::getTimeNanos () / 1000000.);
}
} // namespace SystemTime

//------------------------------------------------------------------------
class MacPlatformTimer : public Timer
{
public:
MacPlatformTimer (ITimerCallback* callback, uint32 milliseconds);
~MacPlatformTimer ();

void stop ();
bool verify () const { return platformTimer != 0; }

static void timerCallback (CFRunLoopTimerRef timer, void *info);
protected:
CFRunLoopTimerRef platformTimer;
ITimerCallback* callback;
};

//------------------------------------------------------------------------
MacPlatformTimer::MacPlatformTimer (ITimerCallback* callback, uint32 milliseconds)
: platformTimer (0)
, callback (callback)
{
if (callback)
{
CFRunLoopTimerContext timerContext = {0};
timerContext.info = this;
platformTimer = CFRunLoopTimerCreate (kCFAllocatorDefault, CFAbsoluteTimeGetCurrent () + milliseconds * 0.001, milliseconds * 0.001f, 0, 0, timerCallback, &timerContext);
if (platformTimer)
CFRunLoopAddTimer (CFRunLoopGetMain (), platformTimer, kCFRunLoopCommonModes);
}
}

//------------------------------------------------------------------------
MacPlatformTimer::~MacPlatformTimer ()
{
stop ();
}

//------------------------------------------------------------------------
void MacPlatformTimer::stop ()
{
if (platformTimer)
{
CFRunLoopRemoveTimer (CFRunLoopGetMain (), platformTimer, kCFRunLoopCommonModes);
CFRelease (platformTimer);
platformTimer = 0;
}
}

//------------------------------------------------------------------------
void MacPlatformTimer::timerCallback (CFRunLoopTimerRef , void *info)
{
if (timersEnabled)
{
MacPlatformTimer* timer = (MacPlatformTimer*)info;
if (timer)
{
timer->callback->onTimer (timer);
}
}
}

//------------------------------------------------------------------------
Timer* Timer::create (ITimerCallback* callback, uint32 milliseconds)
{
MacPlatformTimer* timer = NEW MacPlatformTimer (callback, milliseconds);
if (timer->verify ())
return timer;
timer->release ();
return 0;
}

}

#elif WINDOWS

#include <windows.h>
#include <list>
#include <algorithm>

namespace Steinberg {
namespace SystemTime {
/*
@return the current system time in milliseconds
*/
uint64 getTicks64 ()
{
return GetTickCount64 ();
}
}

class WinPlatformTimer;
typedef std::list<WinPlatformTimer*> WinPlatformTimerList;

//------------------------------------------------------------------------
// WinPlatformTimer
//------------------------------------------------------------------------
class WinPlatformTimer : public Timer
{
public:
//------------------------------------------------------------------------
WinPlatformTimer (ITimerCallback* callback, uint32 milliseconds);
~WinPlatformTimer ();

void stop ();
bool verify () const {return id != 0;}

//------------------------------------------------------------------------
private:
UINT_PTR id;
ITimerCallback* callback;

static void addTimer (WinPlatformTimer* t);
static void removeTimer (WinPlatformTimer* t);

static void CALLBACK TimerProc (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
static WinPlatformTimerList* timers;
};

//------------------------------------------------------------------------
WinPlatformTimerList* WinPlatformTimer::timers = 0;

//------------------------------------------------------------------------
WinPlatformTimer::WinPlatformTimer (ITimerCallback* callback, uint32 milliseconds)
: callback (callback)
{
id = SetTimer (0, 0, milliseconds, TimerProc);
if (id)
addTimer (this);
}

//------------------------------------------------------------------------
WinPlatformTimer::~WinPlatformTimer ()
{
stop ();
}

//------------------------------------------------------------------------
void WinPlatformTimer::addTimer (WinPlatformTimer* t)
{
if (timers == 0)
timers = NEW WinPlatformTimerList;
timers->push_back (t);
}

//------------------------------------------------------------------------
void WinPlatformTimer::removeTimer (WinPlatformTimer* t)
{
if (!timers)
return;

WinPlatformTimerList::iterator it = std::find (timers->begin (), timers->end (), t);
if (it != timers->end ())
timers->erase (it);
if (timers->empty ())
{
delete timers;
timers = 0;
}
}

//------------------------------------------------------------------------
void WinPlatformTimer::stop ()
{
if (!id)
return;

KillTimer (0, id);
removeTimer (this);
id = 0;
}

//------------------------------------------------------------------------
void CALLBACK WinPlatformTimer::TimerProc (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
if (timersEnabled && timers)
{
WinPlatformTimerList::const_iterator it = timers->cbegin ();
while (it != timers->cend ())
{
WinPlatformTimer* timer = *it;
if (timer->id == idEvent)
{
if (timer->callback)
timer->callback->onTimer (timer);
return;
}
}
}
}

//------------------------------------------------------------------------
Timer* Timer::create (ITimerCallback* callback, uint32 milliseconds)
{
WinPlatformTimer* platformTimer = NEW WinPlatformTimer (callback, milliseconds);
if (platformTimer->verify ())
return platformTimer;
platformTimer->release ();
return 0;
}

//------------------------------------------------------------------------
} // namespace Steinberg

#elif LINUX
#warning DEPRECATED No Linux implementation
#endif

+ 0
- 165
source/includes/vst3sdk/base/source/timer.h View File

@@ -1,165 +0,0 @@
//------------------------------------------------------------------------
// Project : SDK Base
// Version : 1.0
//
// Category : Helpers
// Filename : base/source/timer.h
// Created by : Steinberg, 05/2006
// Description : Timer class for receiving tiggers at regular intervals
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#pragma once

#include "fobject.h"
#include <limits>

namespace Steinberg {
class Timer;

//------------------------------------------------------------------------
namespace SystemTime {

uint64 getTicks64 ();

inline uint64 getTicksDuration (uint64 old, uint64 now)
{
if (old > now)
return (std::numeric_limits<uint64>::max) () - old + now;
return now - old;
}

int32 getTicks (); ///< deprecated, use getTicks64 ()

//------------------------------------------------------------------------
} // SystemTime

//------------------------------------------------------------------------
/** @class ITimerCallback

Implement this callback interface to receive triggers from a timer.
Note: This interface is intended as a mix-in class and therefore does not provide refcounting.

@see Timer */
//------------------------------------------------------------------------
class ITimerCallback
{
public:
virtual ~ITimerCallback () {}
/** This method is called at the end of each interval.

\param timer The timer which calls.
*/
virtual void onTimer (Timer* timer) = 0;
};

template <typename Call>
ITimerCallback* newTimerCallback (const Call& call)
{
struct Callback : public ITimerCallback
{
Callback (const Call& call) : call (call) {}
void onTimer (Timer* timer) SMTG_OVERRIDE { call (timer); }
Call call;
};
return NEW Callback (call);
}

// -----------------------------------------------------------------
/** @class Timer

Timer is a class that allows you to receive triggers at regular intervals.

Note: The timer class is an abstract base class with (hidden) platform specific subclasses.



Usage:
@code
class TimerReceiver : public FObject, public ITimerCallback
{
...
virtual void onTimer (Timer* timer)
{
// do stuff
}
...
};

TimerReceiver* receiver = new TimerReceiver ();
Timer* myTimer = Timer::create (receiver, 100); // interval: every 100ms

...
...

if (myTimer)
myTimer->release ();
if (receiver)
receiver->release ();
@endcode

@see ITimerCallback
*/
// -----------------------------------------------------------------
class Timer : public FObject
{
public:
/** Create a timer with a given interval
\param callback The receiver of the timer calls.
\param intervalMilliseconds The timer interval in milliseconds.
\return The created timer if any, callers owns the timer. The timer starts immediately.
*/
static Timer* create (ITimerCallback* callback, uint32 intervalMilliseconds);

virtual void stop () = 0; ///< Stop the timer.
};

// -----------------------------------------------------------------
/** @class DisableDispatchingTimers

Disables dispatching of timers for the live time of this object

*/
// -----------------------------------------------------------------
class DisableDispatchingTimers
{
public:
DisableDispatchingTimers ();
~DisableDispatchingTimers ();

private:
bool oldState;
};

//------------------------------------------------------------------------
} // namespace Steinberg

+ 87
- 33
source/includes/vst3sdk/base/source/updatehandler.cpp View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -39,16 +39,24 @@
#include "base/source/classfactoryhelpers.h"
#include "base/source/fstring.h"

#include <list>
#if SMTG_CPP11_STDLIBSUPPORT
#include <unordered_map>
#else
#include <map>
#endif
#include <deque>
#include <vector>
#include <algorithm>

#define NON_EXISTING_DEPENDENCY_CHECK 0 // not now, mm
#define NON_EXISTING_DEPENDENCY_CHECK 0 // not yet
#define CLASS_NAME_TRACKED DEVELOPMENT

using Steinberg::Base::Thread::FGuard;

namespace Steinberg {

DEF_CLASS_IID (IUpdateManager)
bool UpdateHandler::lockUpdates = false;

namespace Update {
const uint32 kHashSize = (1 << 8); // must be power of 2 (16 bytes * 256 == 4096)
@@ -57,13 +65,13 @@ const uint32 kMapSize = 1024 * 10;
//------------------------------------------------------------------------
inline uint32 hashPointer (void* p)
{
return (uint32) ((uint64 (p) >> 12) & (kHashSize - 1));
return (uint32)((uint64 (p) >> 12) & (kHashSize - 1));
}

//------------------------------------------------------------------------
inline IPtr<FUnknown> getUnknownBase (FUnknown* unknown)
{
FUnknown* result = 0;
FUnknown* result = nullptr;
if (unknown)
unknown->queryInterface (FUnknown::iid, (void**)&result);

@@ -74,7 +82,8 @@ inline IPtr<FUnknown> getUnknownBase (FUnknown* unknown)
//------------------------------------------------------------------------
struct Dependency
{
Dependency (FUnknown* o = 0, IDependent* d = 0) : obj (o), dep (d), objClass (0), depClass (0)
Dependency (FUnknown* o, IDependent* d)
: obj (o), dep (d), objClass (nullptr), depClass (nullptr)
{
}

@@ -93,7 +102,7 @@ struct Dependency
//------------------------------------------------------------------------
struct DeferedChange
{
DeferedChange (FUnknown* o = 0, int32 m = 0) : obj (o), msg (m) {}
DeferedChange (FUnknown* o, int32 m = 0) : obj (o), msg (m) {}
~DeferedChange () {}
DeferedChange (const DeferedChange& r) : obj (r.obj), msg (r.msg) {}
inline bool operator== (const DeferedChange& d) const { return obj == d.obj; }
@@ -105,7 +114,7 @@ struct DeferedChange
//------------------------------------------------------------------------
struct UpdateData
{
UpdateData (FUnknown* o = 0, IDependent** d = 0, uint32 c = 0)
UpdateData (FUnknown* o, IDependent** d, uint32 c)
: obj (o), dependents (d), count (c)
{
}
@@ -119,21 +128,26 @@ struct UpdateData
};

//------------------------------------------------------------------------
typedef std::list<DeferedChange> DeferedChangeList;
typedef std::deque<DeferedChange> DeferedChangeList;
typedef DeferedChangeList::const_iterator DeferedChangeListIterConst;
typedef DeferedChangeList::iterator DeferedChangeListIter;

typedef std::list<UpdateData> UpdateDataList;
typedef std::deque<UpdateData> UpdateDataList;
typedef UpdateDataList::const_iterator UpdateDataListIterConst;

#if CLASS_NAME_TRACKED
typedef std::list<Dependency> DependentList;
typedef std::vector<Dependency> DependentList;
#else
typedef std::list<IDependent*> DependentList;
typedef std::vector<IDependent*> DependentList;
#endif
typedef DependentList::iterator DependentListIter;
typedef DependentList::const_iterator DependentListIterConst;

#if SMTG_CPP11_STDLIBSUPPORT
typedef std::unordered_map<const FUnknown*, DependentList> DependentMap;
#else
typedef std::map<const FUnknown*, DependentList> DependentMap;
#endif
typedef DependentMap::iterator DependentMapIter;
typedef DependentMap::const_iterator DependentMapIterConst;

@@ -154,10 +168,7 @@ void updateDone (FUnknown* unknown, int32 message)
obj->updateDone (message);
}
}
}

//------------------------------------------------------------------------
SINGLE_CREATE_FUNC (UpdateHandler)
} // namespace Update

//------------------------------------------------------------------------
static int32 countEntries (Update::DependentMap& map)
@@ -179,10 +190,10 @@ static int32 countEntries (Update::DependentMap& map)
}

//------------------------------------------------------------------------
UpdateHandler::UpdateHandler () : table (0)
UpdateHandler::UpdateHandler ()
{
table = NEW Update::Table;
if (FObject::getUpdateHandler () == 0)
if (FObject::getUpdateHandler () == nullptr)
FObject::setUpdateHandler (this);
}

@@ -190,9 +201,9 @@ UpdateHandler::UpdateHandler () : table (0)
UpdateHandler::~UpdateHandler ()
{
if (FObject::getUpdateHandler () == this)
FObject::setUpdateHandler (0);
FObject::setUpdateHandler (nullptr);
delete table;
table = 0;
table = nullptr;
}

//------------------------------------------------------------------------
@@ -223,7 +234,7 @@ tresult PLUGIN_API UpdateHandler::addDependent (FUnknown* u, IDependent* _depend
{
Update::DependentList list;
list.push_back (dependent);
map[u] = list;
map[unknown] = list;
}
else
{
@@ -237,7 +248,7 @@ tresult PLUGIN_API UpdateHandler::addDependent (FUnknown* u, IDependent* _depend
tresult PLUGIN_API UpdateHandler::removeDependent (FUnknown* u, IDependent* dependent)
{
IPtr<FUnknown> unknown = Update::getUnknownBase (u);
if (unknown == 0 && dependent == 0)
if (unknown == nullptr && dependent == nullptr)
return kResultFalse;

FGuard guard (lock);
@@ -245,7 +256,7 @@ tresult PLUGIN_API UpdateHandler::removeDependent (FUnknown* u, IDependent* depe
Update::UpdateDataListIterConst iter = table->updateData.begin ();
while (iter != table->updateData.end ())
{
if ((*iter).obj == unknown || unknown == 0)
if ((*iter).obj == unknown || unknown == nullptr)
{
for (uint32 count = 0; count < (*iter).count; count++)
{
@@ -256,7 +267,7 @@ tresult PLUGIN_API UpdateHandler::removeDependent (FUnknown* u, IDependent* depe
++iter;
}
// Remove all objects for the given dependent
if (unknown == 0)
if (unknown == nullptr)
{
for (uint32 j = 0; j < Update::kHashSize; j++)
{
@@ -268,10 +279,18 @@ tresult PLUGIN_API UpdateHandler::removeDependent (FUnknown* u, IDependent* depe
Update::DependentListIter iterList = list.begin ();
while (iterList != list.end ())
{
#if CLASS_NAME_TRACKED
if ((*iterList).dep == dependent)
#else
if ((*iterList) == dependent)
list.erase (iterList++);
#endif
{
iterList = list.erase (iterList);
}
else
{
++iterList;
}
}
++iterMap;
}
@@ -285,11 +304,11 @@ tresult PLUGIN_API UpdateHandler::removeDependent (FUnknown* u, IDependent* depe
Update::DependentMapIter iterList = map.find (unknown);

#if NON_EXISTING_DEPENDENCY_CHECK
ASSERT (iterList != map.end () && "ERROR: Trying to remove a non existing dependency!")
SMTG_ASSERT (iterList != map.end () && "ERROR: Trying to remove a non existing dependency!")
#endif
if (iterList != map.end ())
{
if (dependent == 0) // Remove all dependents of object
if (dependent == nullptr) // Remove all dependents of object
{
map.erase (iterList);
}
@@ -306,7 +325,7 @@ tresult PLUGIN_API UpdateHandler::removeDependent (FUnknown* u, IDependent* depe
if ((*iterDependentlist) == dependent)
#endif
{
dependentlist.erase (iterDependentlist++);
iterDependentlist = dependentlist.erase (iterDependentlist);
eraseCount++;
if (dependentlist.empty ())
{
@@ -332,6 +351,8 @@ tresult PLUGIN_API UpdateHandler::removeDependent (FUnknown* u, IDependent* depe
//------------------------------------------------------------------------
tresult UpdateHandler::doTriggerUpdates (FUnknown* u, int32 message, bool suppressUpdateDone)
{
if (lockUpdates)
return kResultFalse;
IPtr<FUnknown> unknown = Update::getUnknownBase (u);
if (!unknown)
return kResultFalse;
@@ -365,13 +386,13 @@ tresult UpdateHandler::doTriggerUpdates (FUnknown* u, int32 message, bool suppre
{
if (dependents == smallDependents)
{
dependents = new IDependent*[Update::kMapSize];
dependents = NEW IDependent*[Update::kMapSize];
memcpy (dependents, smallDependents, count * sizeof (dependents[0]));
maxDependents = Update::kMapSize;
}
else
{
WARNING ("Dependency overflow")
SMTG_WARNING ("Dependency overflow")
break;
}
}
@@ -507,7 +528,7 @@ tresult PLUGIN_API UpdateHandler::triggerDeferedUpdates (FUnknown* unknown)
while (true)
{
lock.lock ();
Update::DeferedChangeListIterConst it =
Update::DeferedChangeListIter it =
std::find (table->defered.begin (), table->defered.end (), tmp);
if (it == table->defered.end ())
{
@@ -515,7 +536,7 @@ tresult PLUGIN_API UpdateHandler::triggerDeferedUpdates (FUnknown* unknown)
return kResultTrue;
}

if ((*it).obj != 0)
if ((*it).obj != nullptr)
{
int32 msg = (*it).msg;
table->defered.erase (it);
@@ -573,11 +594,43 @@ tresult PLUGIN_API UpdateHandler::cancelUpdates (FUnknown* u)
FGuard guard (lock);

Update::DeferedChange change (unknown, 0);
table->defered.remove (change);
while (1)
{
auto iter = std::find (table->defered.begin (), table->defered.end (), change);
if (iter != table->defered.end ())
table->defered.erase (iter);
else
break;
}

return kResultTrue;
}

//------------------------------------------------------------------------
size_t UpdateHandler::countDependencies (FUnknown* object)
{
FGuard guard (lock);
uint32 res = 0;

IPtr<FUnknown> unknown = Update::getUnknownBase (object);
if (unknown)
{
Update::DependentMap& map = table->depMap[Update::hashPointer (unknown)];
Update::DependentMapIter iterList = map.find (unknown);
if (iterList != map.end ())
return iterList->second.size ();
}
else
{
for (uint32 j = 0; j < Update::kHashSize; j++)
{
Update::DependentMap& map = table->depMap[j];
res += countEntries (map);
}
}
return res;
}

#if DEVELOPMENT
//------------------------------------------------------------------------
bool UpdateHandler::checkDeferred (FUnknown* object)
@@ -656,6 +709,7 @@ void UpdateHandler::printForObject (FObject* obj) const
(uint64) (*iterDependentlist), (uint64) ((*iterList).first));
}
#endif
++iterDependentlist;
}

++iterList;


+ 14
- 6
source/includes/vst3sdk/base/source/updatehandler.h View File

@@ -9,7 +9,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -38,7 +38,7 @@
#pragma once

#include "base/source/fobject.h"
#include "base/source/flock.h"
#include "base/thread/include/flock.h"
#include "pluginterfaces/base/iupdatehandler.h"

namespace Steinberg {
@@ -80,6 +80,10 @@ public:
UpdateHandler ();
~UpdateHandler ();

using FObject::addDependent;
using FObject::removeDependent;
using FObject::deferUpdate;

// IUpdateHandler
/** register \param dependent to get messages from \param object */
virtual tresult PLUGIN_API addDependent (FUnknown* object, IDependent* dependent) SMTG_OVERRIDE;
@@ -99,7 +103,7 @@ public:

/// @cond ignore
// obsolete functions kept for compatibility
void checkUpdates (FObject* object = 0) { triggerDeferedUpdates (object->unknownCast ()); }
void checkUpdates (FObject* object = nullptr) { triggerDeferedUpdates (object->unknownCast ()); }
void flushUpdates (FObject* object) { cancelUpdates (object->unknownCast ()); }
void deferUpdate (FObject* object, int32 message)
{
@@ -115,7 +119,8 @@ public:
void printForObject (FObject* object) const;
#endif
/// @endcond

size_t countDependencies (FUnknown* object = nullptr);
OBJ_METHODS (UpdateHandler, FObject)
FUNKNOWN_METHODS2 (IUpdateHandler, IUpdateManager, FObject)
SINGLETON (UpdateHandler)
@@ -123,9 +128,12 @@ public:
private:
tresult doTriggerUpdates (FUnknown* object, int32 message, bool suppressUpdateDone);

FLock lock;
Update::Table* table;
Steinberg::Base::Thread::FLock lock;
Update::Table* table = nullptr;
friend struct LockUpdateDependencies;
static bool lockUpdates;
};


//------------------------------------------------------------------------
} // namespace Steinberg

source/includes/vst3sdk/base/source/flock.h → source/includes/vst3sdk/base/thread/include/flock.h View File

@@ -3,13 +3,13 @@
// Version : 1.0
//
// Category : Helpers
// Filename : base/source/flock.h
// Filename : base/thread/include/flock.h
// Created by : Steinberg, 1995
// Description : locks
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -36,19 +36,19 @@
//-----------------------------------------------------------------------------

//----------------------------------------------------------------------------------
/** @file base/source/flock.h
Locks. */
/** @file base/thread/include/flock.h
Locks. */
/** @defgroup baseLocks Locks */
//----------------------------------------------------------------------------------
#pragma once

#include "fobject.h"
#include "base/source/fobject.h"
#include "pluginterfaces/base/ftypes.h"

#if PTHREADS
#if SMTG_PTHREADS
#include <pthread.h>

#elif WINDOWS
#elif SMTG_OS_WINDOWS
struct CRITSECT // CRITICAL_SECTION
{
void* DebugInfo; // PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
@@ -60,8 +60,9 @@ struct CRITSECT // CRITICAL_SECTION
};
#endif

//------------------------------------------------------------------------
namespace Steinberg {
namespace Base {
namespace Thread {

//------------------------------------------------------------------------
/** Lock interface declaration.
@@ -72,18 +73,14 @@ struct ILock
//------------------------------------------------------------------------
virtual ~ILock () {}

/** Enables lock.
*/
/** Enables lock. */
virtual void lock () = 0;

/** Disables lock.
*/
/** Disables lock. */
virtual void unlock () = 0;

/** Tries to disable lock.
*/
/** Tries to disable lock. */
virtual bool trylock () = 0;

//------------------------------------------------------------------------
};

@@ -101,24 +98,21 @@ public:
*/
FLock (const char8* name = "FLock");

/** Lock destructor.
*/
/** Lock destructor. */
~FLock ();

//-- ILock -----------------------------------------------------------
virtual void lock () SMTG_OVERRIDE;
virtual void unlock () SMTG_OVERRIDE;
virtual bool trylock () SMTG_OVERRIDE;
//--------------------------------------------------------------------

//------------------------------------------------------------------------
protected:
#if PTHREADS
pthread_mutex_t mutex; ///< Mutex object
#elif WINDOWS
CRITSECT section; ///< Critical section object
#if SMTG_PTHREADS
pthread_mutex_t mutex; ///< Mutex object

#elif SMTG_OS_WINDOWS
CRITSECT section; ///< Critical section object
#endif
};

@@ -144,20 +138,18 @@ public:
/** FGuard constructor.
* @param _lock guard this lock
*/
FGuard (ILock& _lock) : lock (_lock) {lock.lock ();}
FGuard (ILock& _lock) : lock (_lock) { lock.lock (); }

/** FGuard destructor.
*/
~FGuard () {lock.unlock ();}
/** FGuard destructor. */
~FGuard () { lock.unlock (); }

//------------------------------------------------------------------------
private:
ILock& lock; ///< guarded lock
ILock& lock; ///< guarded lock
};


//------------------------------------------------------------------------
/** Conditional Guard - Locks only if valid lock is passed.
/** Conditional Guard - Locks only if valid lock is passed.
@ingroup baseLocks */
//------------------------------------------------------------------------
class FConditionalGuard
@@ -168,16 +160,24 @@ public:
/** FConditionGuard constructor.
* @param _lock guard this lock
*/
FConditionalGuard (FLock* _lock) : lock (_lock) { if (lock) lock->lock (); }
FConditionalGuard (FLock* _lock) : lock (_lock)
{
if (lock)
lock->lock ();
}

/** FConditionGuard destructor.
*/
~FConditionalGuard () { if (lock) lock->unlock (); }
/** FConditionGuard destructor. */
~FConditionalGuard ()
{
if (lock)
lock->unlock ();
}

//------------------------------------------------------------------------
private:
FLock* lock; ///< guarded lock
FLock* lock; ///< guarded lock
};

//------------------------------------------------------------------------
} // namespace Steinberg
} // Thread
} // Base
} // Steinberg

source/includes/vst3sdk/base/source/flock.cpp → source/includes/vst3sdk/base/thread/source/flock.cpp View File

@@ -3,13 +3,13 @@
// Version : 1.0
//
// Category : Helpers
// Filename : base/source/flock.cpp
// Filename : base/thread/source/flock.cpp
// Created by : Steinberg, 1995
// Description : Locks
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -37,11 +37,11 @@

#define DEBUG_LOCK 0

#include "base/source/flock.h"
#include "base/thread/include/flock.h"
#include "base/source/fdebug.h"

//------------------------------------------------------------------------
#if WINDOWS
#if SMTG_OS_WINDOWS
//------------------------------------------------------------------------
#ifndef WINVER
#define WINVER 0x0500
@@ -57,23 +57,25 @@

#endif

//------------------------------------------------------------------------
namespace Steinberg {
namespace Base {
namespace Thread {


//------------------------------------------------------------------------
// FLock implementation
//------------------------------------------------------------------------
FLock::FLock (const char8* name)
FLock::FLock (const char8* /*name*/)
{
#if PTHREADS
#if SMTG_PTHREADS
pthread_mutexattr_t mutexAttr;
pthread_mutexattr_init (&mutexAttr);
pthread_mutexattr_settype (&mutexAttr, PTHREAD_MUTEX_RECURSIVE);
if (pthread_mutex_init (&mutex, &mutexAttr) != 0)
{WARNING("mutex_init failed")}
{SMTG_WARNING("mutex_init failed")}
pthread_mutexattr_destroy (&mutexAttr);

#elif WINDOWS
#elif SMTG_OS_WINDOWS
INIT_CS (section)
#else
#warning implement FLock!
@@ -83,10 +85,10 @@ FLock::FLock (const char8* name)
//------------------------------------------------------------------------
FLock::~FLock ()
{
#if PTHREADS
#if SMTG_PTHREADS
pthread_mutex_destroy (&mutex);

#elif WINDOWS
#elif SMTG_OS_WINDOWS
DeleteCriticalSection ((LPCRITICAL_SECTION)&section);
#endif
@@ -99,10 +101,10 @@ void FLock::lock ()
FDebugPrint ("FLock::lock () %x\n", this);
#endif

#if PTHREADS
#if SMTG_PTHREADS
pthread_mutex_lock (&mutex);

#elif WINDOWS
#elif SMTG_OS_WINDOWS
EnterCriticalSection ((LPCRITICAL_SECTION)&section);

#endif
@@ -115,10 +117,10 @@ void FLock::unlock ()
FDebugPrint ("FLock::unlock () %x\n", this);
#endif
#if PTHREADS
#if SMTG_PTHREADS
pthread_mutex_unlock (&mutex);

#elif WINDOWS
#elif SMTG_OS_WINDOWS
LeaveCriticalSection ((LPCRITICAL_SECTION)&section);

#endif
@@ -127,10 +129,10 @@ void FLock::unlock ()
//------------------------------------------------------------------------
bool FLock::trylock ()
{
#if PTHREADS
#if SMTG_PTHREADS
return pthread_mutex_trylock (&mutex) == 0;

#elif WINDOWS
#elif SMTG_OS_WINDOWS
return TryEnterCriticalSection ((LPCRITICAL_SECTION)&section) != 0 ? true : false;

#else
@@ -138,5 +140,7 @@ bool FLock::trylock ()
#endif
}

//------------------------------------------------------------------------
} // namespace Steinberg
} // Thread
} // Base
} // Steinberg


+ 1
- 1
source/includes/vst3sdk/pluginterfaces/LICENSE.txt View File

@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
This license applies only to files referencing this license,
for other files of the Software Development Kit the respective embedded license text


+ 7
- 0
source/includes/vst3sdk/pluginterfaces/README.md View File

@@ -0,0 +1,7 @@
# Welcome to VST SDK 3 Interfaces
Here are located all VST interfaces definitions (including VST Component/Controller, UI, Test).
## License & Usage guidelines
More details are found at [www.steinberg.net/sdklicenses_vst3](http://www.steinberg.net/sdklicenses_vst3)

+ 40
- 0
source/includes/vst3sdk/pluginterfaces/base/coreiids.cpp View File

@@ -0,0 +1,40 @@
//-----------------------------------------------------------------------------
// Project : SDK Core
//
// Category : SDK Core Interface IID definitions
// Filename : pluginterfaces/base/coreiids.cpp
// Created by : Steinberg, 01/2004
// Description : Basic Interface
//
//------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//------------------------------------------------------------------------

#include "pluginterfaces/base/funknown.h"
#include "pluginterfaces/base/ibstream.h"
#include "pluginterfaces/base/icloneable.h"
#include "pluginterfaces/base/ipluginbase.h"
#include "pluginterfaces/base/iupdatehandler.h"

//------------------------------------------------------------------------
namespace Steinberg {
DEF_CLASS_IID (IPluginBase)
DEF_CLASS_IID (IPluginFactory)
DEF_CLASS_IID (IPluginFactory2)
DEF_CLASS_IID (IPluginFactory3)

DEF_CLASS_IID (FUnknown)

DEF_CLASS_IID (ICloneable)

DEF_CLASS_IID (IDependent)
DEF_CLASS_IID (IUpdateHandler)

DEF_CLASS_IID (IBStream)
DEF_CLASS_IID (ISizeableStream)

//------------------------------------------------------------------------
} // Steinberg

+ 3
- 7
source/includes/vst3sdk/pluginterfaces/base/falignpop.h View File

@@ -15,15 +15,11 @@
//-----------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------
#if TARGET_API_MAC_CARBON
#if PLATFORM_64
#pragma pack(pop)
#else
#pragma options align=reset
#endif
#if SMTG_OS_MACOS
#pragma pack(pop)
#elif defined __BORLANDC__
#pragma -a-
#elif WINDOWS
#elif SMTG_OS_WINDOWS
#pragma pack(pop)
#endif
//---------------------------------------------------------------------------------------------------

+ 9
- 5
source/includes/vst3sdk/pluginterfaces/base/falignpush.h View File

@@ -15,17 +15,21 @@
//-----------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------
#if TARGET_API_MAC_CARBON
#if PLATFORM_64
#if SMTG_OS_MACOS
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-warning-option"
#pragma GCC diagnostic ignored "-Wpragma-pack"
#if SMTG_PLATFORM_64
#pragma pack(push, 16)
#else
#pragma options align=mac68k
#pragma pack(push, 1)
#endif
#pragma GCC diagnostic pop
#elif defined __BORLANDC__
#pragma -a8
#elif WINDOWS
#elif SMTG_OS_WINDOWS
#pragma pack(push)
#if PLATFORM_64
#if SMTG_PLATFORM_64
#pragma pack(16)
#else
#pragma pack(8)


+ 107
- 25
source/includes/vst3sdk/pluginterfaces/base/fplatform.h View File

@@ -16,21 +16,44 @@

#pragma once

#define kLittleEndian 0
#define kBigEndian 1
#define kLittleEndian 0
#define kBigEndian 1

#undef PLUGIN_API

#undef WINDOWS
#undef MAC
#if !defined (__INTEL_CXX11_MODE__)
#define SMTG_INTEL_CXX11_MODE 0
#else
#define SMTG_INTEL_CXX11_MODE __INTEL_CXX11_MODE__
#endif

#if !defined (__INTEL_COMPILER)
#define SMTG_INTEL_COMPILER 0
#else
#define SMTG_INTEL_COMPILER __INTEL_COMPILER
#endif

//-----------------------------------------------------------------------------
// WIN32 AND WIN64
// WIN32 AND WIN64 (WINDOWS)
//-----------------------------------------------------------------------------
#if defined (_WIN32)
#define WINDOWS 1
//-----------------------------------------------------------------------------
// ARM32 AND ARM64 (WINDOWS)
#if (defined(_M_ARM64) || defined(_M_ARM))
#define SMTG_OS_WINDOWS_ARM 1
#endif

#define SMTG_OS_LINUX 0
#define SMTG_OS_MACOS 0
#define SMTG_OS_WINDOWS 1
#define SMTG_OS_IOS 0
#define SMTG_OS_OSX 0

#define BYTEORDER kLittleEndian
#define COM_COMPATIBLE 1
#define COM_COMPATIBLE 1
#define PLUGIN_API __stdcall
#define SMTG_PTHREADS 0

#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
@@ -43,32 +66,48 @@
#pragma warning (3 : 4189) // local variable is initialized but not referenced
#pragma warning (3 : 4238) // nonstandard extension used : class rvalue used as lvalue

#if defined (_WIN64) // WIN64 only
#define PLATFORM_64 1
#if defined (_WIN64) || defined (_M_ARM64)
#define SMTG_PLATFORM_64 1
#else
#define SMTG_PLATFORM_64 0
#endif

#ifndef WIN32
#define WIN32 1
#endif

#ifdef __cplusplus
#define SMTG_CPP11 __cplusplus >= 201103L || _MSC_VER > 1600 || __INTEL_CXX11_MODE__
#define SMTG_CPP11 __cplusplus >= 201103L || _MSC_VER > 1600 || SMTG_INTEL_CXX11_MODE
#define SMTG_CPP11_STDLIBSUPPORT SMTG_CPP11
#endif
#define SMTG_HAS_NOEXCEPT _MSC_VER >= 1900 || (SMTG_INTEL_CXX11_MODE && SMTG_INTEL_COMPILER >= 1300)
#endif

#define SMTG_DEPRECATED_ATTRIBUTE(message) __declspec (deprecated ("Is Deprecated: " message))
//-----------------------------------------------------------------------------
// LINUX
//-----------------------------------------------------------------------------
#elif __gnu_linux__
#define LINUX 1
#define SMTG_OS_LINUX 1
#define SMTG_OS_MACOS 0
#define SMTG_OS_WINDOWS 0
#define SMTG_OS_IOS 0
#define SMTG_OS_OSX 0

#include <endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define BYTEORDER kLittleEndian
#else
#define BYTEORDER kBigEndian
#endif
#define COM_COMPATIBLE 0

#define COM_COMPATIBLE 0
#define PLUGIN_API
#define PTHREADS 1
#define SMTG_PTHREADS 1

#if __LP64__
#define PLATFORM_64 1
#define SMTG_PLATFORM_64 1
#else
#define SMTG_PLATFORM_64 0
#endif
#ifdef __cplusplus
#include <cstddef>
@@ -77,31 +116,41 @@
#error unsupported compiler
#endif
#define SMTG_CPP11_STDLIBSUPPORT 1
#define SMTG_HAS_NOEXCEPT 1
#endif
//-----------------------------------------------------------------------------
// Mac and iOS
//-----------------------------------------------------------------------------
#elif __APPLE__
#include <TargetConditionals.h>
#define MAC 1
#define PTHREADS 1
#if !TARGET_OS_IPHONE
#define SMTG_OS_LINUX 0
#define SMTG_OS_MACOS 1
#define SMTG_OS_WINDOWS 0
#define SMTG_OS_IOS TARGET_OS_IPHONE
#define SMTG_OS_OSX TARGET_OS_MAC && !TARGET_OS_IPHONE

#if !SMTG_OS_IOS
#ifndef __CF_USE_FRAMEWORK_INCLUDES__
#define __CF_USE_FRAMEWORK_INCLUDES__
#define __CF_USE_FRAMEWORK_INCLUDES__
#endif
#ifndef TARGET_API_MAC_CARBON
#define TARGET_API_MAC_CARBON 1
#define TARGET_API_MAC_CARBON 1
#endif
#endif
#if __LP64__
#define PLATFORM_64 1
#define SMTG_PLATFORM_64 1
#else
#define SMTG_PLATFORM_64 0
#endif
#if defined (__BIG_ENDIAN__)
#define BYTEORDER kBigEndian
#else
#define BYTEORDER kLittleEndian
#endif
#define COM_COMPATIBLE 0

#define COM_COMPATIBLE 0
#define PLUGIN_API
#define SMTG_PTHREADS 1

#if !defined(__PLIST__) && !defined(SMTG_DISABLE_DEFAULT_DIAGNOSTICS)
#ifdef __clang__
@@ -126,16 +175,34 @@
#endif
#ifdef __cplusplus
#include <cstddef>
#define SMTG_CPP11 (__cplusplus >= 201103L || __INTEL_CXX11_MODE__)
#define SMTG_CPP11 (__cplusplus >= 201103L || SMTG_INTEL_CXX11_MODE)
#if defined (_LIBCPP_VERSION) && SMTG_CPP11
#define SMTG_CPP11_STDLIBSUPPORT 1
#define SMTG_CPP11_STDLIBSUPPORT 1
#define SMTG_HAS_NOEXCEPT 1
#else
#define SMTG_CPP11_STDLIBSUPPORT 0
#define SMTG_CPP11_STDLIBSUPPORT 0
#define SMTG_HAS_NOEXCEPT 0
#endif
#endif
#else
#pragma error unknown platform
#endif

//-----------------------------------------------------------------------------
#if !SMTG_RENAME_ASSERT
#undef WINDOWS
#undef MAC
#undef PTHREADS
#undef PLATFORM_64

#if SMTG_OS_WINDOWS
#define WINDOWS SMTG_OS_WINDOWS
#endif
#if SMTG_OS_MACOS
#define MAC SMTG_OS_MACOS
#endif
#define PLATFORM_64 SMTG_PLATFORM_64
#define PTHREADS SMTG_PTHREADS
#endif
//-----------------------------------------------------------------------------

@@ -145,3 +212,18 @@
#else
#define SMTG_OVERRIDE
#endif
#if SMTG_HAS_NOEXCEPT
#define SMTG_NOEXCEPT noexcept
#else
#define SMTG_NOEXCEPT
#endif

//-----------------------------------------------------------------------------
// Deprecation setting
//-----------------------------------------------------------------------------
#ifndef SMTG_DEPRECATED_ATTRIBUTE
#define SMTG_DEPRECATED_ATTRIBUTE(msg)
#endif

#define SMTG_DEPRECATED_MSG(msg) SMTG_DEPRECATED_ATTRIBUTE(msg)
//-----------------------------------------------------------------------------

+ 8
- 8
source/includes/vst3sdk/pluginterfaces/base/fstrdefs.h View File

@@ -25,7 +25,7 @@
// 16 bit string operations
#if SMTG_CPP11 // if c++11 unicode string literals
#define SMTG_CPP11_CAT_PRIVATE_DONT_USE(a,b) a ## b
#if WINDOWS
#if SMTG_OS_WINDOWS
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(L,x)
#else
#define STR16(x) SMTG_CPP11_CAT_PRIVATE_DONT_USE(u,x)
@@ -47,11 +47,11 @@
#define str8BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char8))
#define str16BufferSize(buffer) (sizeof(buffer)/sizeof(Steinberg::char16))

#if WINDOWS
#if SMTG_OS_WINDOWS
#define FORMAT_INT64A "I64d"
#define FORMAT_UINT64A "I64u"

#elif MAC || LINUX
#elif SMTG_OS_MACOS || SMTG_OS_LINUX
#define FORMAT_INT64A "lld"
#define FORMAT_UINT64A "llu"
#define stricmp strcasecmp
@@ -73,13 +73,13 @@
//----------------------------------------------------------------------------
// newline
//----------------------------------------------------------------------------
#if WINDOWS
#if SMTG_OS_WINDOWS
#define ENDLINE_A "\r\n"
#define ENDLINE_W STR ("\r\n")
#elif MAC
#elif SMTG_OS_MACOS
#define ENDLINE_A "\r"
#define ENDLINE_W STR ("\r")
#elif LINUX
#elif SMTG_OS_LINUX
#define ENDLINE_A "\n"
#define ENDLINE_W STR ("\n")
#endif
@@ -90,7 +90,7 @@
#define ENDLINE ENDLINE_A
#endif

#if WINDOWS && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
#if SMTG_OS_WINDOWS && !defined(__GNUC__) && defined(_MSC_VER) && (_MSC_VER < 1900)
#define stricmp _stricmp
#define strnicmp _strnicmp
#define snprintf _snprintf
@@ -263,7 +263,7 @@ inline void str8ToStr16 (char16* dst, const char8* src, int32 n = -1)
pChr[0] = 0;
pChr[1] = src[i];
#else
dst[i] = src[i];
dst[i] = static_cast<char16> (src[i]);
#endif

if (src[i] == 0)


+ 9
- 9
source/includes/vst3sdk/pluginterfaces/base/ftypes.h View File

@@ -43,7 +43,7 @@ namespace Steinberg
typedef short int16;
typedef unsigned short uint16;

#if WINDOWS && !defined(__GNUC__)
#if SMTG_OS_WINDOWS && !defined(__GNUC__)
typedef long int32;
typedef unsigned long uint32;
#else
@@ -57,7 +57,7 @@ namespace Steinberg
static const int32 kMinInt32 = kMinLong;
static const uint32 kMaxInt32u = 0xffffffff;

#if WINDOWS && !defined(__GNUC__)
#if SMTG_OS_WINDOWS && !defined(__GNUC__)
typedef __int64 int64;
typedef unsigned __int64 uint64;
static const int64 kMaxInt64 = 9223372036854775807i64;
@@ -78,7 +78,7 @@ namespace Steinberg
static const float kMaxFloat = 3.40282346638528860E38;
static const double kMaxDouble = 1.7976931348623158E308;

#if PLATFORM_64
#if SMTG_PLATFORM_64
typedef uint64 TPtrInt;
#else
typedef uint32 TPtrInt;
@@ -118,13 +118,13 @@ namespace Steinberg
const FIDString kPlatformStringMac = "MAC";
const FIDString kPlatformStringIOS = "IOS";
const FIDString kPlatformStringLinux = "Linux";
#if WINDOWS
#if SMTG_OS_WINDOWS
const FIDString kPlatformString = kPlatformStringWin;
#elif TARGET_OS_IPHONE
#elif SMTG_OS_IOS
const FIDString kPlatformString = kPlatformStringIOS;
#elif MAC
#elif SMTG_OS_MACOS
const FIDString kPlatformString = kPlatformStringMac;
#elif LINUX
#elif SMTG_OS_LINUX
const FIDString kPlatformString = kPlatformStringLinux;
#endif

@@ -170,10 +170,10 @@ namespace Steinberg
// always inline macros (only when RELEASE is 1)
//----------------------------------------------------------------------------
#if RELEASE
#if MAC || LINUX
#if SMTG_OS_MACOS || SMTG_OS_LINUX
#define SMTG_ALWAYS_INLINE __inline__ __attribute__((__always_inline__))
#define SMTG_NEVER_INLINE __attribute__((noinline))
#elif WINDOWS
#elif SMTG_OS_WINDOWS
#define SMTG_ALWAYS_INLINE __forceinline
#define SMTG_NEVER_INLINE __declspec(noinline)
#endif


+ 57
- 76
source/includes/vst3sdk/pluginterfaces/base/funknown.cpp View File

@@ -20,22 +20,22 @@

#include <stdio.h>

#if WINDOWS
#if SMTG_OS_WINDOWS
#include <objbase.h>
#endif

#if MAC
#if SMTG_OS_MACOS
#include <CoreFoundation/CoreFoundation.h>
#include <libkern/OSAtomic.h>

#if defined (__GNUC__) && (__GNUC__ >= 4) && !__LP64__
#if defined(__GNUC__) && (__GNUC__ >= 4) && !__LP64__
// on 32 bit Mac OS X we can safely ignore the format warnings as sizeof(int) == sizeof(long)
#pragma GCC diagnostic ignored "-Wformat"
#endif

#endif

#if LINUX
#if SMTG_OS_LINUX
#include <ext/atomicity.h>
#endif

@@ -43,15 +43,15 @@ namespace Steinberg {

//------------------------------------------------------------------------
#if COM_COMPATIBLE
#if WINDOWS
#if SMTG_OS_WINDOWS
#define GuidStruct GUID
#else
struct GuidStruct
{
uint32 Data1;
uint16 Data2;
uint16 Data3;
uint8 Data4[8];
uint32 Data1;
uint16 Data2;
uint16 Data3;
uint8 Data4[8];
};
#endif
#endif
@@ -67,11 +67,11 @@ namespace FUnknownPrivate {
//------------------------------------------------------------------------
int32 PLUGIN_API atomicAdd (int32& var, int32 d)
{
#if WINDOWS
return _InterlockedExchangeAdd ((__LONG32 volatile *)&var, d) + d;
#elif MAC
#if SMTG_OS_WINDOWS
return InterlockedExchangeAdd (&var, d) + d;
#elif SMTG_OS_MACOS
return OSAtomicAdd32Barrier (d, (int32_t*)&var);
#elif LINUX
#elif SMTG_OS_LINUX
__gnu_cxx::__atomic_add (&var, d);
return var;
#else
@@ -102,38 +102,41 @@ FUID::FUID (const FUID& f)
{
memcpy (data, f.data, sizeof (TUID));
}
//------------------------------------------------------------------------
#if SMTG_CPP11_STDLIBSUPPORT
FUID::FUID (FUID&& other) {
FUID::FUID (FUID&& other)
{
memcpy (data, other.data, sizeof (TUID));
}
FUID& FUID::operator= (FUID&& other)
{
memcpy (data, other.data, sizeof (TUID));
return *this;
}
#endif
//------------------------------------------------------------------------
bool FUID::generate ()
{
#if WINDOWS
#if SMTG_OS_WINDOWS
#if defined(_M_ARM64) || defined(_M_ARM)
//#warning implement me!
return false;
#else
GUID guid;
HRESULT hr = CoCreateGuid (&guid);
switch (hr)
{
case RPC_S_OK:
memcpy (data, (char*)&guid, sizeof (TUID));
return true;
case RPC_S_OK: memcpy (data, (char*)&guid, sizeof (TUID)); return true;

case RPC_S_UUID_LOCAL_ONLY:
default:
return false;
default: return false;
}
#endif

#elif MAC
#elif SMTG_OS_MACOS
CFUUIDRef uuid = CFUUIDCreate (kCFAllocatorDefault);
if (uuid)
{
@@ -145,7 +148,6 @@ bool FUID::generate ()
return false;

#else
#warning implement me!
return false;
#endif
}
@@ -159,27 +161,12 @@ bool FUID::isValid () const
}

//------------------------------------------------------------------------
FUID& FUID::operator = (const FUID& f)
FUID& FUID::operator= (const FUID& f)
{
memcpy (data, f.data, sizeof (TUID));
return *this;
}

//------------------------------------------------------------------------
FUID& FUID::operator = (FIDString uid)
{
memcpy (data, uid, sizeof (TUID));
return *this;
}

//------------------------------------------------------------------------
FUID& FUID::operator = (TUID uid)
{
memcpy (data, uid, sizeof (TUID));
return *this;
}


//------------------------------------------------------------------------
void FUID::from4Int (uint32 l1, uint32 l2, uint32 l3, uint32 l4)
{
@@ -233,9 +220,9 @@ void FUID::to4Int (uint32& d1, uint32& d2, uint32& d3, uint32& d4) const
uint32 FUID::getLong1 () const
{
#if COM_COMPATIBLE
return makeLong (data[3], data[2], data [1], data [0]);
return makeLong (data[3], data[2], data[1], data[0]);
#else
return makeLong (data[0], data[1], data [2], data [3]);
return makeLong (data[0], data[1], data[2], data[3]);
#endif
}

@@ -243,9 +230,9 @@ uint32 FUID::getLong1 () const
uint32 FUID::getLong2 () const
{
#if COM_COMPATIBLE
return makeLong (data[5], data[4], data [7], data [6]);
return makeLong (data[5], data[4], data[7], data[6]);
#else
return makeLong (data[4], data[5], data [6], data [7]);
return makeLong (data[4], data[5], data[6], data[7]);
#endif
}

@@ -253,9 +240,9 @@ uint32 FUID::getLong2 () const
uint32 FUID::getLong3 () const
{
#if COM_COMPATIBLE
return makeLong (data[8], data[9], data [10], data [11]);
return makeLong (data[8], data[9], data[10], data[11]);
#else
return makeLong (data[8], data[9], data [10], data [11]);
return makeLong (data[8], data[9], data[10], data[11]);
#endif
}

@@ -263,9 +250,9 @@ uint32 FUID::getLong3 () const
uint32 FUID::getLong4 () const
{
#if COM_COMPATIBLE
return makeLong (data[12], data[13], data [14], data [15]);
return makeLong (data[12], data[13], data[14], data[15]);
#else
return makeLong (data[12], data[13], data [14], data [15]);
return makeLong (data[12], data[13], data[14], data[15]);
#endif
}

@@ -275,16 +262,16 @@ void FUID::toString (char8* string) const
if (!string)
return;

#if COM_COMPATIBLE
#if COM_COMPATIBLE
GuidStruct* g = (GuidStruct*)data;

char8 s[17];
Steinberg::toString8 (s, data, 8, 16);

sprintf (string, "%08X%04X%04X%s", g->Data1, g->Data2, g->Data3, s);
#else
#else
Steinberg::toString8 (string, data, 0, 16);
#endif
#endif
}

//------------------------------------------------------------------------
@@ -295,7 +282,7 @@ bool FUID::fromString (const char8* string)
if (strlen (string) != 32)
return false;

#if COM_COMPATIBLE
#if COM_COMPATIBLE
GuidStruct g;
char s[33];

@@ -311,9 +298,9 @@ bool FUID::fromString (const char8* string)

memcpy (data, &g, 8);
Steinberg::fromString8 (string + 16, data, 8, 16);
#else
#else
Steinberg::fromString8 (string, data, 0, 16);
#endif
#endif

return true;
}
@@ -326,9 +313,9 @@ bool FUID::fromRegistryString (const char8* string)
if (strlen (string) != 38)
return false;

// e.g. {c200e360-38c5-11ce-ae62-08002b2b79ef}
// e.g. {c200e360-38c5-11ce-ae62-08002b2b79ef}

#if COM_COMPATIBLE
#if COM_COMPATIBLE
GuidStruct g;
char8 s[10];

@@ -345,13 +332,13 @@ bool FUID::fromRegistryString (const char8* string)

Steinberg::fromString8 (string + 20, data, 8, 10);
Steinberg::fromString8 (string + 25, data, 10, 16);
#else
#else
Steinberg::fromString8 (string + 1, data, 0, 4);
Steinberg::fromString8 (string + 10, data, 4, 6);
Steinberg::fromString8 (string + 15, data, 6, 8);
Steinberg::fromString8 (string + 20, data, 8, 10);
Steinberg::fromString8 (string + 25, data, 10, 16);
#endif
#endif

return true;
}
@@ -359,9 +346,9 @@ bool FUID::fromRegistryString (const char8* string)
//------------------------------------------------------------------------
void FUID::toRegistryString (char8* string) const
{
// e.g. {c200e360-38c5-11ce-ae62-08002b2b79ef}
// e.g. {c200e360-38c5-11ce-ae62-08002b2b79ef}

#if COM_COMPATIBLE
#if COM_COMPATIBLE
GuidStruct* g = (GuidStruct*)data;

char8 s1[5];
@@ -371,7 +358,7 @@ void FUID::toRegistryString (char8* string) const
Steinberg::toString8 (s2, data, 10, 16);

sprintf (string, "{%08X-%04X-%04X-%s-%s}", g->Data1, g->Data2, g->Data3, s1, s2);
#else
#else
char8 s1[9];
Steinberg::toString8 (s1, data, 0, 4);
char8 s2[5];
@@ -384,7 +371,7 @@ void FUID::toRegistryString (char8* string) const
Steinberg::toString8 (s5, data, 10, 16);

sprintf (string, "{%s-%s-%s-%s-%s}", s1, s2, s3, s4, s5);
#endif
#endif
}

//------------------------------------------------------------------------
@@ -392,15 +379,15 @@ void FUID::print (char8* string, int32 style) const
{
if (!string) // no string: debug output
{
char8 str [128];
char8 str[128];
print (str, style);

#if WINDOWS
#if SMTG_OS_WINDOWS
OutputDebugStringA (str);
OutputDebugStringA ("\n");
#else
#else
fprintf (stdout, "%s\n", str);
#endif
#endif
return;
}

@@ -423,24 +410,18 @@ void FUID::print (char8* string, int32 style) const

case kCLASS_UID:
default:
sprintf (string, "DECLARE_CLASS_IID (Interface, 0x%08X, 0x%08X, 0x%08X, 0x%08X)", l1, l2, l3, l4);
sprintf (string, "DECLARE_CLASS_IID (Interface, 0x%08X, 0x%08X, 0x%08X, 0x%08X)", l1,
l2, l3, l4);
break;
}
}

//------------------------------------------------------------------------
void FUID::toTUID (TUID result) const
{
memcpy (result, data, sizeof (TUID));
}


//------------------------------------------------------------------------
// helpers
//------------------------------------------------------------------------
static uint32 makeLong (uint8 b1, uint8 b2, uint8 b3, uint8 b4)
{
return (uint32(b1) << 24) | (uint32(b2) << 16) | (uint32(b3) << 8) | uint32(b4);
return (uint32 (b1) << 24) | (uint32 (b2) << 16) | (uint32 (b3) << 8) | uint32 (b4);
}

//------------------------------------------------------------------------


+ 107
- 88
source/includes/vst3sdk/pluginterfaces/base/funknown.h View File

@@ -57,25 +57,27 @@
#endif

//------------------------------------------------------------------------
#define DECLARE_UID(name, l1, l2, l3, l4) \
::Steinberg::TUID name = INLINE_UID (l1, l2, l3, l4);
#define DECLARE_UID(name, l1, l2, l3, l4) ::Steinberg::TUID name = INLINE_UID (l1, l2, l3, l4);

//------------------------------------------------------------------------
#define EXTERN_UID(name) \
extern const ::Steinberg::TUID name;

#define EXTERN_UID(name) extern const ::Steinberg::TUID name;

#ifdef INIT_CLASS_IID
#define DECLARE_CLASS_IID(ClassName, l1, l2, l3, l4) static const ::Steinberg::TUID ClassName##_iid = INLINE_UID (l1, l2, l3, l4); \
#define DECLARE_CLASS_IID(ClassName, l1, l2, l3, l4) \
static const ::Steinberg::TUID ClassName##_iid = INLINE_UID (l1, l2, l3, l4); \
\
const ::Steinberg::FUID ClassName::iid (ClassName##_iid);
#else
#define DECLARE_CLASS_IID(ClassName, l1, l2, l3, l4) static const ::Steinberg::TUID ClassName##_iid = INLINE_UID (l1, l2, l3, l4);
#define DECLARE_CLASS_IID(ClassName, l1, l2, l3, l4) \
static const ::Steinberg::TUID ClassName##_iid = INLINE_UID (l1, l2, l3, l4);
#endif

#define DEF_CLASS_IID(ClassName) const ::Steinberg::FUID ClassName::iid (ClassName##_iid);

#define INLINE_UID_OF(ClassName) ClassName##_iid

#define INLINE_UID_FROM_FUID(x) INLINE_UID(x.getLong1 (), x.getLong2 (), x.getLong3 (), x.getLong4 ())
#define INLINE_UID_FROM_FUID(x) \
INLINE_UID (x.getLong1 (), x.getLong2 (), x.getLong3 (), x.getLong4 ())

//------------------------------------------------------------------------
// FUnknown implementation macros
@@ -84,8 +86,8 @@ const ::Steinberg::FUID ClassName::iid (ClassName##_iid);
#define DECLARE_FUNKNOWN_METHODS \
public: \
virtual ::Steinberg::tresult PLUGIN_API queryInterface (const ::Steinberg::TUID _iid, void** obj) SMTG_OVERRIDE; \
virtual ::Steinberg::uint32 PLUGIN_API addRef () SMTG_OVERRIDE; \
virtual ::Steinberg::uint32 PLUGIN_API release () SMTG_OVERRIDE; \
virtual ::Steinberg::uint32 PLUGIN_API addRef () SMTG_OVERRIDE; \
virtual ::Steinberg::uint32 PLUGIN_API release () SMTG_OVERRIDE; \
protected : \
::Steinberg::int32 __funknownRefCount; \
public:
@@ -94,7 +96,7 @@ public:

#define DELEGATE_REFCOUNT(ClassName) \
public: \
virtual ::Steinberg::uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return ClassName::addRef (); } \
virtual ::Steinberg::uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return ClassName::addRef (); } \
virtual ::Steinberg::uint32 PLUGIN_API release () SMTG_OVERRIDE { return ClassName::release (); }

//------------------------------------------------------------------------
@@ -128,11 +130,11 @@ if (::Steinberg::FUnknownPrivate::iidEqual (iid, InterfaceIID)) \

//------------------------------------------------------------------------
#define IMPLEMENT_QUERYINTERFACE(ClassName, InterfaceName, ClassIID) \
::Steinberg::tresult PLUGIN_API ClassName::queryInterface (const ::Steinberg::TUID _iid, void** obj) \
::Steinberg::tresult PLUGIN_API ClassName::queryInterface (const ::Steinberg::TUID _iid, void** obj)\
{ \
QUERY_INTERFACE (_iid, obj, ::Steinberg::FUnknown::iid, InterfaceName) \
QUERY_INTERFACE (_iid, obj, ClassIID, InterfaceName) \
*obj = nullptr; \
QUERY_INTERFACE (_iid, obj, ::Steinberg::FUnknown::iid, InterfaceName) \
QUERY_INTERFACE (_iid, obj, ClassIID, InterfaceName) \
*obj = nullptr; \
return ::Steinberg::kNoInterface; \
}

@@ -149,7 +151,7 @@ namespace Steinberg {

//------------------------------------------------------------------------
#if COM_COMPATIBLE
#if WINDOWS
#if SMTG_OS_WINDOWS
enum
{
kNoInterface = static_cast<tresult>(0x80004002L), // E_NOINTERFACE
@@ -213,7 +215,7 @@ int32 PLUGIN_API atomicAdd (int32& value, int32 amount);
}

//------------------------------------------------------------------------
/** Handling 16 Byte Globaly Unique Identifiers.
/** Handling 16 Byte Globally Unique Identifiers.
\ingroup pluginBase

Each interface declares its identifier as static member inside the interface
@@ -225,63 +227,56 @@ class FUID
public:
//------------------------------------------------------------------------
FUID ();
inline FUID (const TUID uid);
FUID (uint32 l1, uint32 l2, uint32 l3, uint32 l4);
FUID (const FUID&);
virtual ~FUID () {}
#if SMTG_CPP11_STDLIBSUPPORT
FUID (FUID&& other);
FUID& operator= (FUID&& other);
#endif


/** Generates a new Unique Identifier (UID).
Will return true for success. If the return value is false, either no
UID is generated or the UID is not guaranteed to be unique worldwide. */
bool generate ();

/** Checks if the UID data is valid.
The default constructor initializes the memory with zeros. */
The default constructor initializes the memory with zeros. */
bool isValid () const;

FUID& operator = (const FUID& f);
FUID& operator = (FIDString uid);
FUID& operator = (TUID uid);

bool operator == (const FUID& f) const { return ::Steinberg::FUnknownPrivate::iidEqual (data, f.data); }
bool operator == (FIDString uid) const { return ::Steinberg::FUnknownPrivate::iidEqual (data, uid); }
bool operator == (TUID uid) const { return ::Steinberg::FUnknownPrivate::iidEqual (data, uid); }

bool operator < (const FUID& f) const { return memcmp (data, f.data, sizeof (TUID)) < 0; }
bool operator < (FIDString uid) const { return memcmp (data, uid, sizeof (TUID)) < 0; }
bool operator < (TUID uid) const { return memcmp (data, uid, sizeof (TUID)) < 0; }

bool operator != (const FUID& f) const { return !::Steinberg::FUnknownPrivate::iidEqual (data, f.data); }
bool operator != (FIDString uid) const { return !::Steinberg::FUnknownPrivate::iidEqual (data, uid); }
bool operator != (TUID uid) const { return !::Steinberg::FUnknownPrivate::iidEqual (data, uid); }

operator FIDString () const { return data; }
operator char* () { return data; }

uint32 getLong1 () const;
uint32 getLong2 () const;
uint32 getLong3 () const;
uint32 getLong4 () const;
uint32 getLong1 () const;
uint32 getLong2 () const;
uint32 getLong3 () const;
uint32 getLong4 () const;

void from4Int (uint32 d1, uint32 d2, uint32 d3, uint32 d4);
void to4Int (uint32& d1, uint32& d2, uint32& d3, uint32& d4) const;

typedef char8 String [64];
typedef char8 String[64];

/** Converts UID to a string.
The string will be 32 characters long, representing the hexadecimal values
of each data byte (e.g. "9127BE30160E4BB69966670AA6087880"). */
of each data byte (e.g. "9127BE30160E4BB69966670AA6087880").
Typical use-case is:
\code
char8[33] strUID = {0};
FUID uid;
if (uid.generate ())
uid.toString (strUID);
\endcode
*/
void toString (char8* string) const;

/** Sets the UID data from a string.
The string has to be 32 characters long, where each character-pair is
the ASCII-encoded hexadecimal value of the corresponding data byte. */
The string has to be 32 characters long, where each character-pair is
the ASCII-encoded hexadecimal value of the corresponding data byte. */
bool fromString (const char8* string);

/** Converts UID to a string in Microsoft® OLE format.
@@ -299,15 +294,28 @@ public:
kCLASS_UID ///< "DECLARE_CLASS_IID (Interface, 0x00000000, 0x00000000, 0x00000000, 0x00000000)"
};
/** Prints the UID to a string (or debug output if string is NULL).
\param string is the output string if not NULL.
\param style can be chosen from the FUID::UIDPrintStyle enumeration. */
void print (char8* string = 0, int32 style = kINLINE_UID) const;
\param string is the output string if not NULL.
\param style can be chosen from the FUID::UIDPrintStyle enumeration. */
void print (char8* string = nullptr, int32 style = kINLINE_UID) const;

void toTUID (TUID result) const;
template <size_t N>
inline explicit FUID (const int8 (&uid)[N])
{
#if SMTG_CPP11_STDLIBSUPPORT
static_assert (N == sizeof (TUID), "only TUID allowed");
#endif
memcpy (data, uid, sizeof (TUID));
}
inline void toTUID (TUID result) const { memcpy (result, data, sizeof (TUID)); }
inline operator const TUID& () const { return data; }
inline const TUID& toTUID () const { return data; }

inline const TUID& toTUID () const
static FUID fromTUID (const TUID uid)
{
return data;
FUID res;
if (uid)
memcpy (res.data, uid, sizeof (TUID));
return res;
}

//------------------------------------------------------------------------
@@ -315,13 +323,16 @@ protected:
TUID data;
};

//------------------------------------------------------------------------
inline FUID::FUID (const TUID uid)
#if SMTG_CPP11_STDLIBSUPPORT
template <typename T>
inline bool operator== (const FUID& f1, T f2)
{
memset (data, 0, sizeof (TUID));
if (uid)
memcpy (data, uid, sizeof (TUID));
static_assert (
std::is_same<typename std::remove_cv<T>::type, FUID>::value,
"Do not compare a FUID with a TUID directly. Either convert the TUID to a FUID and compare them or use FUnknownPrivate::iidEqual");
return f1.operator== (f2);
}
#endif

//------------------------------------------------------------------------
// FUnknown
@@ -342,6 +353,7 @@ The SDK provides a class called FUID for this purpose.
class FUnknown
{
public:

//------------------------------------------------------------------------
/** Query for a pointer to the specified interface.
Returns kResultOk on success or kNoInterface if the object does not implement the interface.
@@ -352,7 +364,7 @@ public:

/** Adds a reference and return the new reference count.
\par Remarks:
The initial reference count after creating an object is 1. */
The initial reference count after creating an object is 1. */
virtual uint32 PLUGIN_API addRef () = 0;

/** Releases a reference and return the new reference count.
@@ -364,6 +376,7 @@ public:
//------------------------------------------------------------------------
};


DECLARE_CLASS_IID (FUnknown, 0x00000000, 0x00000000, 0xC0000000, 0x00000046)

//------------------------------------------------------------------------
@@ -371,12 +384,12 @@ DECLARE_CLASS_IID (FUnknown, 0x00000000, 0x00000000, 0xC0000000, 0x00000046)
//------------------------------------------------------------------------
/** FUnknownPtr - automatic interface conversion and smart pointer in one.
This template class can be used for interface conversion like this:
\code
IPtr<IPath> path = owned (FHostCreate (IPath, hostClasses));
FUnknownPtr<IPath2> path2 (path); // does a query interface for IPath2
if (path2)
...
\endcode
\code
IPtr<IPath> path = owned (FHostCreate (IPath, hostClasses));
FUnknownPtr<IPath2> path2 (path); // does a query interface for IPath2
if (path2)
...
\endcode
*/
//------------------------------------------------------------------------
template <class I>
@@ -388,8 +401,12 @@ public:
inline FUnknownPtr (const FUnknownPtr& p) : IPtr<I> (p) {}
inline FUnknownPtr () {}

inline FUnknownPtr& operator=(const FUnknownPtr& p) {IPtr<I>::operator=(p); return *this;}
inline I* operator=(FUnknown* unknown);
inline FUnknownPtr& operator= (const FUnknownPtr& p)
{
IPtr<I>::operator= (p);
return *this;
}
inline I* operator= (FUnknown* unknown);
inline I* getInterface () { return this->ptr; }
};

@@ -403,19 +420,18 @@ inline FUnknownPtr<I>::FUnknownPtr (FUnknown* unknown)

//------------------------------------------------------------------------
template <class I>
inline I* FUnknownPtr<I>::operator=(FUnknown* unknown)
inline I* FUnknownPtr<I>::operator= (FUnknown* unknown)
{
I* newPtr = 0;
if (unknown && unknown->queryInterface (I::iid, (void**)&newPtr) == kResultOk)
{
OPtr<I> rel (newPtr);
return IPtr<I>::operator=(newPtr);
return IPtr<I>::operator= (newPtr);
}

return IPtr<I>::operator=(0);
return IPtr<I>::operator= (0);
}


//------------------------------------------------------------------------
// FReleaser (obsolete)
//------------------------------------------------------------------------
@@ -424,33 +440,36 @@ This class is obsolete and is only kept for compatibility.
The replacement for FReleaser is OPtr.

Usage example with FReleaser:
\code
void someFunction ()
{
IPath* path = pathCreateMethod ();
FReleaser releaser (path);
.... do something with path...
.... path not used anymore, releaser will destroy it when leaving function scope
}
\endcode
\code
void someFunction ()
{
IPath* path = pathCreateMethod ();
FReleaser releaser (path);
.... do something with path...
.... path not used anymore, releaser will destroy it when leaving function scope
}
\endcode
Usage example with OPtr:
\code
void someFunction ()
{
OPtr<IPath> path = pathCreateMethod ();
.... do something with path...
.... path not used anymore, OPtr will destroy it when leaving function scope
}
\endcode
\code
void someFunction ()
{
OPtr<IPath> path = pathCreateMethod ();
.... do something with path...
.... path not used anymore, OPtr will destroy it when leaving function scope
}
\endcode
*/
//------------------------------------------------------------------------
struct FReleaser
{
FReleaser (FUnknown* u): u (u) {}
~FReleaser () { if (u) u->release (); }

FReleaser (FUnknown* u) : u (u) {}
~FReleaser ()
{
if (u)
u->release ();
}
FUnknown* u;
};

//------------------------------------------------------------------------
} // namespace Steinberg
} // namespace Steinberg

+ 6
- 0
source/includes/vst3sdk/pluginterfaces/base/futils.h View File

@@ -88,5 +88,11 @@ inline int32 FromNormalized (const T& norm, const int32 numSteps)
return Min<int32> (numSteps, int32 (norm * (numSteps + 1)));
}

// Four character constant
#ifndef CCONST
#define CCONST(a, b, c, d) \
((((int32) (a)) << 24) | (((int32) (b)) << 16) | (((int32) (c)) << 8) | (((int32) (d)) << 0))
#endif

//------------------------------------------------------------------------
} // namespace Steinberg

+ 94
- 3
source/includes/vst3sdk/pluginterfaces/base/fvariant.h View File

@@ -17,12 +17,13 @@
#pragma once

#include "pluginterfaces/base/fstrdefs.h"
#include "pluginterfaces/base/funknown.h"

//------------------------------------------------------------------------
namespace Steinberg {

class FUnknown;
//------------------------------------------------------------------------
// FVariant struct declaration
//------------------------------------------------------------------------
@@ -49,6 +50,8 @@ public:
inline FVariant () { memset (this, 0, sizeof (FVariant)); }
inline FVariant (const FVariant& variant);

inline FVariant (bool b) : type (kInteger), intValue (b) {}
inline FVariant (uint32 v) : type (kInteger), intValue (v) {}
inline FVariant (int64 v) : type (kInteger), intValue (v) {}
inline FVariant (double v) : type (kFloat), floatValue (v) {}
inline FVariant (const char8* str) : type (kString8), string8 (str) {}
@@ -62,12 +65,43 @@ public:
//------------------------------------------------------------------------
inline FVariant& operator= (const FVariant& variant);

inline void set (bool b)
{
setInt (b);
}

inline void set (uint32 v)
{
setInt (v);
}

inline void set (int64 v)
{
setInt (v);
}

inline void set (double v)
{
setFloat (v);
}

inline void set (const char8* c)
{
setString8 (c);
}

inline void set (const char16* c)
{
setString16 (c);
}

inline void setInt (int64 v)
{
empty ();
type = kInteger;
intValue = v;
}

inline void setFloat (double v)
{
empty ();
@@ -94,6 +128,9 @@ public:
object = obj;
}

template <typename T>
inline T get () const;

inline int64 getInt () const { return (type & kInteger) ? intValue : 0; }
inline double getFloat () const { return (type & kFloat) ? floatValue : 0.; }
inline double getNumber () const
@@ -134,7 +171,7 @@ public:
//------------------------------------------------------------------------
inline bool operator== (const FVariant& v1, const FVariant& v2)
{
#if PLATFORM_64
#if SMTG_PLATFORM_64
return v1.type == v2.type && v1.intValue == v2.intValue;
#else
if (v1.type != v2.type)
@@ -146,6 +183,60 @@ inline bool operator== (const FVariant& v1, const FVariant& v2)
#endif
}

template <>
inline bool FVariant::get<bool> () const
{
return getInt () != 0;
}

template <>
inline uint32 FVariant::get<uint32> () const
{
return static_cast<uint32> (getInt ());
}

template <>
inline int32 FVariant::get<int32> () const
{
return static_cast<int32> (getInt ());
}

template <>
inline int64 FVariant::get<int64> () const
{
return static_cast<int64> (getInt ());
}

template <>
inline float FVariant::get<float> () const
{
return static_cast<float> (getFloat ());
}

template <>
inline double FVariant::get<double> () const
{
return getFloat ();
}

template <>
inline const char8* FVariant::get<const char8*> () const
{
return getString8 ();
}

template <>
inline const char16* FVariant::get<const char16*> () const
{
return getString16 ();
}

template <>
inline FUnknown* FVariant::get<FUnknown*> () const
{
return getObject ();
}

//------------------------------------------------------------------------
inline bool operator!= (const FVariant& v1, const FVariant& v2) { return !(v1 == v2); }

@@ -202,5 +293,5 @@ inline FVariant& FVariant::operator= (const FVariant& variant)
return *this;
}

//------------------------------------------------------------------------
//------------------------------------------------------------------------
} // namespace Steinberg

+ 0
- 96
source/includes/vst3sdk/pluginterfaces/base/geoconstants.h View File

@@ -1,96 +0,0 @@
//-----------------------------------------------------------------------------
// Project : SDK Core
//
// Category : SDK Core Interfaces
// Filename : pluginterfaces/base/geoconstants.h
// Created by : Steinberg, 11/2014
// Description : Defines orientations and directions as also used by fpoint.h and frect.h
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

//------------------------------------------------------------------------
namespace Steinberg {

//------------------------------------------------------------------------
enum Direction
{
kNorth,
kNorthEast,
kEast,
kSouthEast,
kSouth,
kSouthWest,
kWest,
kNorthWest,
kNoDirection, //same position or center point of a geometry

kNumberOfDirections
};

//------------------------------------------------------------------------
enum Orientation
{
kHorizontal,
kVertical,
kNumberOfOrientations
};

//------------------------------------------------------------------------
namespace GeoConstants {

//------------------------------------------------------------------------
inline Direction toOpposite (Direction dir)
{
switch (dir)
{
case kNorth : return kSouth;
case kNorthEast : return kSouthWest;
case kEast : return kWest;
case kSouthEast : return kNorthWest;
case kSouth : return kNorth;
case kSouthWest : return kNorthEast;
case kWest : return kEast;
case kNorthWest : return kSouthEast;
case kNoDirection : return kNoDirection;
default:
return kNumberOfDirections;
}
}

//------------------------------------------------------------------------
inline Orientation toOrientation (Direction dir)
{
switch (dir)
{
case kNorth : return kVertical;
case kEast : return kHorizontal;
case kSouth : return kVertical;
case kWest : return kHorizontal;
default:
return kNumberOfOrientations;
}
}

//------------------------------------------------------------------------
inline Orientation toOrthogonalOrientation (Orientation dir)
{
switch (dir)
{
case kVertical : return kHorizontal;
case kHorizontal : return kVertical;
default:
return kNumberOfOrientations;
}
}

//------------------------------------------------------------------------
} // namespace GeoConstants
} // namespace Steinberg

+ 0
- 47
source/includes/vst3sdk/pluginterfaces/base/ierrorcontext.h View File

@@ -1,47 +0,0 @@
//-----------------------------------------------------------------------------
// Project : SDK Core
//
// Category : SDK Core Interfaces
// Filename : pluginterfaces/base/ierrorcontext.h
// Created by : Steinberg, 02/2008
// Description : Error Context Interface
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

#include "pluginterfaces/base/funknown.h"

namespace Steinberg {

class IString;

//------------------------------------------------------------------------
/** Interface for error handling.
[plug imp] \n
[released: Sequel 2] */
//------------------------------------------------------------------------
class IErrorContext : public FUnknown
{
public:
//------------------------------------------------------------------------
/** Tells the plug-in to not show any UI elements on errors. */
virtual void PLUGIN_API disableErrorUI (bool state) = 0;
/** If an error happens and disableErrorUI was not set this should return kResultTrue if the plug-in already showed a message to the user what happened. */
virtual tresult PLUGIN_API errorMessageShown () = 0;
/** Fill message with error string. The host may show this to the user. */
virtual tresult PLUGIN_API getErrorMessage (IString* message) = 0;

//------------------------------------------------------------------------
static const FUID iid;
};
DECLARE_CLASS_IID (IErrorContext, 0x12BCD07B, 0x7C694336, 0xB7DA77C3, 0x444A0CD0)

//------------------------------------------------------------------------
} // namespace Steinberg

+ 41
- 3
source/includes/vst3sdk/pluginterfaces/base/ipluginbase.h View File

@@ -93,7 +93,11 @@ struct PFactoryInfo
flags |= kUnicode;
#endif
}
#if SMTG_CPP11
constexpr PFactoryInfo () : vendor (), url (), email (), flags () {}
#else
PFactoryInfo () { memset (this, 0, sizeof (PFactoryInfo)); }
#endif
};

//------------------------------------------------------------------------
@@ -121,7 +125,7 @@ struct PClassInfo
char8 name[kNameSize]; ///< class name, visible to the user
//------------------------------------------------------------------------

PClassInfo (TUID _cid, int32 _cardinality, const char8* _category, const char8* _name)
PClassInfo (const TUID _cid, int32 _cardinality, const char8* _category, const char8* _name)
{
memset (this, 0, sizeof (PClassInfo));
memcpy (cid, _cid, sizeof (TUID));
@@ -131,7 +135,11 @@ struct PClassInfo
strncpy8 (name, _name, kNameSize);
cardinality = _cardinality;
}
#if SMTG_CPP11
constexpr PClassInfo () : cid (), cardinality (), category (), name () {}
#else
PClassInfo () { memset (this, 0, sizeof (PClassInfo)); }
#endif
};


@@ -213,7 +221,7 @@ struct PClassInfo2
strncpy8 (category, _category, PClassInfo::kCategorySize);
if (_name)
strncpy8 (name, _name, PClassInfo::kNameSize);
classFlags = _classFlags;
classFlags = static_cast<uint32> (_classFlags);
if (_subCategories)
strncpy8 (subCategories, _subCategories, kSubCategoriesSize);
if (_vendor)
@@ -223,7 +231,22 @@ struct PClassInfo2
if (_sdkVersion)
strncpy8 (sdkVersion, _sdkVersion, kVersionSize);
}
#if SMTG_CPP11
constexpr PClassInfo2 ()
: cid ()
, cardinality ()
, category ()
, name ()
, classFlags ()
, subCategories ()
, vendor ()
, version ()
, sdkVersion ()
{
}
#else
PClassInfo2 () { memset (this, 0, sizeof (PClassInfo2)); }
#endif
};

//------------------------------------------------------------------------
@@ -282,7 +305,7 @@ struct PClassInfoW
strncpy8 (category, _category, PClassInfo::kCategorySize);
if (_name)
strncpy16 (name, _name, PClassInfo::kNameSize);
classFlags = _classFlags;
classFlags = static_cast<uint32> (_classFlags);
if (_subCategories)
strncpy8 (subCategories, _subCategories, kSubCategoriesSize);
if (_vendor)
@@ -292,7 +315,22 @@ struct PClassInfoW
if (_sdkVersion)
strncpy16 (sdkVersion, _sdkVersion, kVersionSize);
}
#if SMTG_CPP11
constexpr PClassInfoW ()
: cid ()
, cardinality ()
, category ()
, name ()
, classFlags ()
, subCategories ()
, vendor ()
, version ()
, sdkVersion ()
{
}
#else
PClassInfoW () { memset (this, 0, sizeof (PClassInfoW)); }
#endif

void fromAscii (const PClassInfo2& ci2)
{


+ 0
- 161
source/includes/vst3sdk/pluginterfaces/base/keycodes.h View File

@@ -1,161 +0,0 @@
//-----------------------------------------------------------------------------
// Project : SDK Core
//
// Category : SDK Core Interfaces
// Filename : pluginterfaces/base/keycodes.h
// Created by : Steinberg, 01/2004
// Description : Key Code Definitions
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

#include "pluginterfaces/base/ftypes.h"

namespace Steinberg {
//------------------------------------------------------------------------------
/** Virtual Key Codes.
OS-independent enumeration of virtual keycodes.
*/
//------------------------------------------------------------------------------
enum VirtualKeyCodes
{
KEY_BACK = 1,
KEY_TAB,
KEY_CLEAR,
KEY_RETURN,
KEY_PAUSE,
KEY_ESCAPE,
KEY_SPACE,
KEY_NEXT,
KEY_END,
KEY_HOME,

KEY_LEFT,
KEY_UP,
KEY_RIGHT,
KEY_DOWN,
KEY_PAGEUP,
KEY_PAGEDOWN,

KEY_SELECT,
KEY_PRINT,
KEY_ENTER,
KEY_SNAPSHOT,
KEY_INSERT,
KEY_DELETE,
KEY_HELP,
KEY_NUMPAD0,
KEY_NUMPAD1,
KEY_NUMPAD2,
KEY_NUMPAD3,
KEY_NUMPAD4,
KEY_NUMPAD5,
KEY_NUMPAD6,
KEY_NUMPAD7,
KEY_NUMPAD8,
KEY_NUMPAD9,
KEY_MULTIPLY,
KEY_ADD,
KEY_SEPARATOR,
KEY_SUBTRACT,
KEY_DECIMAL,
KEY_DIVIDE,
KEY_F1,
KEY_F2,
KEY_F3,
KEY_F4,
KEY_F5,
KEY_F6,
KEY_F7,
KEY_F8,
KEY_F9,
KEY_F10,
KEY_F11,
KEY_F12,
KEY_NUMLOCK,
KEY_SCROLL,

KEY_SHIFT,
KEY_CONTROL,
KEY_ALT,

KEY_EQUALS, // only occurs on a Mac
KEY_CONTEXTMENU, // Windows only

// multimedia keys
KEY_MEDIA_PLAY,
KEY_MEDIA_STOP,
KEY_MEDIA_PREV,
KEY_MEDIA_NEXT,
KEY_VOLUME_UP,
KEY_VOLUME_DOWN,

KEY_F13,
KEY_F14,
KEY_F15,
KEY_F16,
KEY_F17,
KEY_F18,
KEY_F19,

VKEY_FIRST_CODE = KEY_BACK,
VKEY_LAST_CODE = KEY_F19,

VKEY_FIRST_ASCII = 128
/*
KEY_0 - KEY_9 are the same as ASCII '0' - '9' (0x30 - 0x39) + FIRST_ASCII
KEY_A - KEY_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A) + FIRST_ASCII
*/
};

//------------------------------------------------------------------------------
inline tchar VirtualKeyCodeToChar (uint8 vKey)
{
if (vKey >= VKEY_FIRST_ASCII)
return (tchar)(vKey - VKEY_FIRST_ASCII + 0x30);
else if (vKey == KEY_SPACE)
return ' ';
return 0;
}

//------------------------------------------------------------------------------
inline uint8 CharToVirtualKeyCode (tchar character)
{
if ((character >= 0x30 && character <= 0x39) || (character >= 0x41 && character <= 0x5A))
return (uint8)(character - 0x30 + VKEY_FIRST_ASCII);
if (character == ' ')
return (uint8)KEY_SPACE;
return 0;
}

//------------------------------------------------------------------------------
enum KeyModifier
{
kShiftKey = 1 << 0, ///< same on both PC and Mac
kAlternateKey = 1 << 1, ///< same on both PC and Mac
kCommandKey = 1 << 2, ///< windows ctrl key; mac cmd key (apple button)
kControlKey = 1 << 3 ///< windows: not assigned, mac: ctrl key
};

//------------------------------------------------------------------------
struct KeyCode
{
tchar character;
uint8 virt;
uint8 modifier;

explicit KeyCode (tchar character = 0, uint8 virt = 0, uint8 modifier = 0)
: character (character), virt (virt), modifier (modifier)
{
}
};

//------------------------------------------------------------------------
} // namespace Steinberg

+ 0
- 32
source/includes/vst3sdk/pluginterfaces/base/pluginbasefwd.h View File

@@ -1,32 +0,0 @@
//------------------------------------------------------------------------
// Project : SDK Base
//
// Category : SDK Core Interfaces
// Filename : pluginterfaces/base/pluginbasefwd.h
// Created by : Steinberg, 10/2014
// Description : Forward declarations for pluginterfaces base module
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

namespace Steinberg {

class FUnknown;
class FUID;

template <typename T> class IPtr;

class ICloneable;
class IDependent;
class IUpdateHandler;

class IBStream;

} // Steinberg

+ 67
- 32
source/includes/vst3sdk/pluginterfaces/base/smartpointer.h View File

@@ -18,7 +18,7 @@

#include "pluginterfaces/base/fplatform.h"
#if SMTG_CPP11_STDLIBSUPPORT
#include <memory>
#include <utility>
#endif

//------------------------------------------------------------------------
@@ -34,9 +34,9 @@ namespace Steinberg {
- handles refCount of the interface
- Usage example:
\code
IPtr<IPath> path (sharedPath);
if (path)
path->ascend ();
IPtr<IPath> path (sharedPath);
if (path)
path->ascend ();
\endcode
*/
//------------------------------------------------------------------------
@@ -75,15 +75,47 @@ public:
inline I* get () const { return ptr; }

#if SMTG_CPP11_STDLIBSUPPORT
inline IPtr (IPtr<I>&& movePtr) : ptr (nullptr) { *this = std::move (movePtr); }
inline IPtr (IPtr<I>&& movePtr) SMTG_NOEXCEPT : ptr (movePtr.take ()) { }
template <typename T>
inline IPtr (IPtr<T>&& movePtr) SMTG_NOEXCEPT : ptr (movePtr.take ()) { }

inline IPtr& operator= (IPtr<I>&& movePtr)
{
if (ptr)
ptr->release ();
ptr = movePtr.ptr;
movePtr.ptr = nullptr;

ptr = movePtr.take ();
return *this;
}
template <typename T>
inline IPtr& operator= (IPtr<T>&& movePtr)
{
if (ptr)
ptr->release ();
ptr = movePtr.take ();
return *this;
}

inline void reset (I* obj = nullptr)
{
if (ptr)
ptr->release();
ptr = obj;
}

I* take () SMTG_NOEXCEPT
{
I* out = ptr;
ptr = nullptr;
return out;
}

template <typename T>
static IPtr<T> adopt (T* obj) SMTG_NOEXCEPT { return IPtr<T> (obj, false); }

#endif
//------------------------------------------------------------------------
protected:
@@ -116,8 +148,11 @@ inline IPtr<I>::IPtr () : ptr (0)
template <class I>
inline IPtr<I>::~IPtr ()
{
if (ptr)
if (ptr)
{
ptr->release ();
ptr = nullptr; //TODO_CORE: how much does this cost? is this something hiding for us?
}
}

//------------------------------------------------------------------------
@@ -231,10 +266,10 @@ namespace Detail {
struct Adopt;
} // Detail

/** Strong typedef for shared reference counted objects.
* Use SKI::adopt to unwrap the provided object.
* @tparam T Referenced counted type.
*/
/** Strong typedef for shared reference counted objects.
* Use SKI::adopt to unwrap the provided object.
* @tparam T Referenced counted type.
*/
template <typename T>
class Shared
{
@@ -242,11 +277,11 @@ class Shared
T* obj = nullptr;
};

/** Strong typedef for transferring the ownership of reference counted objects.
* Use SKI::adopt to unwrap the provided object.
* After calling adopt the reference in this object is null.
* @tparam T Referenced counted type.
*/
/** Strong typedef for transferring the ownership of reference counted objects.
* Use SKI::adopt to unwrap the provided object.
* After calling adopt the reference in this object is null.
* @tparam T Referenced counted type.
*/
template <typename T>
class Owned
{
@@ -254,32 +289,32 @@ class Owned
T* obj = nullptr;
};

/** Strong typedef for using reference counted objects.
* Use SKI::adopt to unwrap the provided object.
* After calling adopt the reference in this object is null.
* @tparam T Referenced counted type.
*/
/** Strong typedef for using reference counted objects.
* Use SKI::adopt to unwrap the provided object.
* After calling adopt the reference in this object is null.
* @tparam T Referenced counted type.
*/
template <typename T>
class Used
{
friend struct Detail::Adopt;
T* obj = nullptr;
};
namespace Detail {

struct Adopt
struct Adopt
{
template <typename T>
static IPtr<T> adopt (Shared<T>& ref)
{
static IPtr<T> adopt (Shared<T>& ref)
{
using Steinberg::shared;
return shared (ref.obj);
return shared (ref.obj);
}

template <typename T>
static IPtr<T> adopt (Owned<T>& ref)
{
static IPtr<T> adopt (Owned<T>& ref)
{
using Steinberg::owned;
IPtr<T> out = owned (ref.obj);
ref.obj = nullptr;
@@ -293,11 +328,11 @@ struct Adopt
}

template <template <typename> class OwnerType, typename T>
static OwnerType<T> toOwnerType (T* obj)
{
static OwnerType<T> toOwnerType (T* obj)
{
OwnerType<T> out;
out.obj = obj;
return out;
return out;
}
};



+ 43
- 0
source/includes/vst3sdk/pluginterfaces/base/typesizecheck.h View File

@@ -0,0 +1,43 @@
//-----------------------------------------------------------------------------
// Project : SDK Core
//
// Category : SDK Core Interfaces
// Filename : pluginterfaces/base/typesizecheck.h
// Created by : Steinberg, 08/2018
// Description : Compile time type size check macro
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

#include "pluginterfaces/base/fplatform.h"

#if SMTG_CPP11
/** Check the size of a structure depending on compilation platform
* Used to check that structure sizes don't change between SDK releases.
*/
#define SMTG_TYPE_SIZE_CHECK(Type, Platform64Size, MacOS32Size, Win32Size, Linux32Size) \
namespace { \
template <typename Type, size_t w, size_t x, size_t y, size_t z> \
struct SizeCheck##Type \
{ \
constexpr SizeCheck##Type () \
{ \
static_assert (sizeof (Type) == (SMTG_PLATFORM_64 ? w : SMTG_OS_MACOS ? x : SMTG_OS_LINUX ? z : y), \
"Struct Size Error: " #Type); \
} \
}; \
static constexpr SizeCheck##Type<Type, Platform64Size, MacOS32Size, Win32Size, Linux32Size> instance##Type; \
}

#else
// need static_assert
#define SMTG_TYPE_SIZE_CHECK(Type, Platform64Size, MacOS32Size, Win32Size, Linux32Size)
#endif


+ 0
- 64
source/includes/vst3sdk/pluginterfaces/base/ucolorspec.h View File

@@ -1,64 +0,0 @@
//-----------------------------------------------------------------------------
// Project : SDK Core
//
// Category : SDK Core Interfaces
// Filename : pluginterfaces/base/ucolorspec.h
// Created by : Steinberg, 02/2006 (Host: S4.1)
// Description : GUI data types
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

#include "pluginterfaces/base/ftypes.h"

namespace Steinberg {

//------------------------------------------------------------------------
// Colors
typedef uint32 ColorSpec;
typedef uint8 ColorComponent;

typedef ColorSpec UColorSpec; // legacy support
typedef ColorComponent UColorComponent; // legacy support

/** Create color specifier with RGB values (alpha is opaque) */
inline ColorSpec MakeColorSpec (ColorComponent r, ColorComponent g, ColorComponent b)
{
return 0xFF000000 | ((ColorSpec)r) << 16 | ((ColorSpec)g) << 8 | (ColorSpec)b;
}
/** Create color specifier with RGBA values */
inline ColorSpec MakeColorSpec (ColorComponent r, ColorComponent g, ColorComponent b, ColorComponent a)
{
return ((ColorSpec)a) << 24 | ((ColorSpec)r) << 16 | ((ColorSpec)g) << 8 | (uint32)b;
}

inline ColorComponent GetBlue (ColorSpec cs) { return (ColorComponent)(cs & 0x000000FF); }
inline ColorComponent GetGreen (ColorSpec cs) { return (ColorComponent)((cs >> 8) & 0x000000FF); }
inline ColorComponent GetRed (ColorSpec cs) { return (ColorComponent)((cs >> 16) & 0x000000FF); }
inline ColorComponent GetAlpha (ColorSpec cs) { return (ColorComponent)((cs >> 24) & 0x000000FF); }

inline void SetBlue (ColorSpec& argb, ColorComponent b) { argb = (argb & 0xFFFFFF00) | (ColorSpec)(b); }
inline void SetGreen (ColorSpec& argb, ColorComponent g) { argb = (argb & 0xFFFF00FF) | (((ColorSpec)g) << 8); }
inline void SetRed (ColorSpec& argb, ColorComponent r) { argb = (argb & 0xFF00FFFF) | (((ColorSpec)r) << 16); }
inline void SetAlpha (ColorSpec& argb, ColorComponent a) { argb = (argb & 0x00FFFFFF) | (((ColorSpec)a) << 24); }

/** Normalized color components*/
/** { */
inline double NormalizeColorComponent (ColorComponent c) { return c / 255.0; }
inline ColorComponent DenormalizeColorComponent (double c) { return static_cast<ColorComponent> (c * 255.0); }

inline void SetAlphaNorm (ColorSpec& argb, double a) { SetAlpha (argb, DenormalizeColorComponent (a)); }
inline double GetAlphaNorm (ColorSpec cs) { return (NormalizeColorComponent (GetAlpha (cs))); }
inline double NormalizeAlpha (uint8 alpha) {return NormalizeColorComponent (alpha);}
inline ColorComponent DenormalizeAlpha (double alphaNorm) { return DenormalizeColorComponent (alphaNorm); }
/** } */
inline ColorSpec StripAlpha (ColorSpec argb) { return (argb & 0x00FFFFFF); }

}

+ 16
- 16
source/includes/vst3sdk/pluginterfaces/base/ustring.cpp View File

@@ -16,14 +16,14 @@

#include "ustring.h"

#if WINDOWS
#if SMTG_OS_WINDOWS
#include <stdio.h>
#pragma warning (disable : 4996)

#elif MAC
#elif SMTG_OS_MACOS
#include <CoreFoundation/CoreFoundation.h>

#elif LINUX
#elif SMTG_OS_LINUX
#include <cstring>
#include <string>
#include <codecvt>
@@ -39,7 +39,7 @@
namespace Steinberg {

//------------------------------------------------------------------------
#if LINUX
#if SMTG_OS_LINUX

//------------------------------------------------------------------------
namespace {
@@ -57,7 +57,7 @@ Converter& converter ()
} // anonymous

//------------------------------------------------------------------------
#endif // LINUX
#endif // SMTG_OS_LINUX

//------------------------------------------------------------------------
/** Copy strings of different character width. */
@@ -142,7 +142,7 @@ const UString& UString::toAscii (char* dst, int32 dstSize) const
//------------------------------------------------------------------------
bool UString::scanFloat (double& value) const
{
#if WINDOWS
#if SMTG_OS_WINDOWS
return swscanf ((const wchar_t*)thisBuffer, L"%lf", &value) != -1;

#elif TARGET_API_MAC_CARBON
@@ -155,7 +155,7 @@ bool UString::scanFloat (double& value) const
}
return false;

#elif LINUX
#elif SMTG_OS_LINUX
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lf", &value) == 1;

@@ -169,9 +169,9 @@ bool UString::scanFloat (double& value) const
//------------------------------------------------------------------------
bool UString::printFloat (double value, int32 precision)
{
#if WINDOWS
#if SMTG_OS_WINDOWS
return swprintf ((wchar_t*)thisBuffer, L"%.*lf", precision, value) != -1;
#elif MAC
#elif SMTG_OS_MACOS
bool result = false;
CFStringRef cfStr = CFStringCreateWithFormat (0, 0, CFSTR("%.*lf"), precision, value);
if (cfStr)
@@ -183,7 +183,7 @@ bool UString::printFloat (double value, int32 precision)
return true;
}
return result;
#elif LINUX
#elif SMTG_OS_LINUX
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%.*lf", precision, value);
if (len > 0)
@@ -207,10 +207,10 @@ bool UString::printFloat (double value, int32 precision)
//------------------------------------------------------------------------
bool UString::scanInt (int64& value) const
{
#if WINDOWS
#if SMTG_OS_WINDOWS
return swscanf ((const wchar_t*)thisBuffer, L"%I64d", &value) != -1;

#elif MAC
#elif SMTG_OS_MACOS
CFStringRef cfStr = CFStringCreateWithBytes (0, (const UInt8 *)thisBuffer, getLength () * 2, kCFStringEncodingUTF16, false);
if (cfStr)
{
@@ -220,7 +220,7 @@ bool UString::scanInt (int64& value) const
}
return false;

#elif LINUX
#elif SMTG_OS_LINUX
auto str = converter ().to_bytes (thisBuffer);
return sscanf (str.data (), "%lld", &value) == 1;

@@ -234,10 +234,10 @@ bool UString::scanInt (int64& value) const
//------------------------------------------------------------------------
bool UString::printInt (int64 value)
{
#if WINDOWS
#if SMTG_OS_WINDOWS
return swprintf ((wchar_t*)thisBuffer, L"%I64d", value) != -1;

#elif MAC
#elif SMTG_OS_MACOS
CFStringRef cfStr = CFStringCreateWithFormat (0, 0, CFSTR("%lld"), value);
if (cfStr)
{
@@ -248,7 +248,7 @@ bool UString::printInt (int64 value)
return true;
}
return false;
#elif LINUX
#elif SMTG_OS_LINUX
auto utf8Buffer = reinterpret_cast<char*> (thisBuffer);
auto len = snprintf (utf8Buffer, thisSize, "%lld", value);
if (len > 0)


+ 91
- 43
source/includes/vst3sdk/pluginterfaces/gui/iplugview.h View File

@@ -9,14 +9,15 @@
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

#include "../base/funknown.h"
#include "pluginterfaces/base/funknown.h"
#include "pluginterfaces/base/typesizecheck.h"

namespace Steinberg {

@@ -48,6 +49,8 @@ struct ViewRect
int32 getHeight () const { return bottom - top; }
};

SMTG_TYPE_SIZE_CHECK (ViewRect, 16, 16, 16, 16)

//------------------------------------------------------------------------
/** \defgroup platformUIType Platform UI Types
\ingroup pluginGUI
@@ -55,22 +58,25 @@ List of Platform UI types for IPlugView. This list is used to match the GUI-Syst
the host and a Plug-in in case that an OS provides multiple GUI-APIs.
*/
/*@{*/
/** The parent parameter in IPlugView::attached() is a HWND handle. You should attach a child window
* to it. */
/** The parent parameter in IPlugView::attached() is a HWND handle.
* You should attach a child window to it. */
const FIDString kPlatformTypeHWND = "HWND"; ///< HWND handle. (Microsoft Windows)

/** The parent parameter in IPlugView::attached() is a WindowRef. You should attach a HIViewRef to
* the content view of the window. */
/** The parent parameter in IPlugView::attached() is a WindowRef.
* You should attach a HIViewRef to the content view of the window. */
const FIDString kPlatformTypeHIView = "HIView"; ///< HIViewRef. (Mac OS X)

/** The parent parameter in IPlugView::attached() is a NSView pointer. You should attach a NSView to it. */
/** The parent parameter in IPlugView::attached() is a NSView pointer.
* You should attach a NSView to it. */
const FIDString kPlatformTypeNSView = "NSView"; ///< NSView pointer. (Mac OS X)

/** The parent parameter in IPlugView::attached() is a UIView pointer. You should attach an UIView to it. */
const FIDString kPlatformTypeUIView = "UIView"; ///< UIView pointer. (iOS)
/** The parent parameter in IPlugView::attached() is a UIView pointer.
* You should attach an UIView to it. */
const FIDString kPlatformTypeUIView = "UIView"; ///< UIView pointer. (iOS)

/** The parent parameter in IPlugView::attached() is a X11 Window supporting XEmbed. You should attach
* a Window to it. */
/** The parent parameter in IPlugView::attached() is a X11 Window supporting XEmbed.
* You should attach a Window to it that supports the XEmbed extension.
* See https://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html */
const FIDString kPlatformTypeX11EmbedWindowID = "X11EmbedWindowID"; ///< X11 Window ID. (X11)

/*@}*/
@@ -78,34 +84,33 @@ const FIDString kPlatformTypeX11EmbedWindowID = "X11EmbedWindowID"; ///< X11 Win

//------------------------------------------------------------------------
/** Plug-in definition of a view.
\ingroup pluginGUI
\ingroup pluginGUI vstIPlug vst300
- [plug imp]
- [released: 3.0.0]

\par Sizing of a view
Usually the size of a Plug-in view is fixed. But both the host and the Plug-in can cause
a view to be resized:
\n
- <b> Host </b> : If IPlugView::canResize () returns kResultTrue the host will setup the window
so that the user can resize it. While the user resizes the window IPlugView::checkSizeConstraint
()
is called, allowing the Plug-in to change the size to a valid rect. The host then resizes the
window to this rect and has to call IPlugView::onSize ().
so that the user can resize it. While the user resizes the window
IPlugView::checkSizeConstraint () is called, allowing the Plug-in to change the size to a valid
rect. The host then resizes the window to this rect and has to call IPlugView::onSize ().
\n
\n
- <b> Plug-in </b> : The Plug-in can call IPlugFrame::resizeView () and cause the host to resize the
window.
Afterwards the host has to call IPlugView::onSize () if a resize is needed (size was changed).
window.
Afterwards in the same callstack the host has to call IPlugView::onSize () if a resize is needed (size was changed).
Note that if the host calls IPlugView::getSize () before calling IPlugView::onSize () (if needed),
it will get the current (old) size not the wanted one!!
Here the calling sequence:
* plug-in->host: IPlugFrame::resizeView (newSize)
* host->plug-in (optional): IPlugView::getSize () returns the currentSize (not the wanted
newSize)!
* host->plug-in: if newSize is different than its actual current size: IPlugView::onSize
(newSize)
* host->plug-in (optional): IPlugView::getSize () returns the currentSize (not the newSize)!
* host->plug-in: if newSize is different from the current size: IPlugView::onSize (newSize)
* host->plug-in (optional): IPlugView::getSize () returns the newSize
\n
Please only resize the platform representation of the view when IPlugView::onSize () is called.
<b>Please only resize the platform representation of the view when IPlugView::onSize () is
called.</b>

\par Keyboard handling
The Plug-in view receives keyboard events from the host. A view implementation must not handle
@@ -116,7 +121,7 @@ cause a malfunction of the host's key command handling!
\see IPlugFrame, \ref platformUIType
*/
//------------------------------------------------------------------------
class IPlugView: public FUnknown
class IPlugView : public FUnknown
{
public:
//------------------------------------------------------------------------
@@ -125,9 +130,9 @@ public:
virtual tresult PLUGIN_API isPlatformTypeSupported (FIDString type) = 0;

/** The parent window of the view has been created, the (platform) representation of the view
should now be created as well.
should now be created as well.
Note that the parent is owned by the caller and you are not allowed to alter it in any way
other than adding your own views.
other than adding your own views.
Note that in this call the Plug-in could call a IPlugFrame::resizeView ()!
\param parent : platform handle of the parent window or view
\param type : \ref platformUIType which should be created */
@@ -160,7 +165,7 @@ public:
virtual tresult PLUGIN_API getSize (ViewRect* size) = 0;

/** Resizes the platform representation of the view to the given rect. Note that if the Plug-in
* requests a resize (IPlugFrame::resizeView ()) onSize has to be called afterward. */
* requests a resize (IPlugFrame::resizeView ()) onSize has to be called afterward. */
virtual tresult PLUGIN_API onSize (ViewRect* newSize) = 0;

/** Focus changed message. */
@@ -173,7 +178,7 @@ public:
virtual tresult PLUGIN_API canResize () = 0;

/** On live resize this is called to check if the view can be resized to the given rect, if not
* adjust the rect to the allowed size. */
* adjust the rect to the allowed size. */
virtual tresult PLUGIN_API checkSizeConstraint (ViewRect* rect) = 0;
//------------------------------------------------------------------------
static const FUID iid;
@@ -183,8 +188,10 @@ DECLARE_CLASS_IID (IPlugView, 0x5BC32507, 0xD06049EA, 0xA6151B52, 0x2B755B29)

//------------------------------------------------------------------------
/** Callback interface passed to IPlugView.
\ingroup pluginGUI
\ingroup pluginGUI vstIHost vst300
- [host imp]
- [released: 3.0.0]
- [mandatory]

Enables a Plug-in to resize the view and cause the host to resize the window.
*/
@@ -194,7 +201,7 @@ class IPlugFrame : public FUnknown
public:
//------------------------------------------------------------------------
/** Called to inform the host about the resize of a given view.
Afterwards the host has to call IPlugView::onSize (). */
* Afterwards the host has to call IPlugView::onSize (). */
virtual tresult PLUGIN_API resizeView (IPlugView* view, ViewRect* newSize) = 0;
//------------------------------------------------------------------------
static const FUID iid;
@@ -202,37 +209,78 @@ public:

DECLARE_CLASS_IID (IPlugFrame, 0x367FAF01, 0xAFA94693, 0x8D4DA2A0, 0xED0882A3)

#if SMTG_OS_LINUX
//------------------------------------------------------------------------
namespace Linux {

using TimerInterval = uint64;
using FileDescriptor = int;

//------------------------------------------------------------------------
class IPlugViewIdleHandler : public FUnknown
/** Linux event handler interface
\ingroup pluginGUI vst368
- [plug imp]
- [released: 3.6.8]
\see IRunLoop
*/
class IEventHandler : public FUnknown
{
public:
virtual void PLUGIN_API onPlugViewIdle () = 0;

virtual void PLUGIN_API onFDIsSet (FileDescriptor fd) = 0;
//------------------------------------------------------------------------
static const FUID iid;
};
DECLARE_CLASS_IID (IEventHandler, 0x561E65C9, 0x13A0496F, 0x813A2C35, 0x654D7983)

DECLARE_CLASS_IID (IPlugViewIdleHandler, 0x35BD6C3A, 0x9C1F4073, 0x89C7DA88, 0xBF6595D3)
//------------------------------------------------------------------------
/** Linux timer handler interface
\ingroup pluginGUI vst368
- [plug imp]
- [released: 3.6.8]
\see IRunLoop
*/
class ITimerHandler : public FUnknown
{
public:
virtual void PLUGIN_API onTimer () = 0;
//------------------------------------------------------------------------
static const FUID iid;
};
DECLARE_CLASS_IID (ITimerHandler, 0x10BDD94F, 0x41424774, 0x821FAD8F, 0xECA72CA9)

//------------------------------------------------------------------------
/** Extension to IPlugFrame
\ingroup pluginGUI
- [host impl]
/** Linux host run loop interface
\ingroup pluginGUI vst368
- [host imp]
- [extends IPlugFrame]
- [released: 3.6.8]

On Linux the host has to provide this interface to the plug-in as there's no global event run loop
defined as on other platforms.

A plug-in can register an event handler for a file descriptor. The host has to call the event
handler when the file descriptor is marked readable.

Enables a Plug-in to add an idle handler to the main event loop (Linux only)
A plug-in also can register a timer which will be called repeatedly until it is unregistered.
*/
//------------------------------------------------------------------------
class IPlugFrameIdle : public FUnknown
class IRunLoop : public FUnknown
{
public:
virtual tresult PLUGIN_API addIdleHandler (IPlugViewIdleHandler* handler) = 0;
virtual tresult PLUGIN_API removeIdleHandler (IPlugViewIdleHandler* handler) = 0;
virtual tresult PLUGIN_API registerEventHandler (IEventHandler* handler, FileDescriptor fd) = 0;
virtual tresult PLUGIN_API unregisterEventHandler (IEventHandler* handler) = 0;

virtual tresult PLUGIN_API registerTimer (ITimerHandler* handler,
TimerInterval milliseconds) = 0;
virtual tresult PLUGIN_API unregisterTimer (ITimerHandler* handler) = 0;
//------------------------------------------------------------------------
static const FUID iid;
};
DECLARE_CLASS_IID (IRunLoop, 0x18C35366, 0x97764F1A, 0x9C5B8385, 0x7A871389)

//------------------------------------------------------------------------
} // namespace Linux

DECLARE_CLASS_IID (IPlugFrameIdle, 0x31DE26C9, 0x36654639, 0x9F858E64, 0xE211817A)
#endif

//------------------------------------------------------------------------
} // namespace Steinberg

+ 9
- 4
source/includes/vst3sdk/pluginterfaces/gui/iplugviewcontentscalesupport.h View File

@@ -27,7 +27,7 @@ namespace Steinberg {

//------------------------------------------------------------------------
/** Plug-in view content scale support
\ingroup pluginGUI
\ingroup pluginGUI vstIPlug vst366
- [plug impl]
- [extends IPlugView]
- [optional]
@@ -36,9 +36,14 @@ This interface communicates the content scale factor from the host to the plug-i
systems where plug-ins cannot get this information directly like Microsoft Windows.

The host calls setContentScaleFactor directly after the plug view was attached and when the scale
factor changes (system change or window moved to another screen with different scaling settings)
When a plug-in handles this, it needs to scale the width and height of its view by the scale factor
and inform the host via a IPlugView::resizeView().
factor changes (system change or window moved to another screen with different scaling settings).
The host could call setContentScaleFactor in a different context, for example: scaling the
plug-in editor for better readability.
When a plug-in handles this (by returning kResultTrue), it needs to scale the width and height of
its view by the scale factor and inform the host via a IPlugFrame::resizeView(), the host will then
call IPlugView::onSize().

Note that the host is allowed to call setContentScaleFactor() at any time the IPlugView is alive.
*/
class IPlugViewContentScaleSupport : public FUnknown
{


+ 0
- 151
source/includes/vst3sdk/pluginterfaces/test/itest.h View File

@@ -1,151 +0,0 @@
//-----------------------------------------------------------------------------
// Project : SDK Core
// Version : 1.0
//
// Category : SDK Core Interfaces
// Filename : pluginterfaces/test/itest.h
// Created by : Steinberg, 01/2005
// Description : Test Interface - Availability Depends on HOST
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

#include "pluginterfaces/base/funknown.h"

#ifndef kTestClass
#define kTestClass "Test Class" ///< A class for automated tests
#endif

namespace Steinberg {

class ITestResult;

//------------------------------------------------------------------------
// ITest interface declaration
//------------------------------------------------------------------------
class ITest : public FUnknown
{
public:
//--- ---------------------------------------------------------------------
/** called immediately before the test is actually run.
Usually this will be used to setup the test environment.
\return true upon success */
virtual bool PLUGIN_API setup () = 0;

/** execute the test.
\param testResult : points to a test result where the test can
(optionally) add an error message.
\return true upon success
\sa ITestResult */
virtual bool PLUGIN_API run (ITestResult* testResult) = 0;

/** called after the test has run. This method shall be used to
deconstruct a test environment that has been setup with ITest::setup ().
\return true upon success */
virtual bool PLUGIN_API teardown () = 0;

/** This function is used to provide information about the performed
testcase. What is done, what is validated and what has to be prepared
before executing the test (in case of half-automated tests).
\return null terminated string upon success, zero otherwise */
virtual const tchar* PLUGIN_API getDescription () {return 0;}
//--- ---------------------------------------------------------------------
static const FUID iid;
};

#ifdef UNICODE
DECLARE_CLASS_IID (ITest, 0xFE64FC19, 0x95684F53, 0xAAA78DC8, 0x7228338E)
#else
DECLARE_CLASS_IID (ITest, 0x9E2E608B, 0x64C64CF8, 0x839059BD, 0xA194032D)
#endif

//------------------------------------------------------------------------
// ITestResult interface declaration
//------------------------------------------------------------------------
/** Test Result message logger
[host imp]
when a test is called, a pointer to an ITestResult is passed in, so the
test class can output error messages
*/
//------------------------------------------------------------------------
class ITestResult : public FUnknown
{
public:
//--- ---------------------------------------------------------------------
/** add an error message */
virtual void PLUGIN_API addErrorMessage (const tchar* msg) = 0;
virtual void PLUGIN_API addMessage (const tchar* msg) = 0;
//--- ---------------------------------------------------------------------
static const FUID iid;
};

#ifdef UNICODE
DECLARE_CLASS_IID (ITestResult, 0x69796279, 0xF651418B, 0xB24D79B7, 0xD7C527F4)
#else
DECLARE_CLASS_IID (ITestResult, 0xCE13B461, 0x5334451D, 0xB3943E99, 0x7446885B)
#endif

//------------------------------------------------------------------------
// ITestSuite interface declaration
//------------------------------------------------------------------------
/** A collection of tests supporting a hierarchical ordering
[host imp]
[create via hostclasses]*/
//------------------------------------------------------------------------
class ITestSuite : public FUnknown
{
public:
//--- ---------------------------------------------------------------------
/** append a new test */
virtual tresult PLUGIN_API addTest (FIDString name, ITest* test) = 0;

/** append an entire test suite as a child suite */
virtual tresult PLUGIN_API addTestSuite (FIDString name, ITestSuite* testSuite) = 0;

virtual tresult PLUGIN_API setEnvironment (ITest* environment) = 0;

//--- ---------------------------------------------------------------------
static const FUID iid;
};

#ifdef UNICODE
DECLARE_CLASS_IID (ITestSuite, 0x5CA7106F, 0x98784AA5, 0xB4D30D71, 0x2F5F1498)
#else
DECLARE_CLASS_IID (ITestSuite, 0x81724C94, 0xE9F64F65, 0xACB104E9, 0xCC702253)
#endif

//------------------------------------------------------------------------
// ITestFactory interface declaration
//------------------------------------------------------------------------
/** Class factory that any testable module defines for creating tests
that will be executed from the host
[plug imp] \n
*/
//------------------------------------------------------------------------
class ITestFactory : public FUnknown
{
public:
//--- ---------------------------------------------------------------------
/** create the tests that this module provides.
\param parentSuite : the test suite that the newly created tests
shall register with. */
virtual tresult PLUGIN_API createTests (FUnknown* context, ITestSuite* parentSuite) = 0;
//--- ---------------------------------------------------------------------
static const FUID iid;
};

#ifdef UNICODE
DECLARE_CLASS_IID (ITestFactory, 0xAB483D3A, 0x15264650, 0xBF86EEF6, 0x9A327A93)
#else
DECLARE_CLASS_IID (ITestFactory, 0xE77EA913, 0x58AA4838, 0x986A4620, 0x53579080)
#endif

//------------------------------------------------------------------------
} // namespace Steinberg

+ 2
- 1
source/includes/vst3sdk/pluginterfaces/vst/ivstattributes.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstattributes.h
@@ -32,6 +31,7 @@ namespace Vst {
\ingroup vstIHost vst300
- [host imp]
- [released: 3.0.0]
- [mandatory]

An attribute list associates values with a key (id: some predefined keys could be found in \ref presetAttributes). */
//------------------------------------------------------------------------
@@ -76,6 +76,7 @@ DECLARE_CLASS_IID (IAttributeList, 0x1E5F0AEB, 0xCC7F4533, 0xA2544011, 0x38AD5EE
- [host imp]
- [extends IBStream]
- [released: 3.6.0]
- [optional]

\code
...


+ 9
- 2
source/includes/vst3sdk/pluginterfaces/vst/ivstaudioprocessor.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstaudioprocessor.h
@@ -18,6 +17,7 @@
#pragma once

#include "ivstcomponent.h"
#include "vstspeaker.h"

//------------------------------------------------------------------------
#include "pluginterfaces/base/falignpush.h"
@@ -68,10 +68,11 @@ const CString kFxNetwork = "Fx|Network"; ///< using Network

const CString kInstrument = "Instrument"; ///< Effect used as instrument (sound generator), not as insert
const CString kInstrumentDrum = "Instrument|Drum"; ///< Instrument for Drum sounds
const CString kInstrumentExternal = "Instrument|External";///< External Instrument (wrapped Hardware)
const CString kInstrumentPiano = "Instrument|Piano"; ///< Instrument for Piano sounds
const CString kInstrumentSampler = "Instrument|Sampler"; ///< Instrument based on Samples
const CString kInstrumentSynth = "Instrument|Synth"; ///< Instrument based on Synthesis
const CString kInstrumentSynthSampler = "Instrument|Synth|Sampler"; ///< Instrument based on Synthesis and Samples
const CString kInstrumentExternal = "Instrument|External";///< External Instrument (wrapped Hardware)

const CString kSpatial = "Spatial"; ///< used for SurroundPanner
const CString kSpatialFx = "Spatial|Fx"; ///< used for SurroundPanner and as insert effect
@@ -80,6 +81,7 @@ const CString kOnlyOfflineProcess = "OnlyOfflineProcess"; ///< used for Plug-in
const CString kNoOfflineProcess = "NoOfflineProcess"; ///< will be NOT used for Plug-in offline processing (will work as normal insert Plug-in)
const CString kUpDownMix = "Up-Downmix"; ///< used for Mixconverter/Up-Mixer/Down-Mixer
const CString kAnalyzer = "Analyzer"; ///< Meter, Scope, FFT-Display, not selectable as insert plugin
const CString kAmbisonics = "Ambisonics"; ///< used for Ambisonics channel (FX or Panner/Mixconverter/Up-Mixer/Down-Mixer when combined with other category)

const CString kMono = "Mono"; ///< used for Mono only Plug-in [optional]
const CString kStereo = "Stereo"; ///< used for Stereo only Plug-in [optional]
@@ -307,6 +309,7 @@ DECLARE_CLASS_IID (IAudioProcessor, 0x42043F99, 0xB7DA453C, 0xA569E79D, 0x9AAEC3
- [plug imp]
- [extends IAudioProcessor]
- [released: 3.1.0]
- [optional]

Inform the Plug-in about how long from the moment of generation/acquiring (from file or from Input)
it will take for its input to arrive, and how long it will take for its output to be presented (to output or to Speaker).
@@ -323,6 +326,10 @@ A value of zero means either no latency or an unknown latency.
Each Plug-in adding a latency (returning a none zero value for IAudioProcessor::getLatencySamples) will modify the input
presentation latency of the next Plug-ins in the mixer routing graph and will modify the output presentation latency
of the previous Plug-ins.

\n
\image html "iaudiopresentationlatency_usage.png"
\n
\see IAudioProcessor
\see IComponent*/
//------------------------------------------------------------------------


+ 2
- 3
source/includes/vst3sdk/pluginterfaces/vst/ivstautomationstate.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstautomationstate.h
@@ -28,10 +27,10 @@ namespace Steinberg {
namespace Vst {

//------------------------------------------------------------------------
/** Extended IComponent interface for a component.
/** Extended Plug-in interface IEditController.
\ingroup vstIPlug vst365
- [plug imp]
- [extends IComponent]
- [extends IEditController]
- [released: 3.6.5]
- [optional]



+ 0
- 1
source/includes/vst3sdk/pluginterfaces/vst/ivstchannelcontextinfo.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstchannelcontextinfo.h


+ 20
- 32
source/includes/vst3sdk/pluginterfaces/vst/ivstcomponent.h View File

@@ -1,6 +1,5 @@
//-----------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstcomponent.h
@@ -41,59 +40,51 @@ const int32 kDefaultFactoryFlags = PFactoryInfo::kUnicode; ///< Standard value f

//------------------------------------------------------------------------
/** \defgroup vstBus VST Buses
Bus Description

A bus can be understood as a "collection of data channels" belonging together.
It describes a data input or a data output of the Plug-in.
A VST component can define any desired number of buses, but this number must \b never change.
Dynamic usage of buses is handled in the host by activating and deactivating buses.
The component has to define the maximum number of supported buses and it has to
define which of them are active by default. A host that can handle multiple buses,
allows the user to activate buses that were initially inactive.

See also: IComponent::getBusInfo, IComponent::activateBus

@{*/

//------------------------------------------------------------------------
/** Bus media types */
//------------------------------------------------------------------------
enum MediaTypes
{
//------------------------------------------------------------------------
kAudio = 0, ///< audio
kEvent, ///< events
kNumMediaTypes
//------------------------------------------------------------------------
};

//------------------------------------------------------------------------
/** Bus directions */
//------------------------------------------------------------------------
enum BusDirections
{
//------------------------------------------------------------------------
kInput = 0, ///< input bus
kOutput ///< output bus
//------------------------------------------------------------------------
};

//------------------------------------------------------------------------
/** Bus types */
//------------------------------------------------------------------------
enum BusTypes
{
//------------------------------------------------------------------------
kMain = 0, ///< main bus
kAux ///< auxiliary bus (sidechain)
//------------------------------------------------------------------------
};

//------------------------------------------------------------------------
/** Bus Description

A bus can be understood as a 'collection of data channels' belonging together.
It describes a data input or a data output of the Plug-in.
A VST component can define any desired number of buses, but this number must \b never change.
Dynamic usage of buses is handled in the host by activating and deactivating buses.
The component has to define the maximum number of supported buses and it has to
define which of them are active by default. A host that can handle multiple buses,
allows the user to activate buses that were initially inactive.

See also: IComponent::getBusInfo , IComponent::activateBus
*/
//------------------------------------------------------------------------
/** BusInfo:
This is the structure used with getBusInfo, informing the host about what is a specific given bus.
\n See also: IComponent::getBusInfo */
struct BusInfo
{
//------------------------------------------------------------------------
MediaType mediaType; ///< Media type - has to be a value of \ref MediaTypes
BusDirection direction; ///< input or output \ref BusDirections
int32 channelCount; ///< number of channels (if used then need to be recheck after \ref
@@ -107,14 +98,12 @@ struct BusInfo
{
kDefaultActive = 1 << 0 ///< bus active per default
};
//------------------------------------------------------------------------
};

/*@}*/

//------------------------------------------------------------------------
/** I/O modes */
//------------------------------------------------------------------------
enum IoModes
{
kSimple = 0, ///< 1:1 Input / Output. Only used for Instruments. See \ref vst3IoMode
@@ -123,12 +112,11 @@ enum IoModes
};

//------------------------------------------------------------------------
/** Routing Information.
When the Plug-in supports multiple I/O buses, a host may want to know how the
buses are related. The relation of an event-input-channel to an audio-output-bus
in particular is of interest to the host (in order to relate MIDI-tracks to audio-channels)
\n See also: IComponent::getRoutingInfo, \ref vst3Routing */
//------------------------------------------------------------------------
/** Routing Information:
When the Plug-in supports multiple I/O buses, a host may want to know how the buses are related. The
relation of an event-input-channel to an audio-output-bus in particular is of interest to the host
(in order to relate MIDI-tracks to audio-channels)
\n See also: IComponent::getRoutingInfo, \ref vst3Routing */
struct RoutingInfo
{
MediaType mediaType; ///< media type see \ref MediaTypes


+ 21
- 17
source/includes/vst3sdk/pluginterfaces/vst/ivstcontextmenu.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstcontextmenu.h
@@ -36,6 +35,7 @@ class IContextMenu;
- [host imp]
- [extends IComponentHandler]
- [released: 3.5.0]
- [optional]

A Plug-in can ask the host to create a context menu for a given exported Parameter ID or a generic context menu.\n

@@ -132,6 +132,7 @@ DECLARE_CLASS_IID (IComponentHandler3, 0x69F11617, 0xD26B400D, 0xA4B6B964, 0x7B6
- [host imp]
- [plug imp]
- [released: 3.5.0]
- [optional]

A receiver of a menu item should implement this interface, which will be called after the user has selected
this menu item.
@@ -150,12 +151,29 @@ public:

DECLARE_CLASS_IID (IContextMenuTarget, 0x3CDF2E75, 0x85D34144, 0xBF86D36B, 0xD7C4894D)

//------------------------------------------------------------------------
/** IContextMenuItem is an entry element of the context menu. */
struct IContextMenuItem
{
String128 name; ///< Name of the item
int32 tag; ///< Identifier tag of the item
int32 flags; ///< Flags of the item

enum Flags {
kIsSeparator = 1 << 0, ///< Item is a separator
kIsDisabled = 1 << 1, ///< Item is disabled
kIsChecked = 1 << 2, ///< Item is checked
kIsGroupStart = 1 << 3 | kIsDisabled, ///< Item is a group start (like sub folder)
kIsGroupEnd = 1 << 4 | kIsSeparator, ///< Item is a group end
};
};
//------------------------------------------------------------------------
/** Context Menu Interface.
\ingroup vstIHost vst350
- [host imp]
- [create with IComponentHandler3::createContextMenu(..)]
- [released: 3.5.0]
- [optional]

A context menu is composed of Item (entry). A Item is defined by a name, a tag, a flag
and a associated target (called when this item will be selected/executed).
@@ -167,22 +185,8 @@ See IComponentHandler3 for more.
class IContextMenu : public FUnknown
{
public:
/** Item is a entry element of the context menu. */
struct Item
{
String128 name; ///< Name of the item
int32 tag; ///< Identifier tag of the item
int32 flags; ///< Flags of the item

enum Flags {
kIsSeparator = 1 << 0, ///< Item is a separator
kIsDisabled = 1 << 1, ///< Item is disabled
kIsChecked = 1 << 2, ///< Item is checked
kIsGroupStart = 1 << 3 | kIsDisabled, ///< Item is a group start (like sub folder)
kIsGroupEnd = 1 << 4 | kIsSeparator, ///< Item is a group end
};
};

typedef IContextMenuItem Item;
/** Gets the number of menu items. */
virtual int32 PLUGIN_API getItemCount () = 0;



+ 36
- 2
source/includes/vst3sdk/pluginterfaces/vst/ivsteditcontroller.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivsteditcontroller.h
@@ -56,6 +55,7 @@ struct ParameterInfo
int32 flags; ///< ParameterFlags (see below)
enum ParameterFlags
{
kNoFlags = 0, ///< no flags wanted
kCanAutomate = 1 << 0, ///< parameter can be automated
kIsReadOnly = 1 << 1, ///< parameter cannot be changed from outside (implies that kCanAutomate is false)
kIsWrapAround = 1 << 2, ///< attempts to set the parameter value out of the limits will result in a wrap around [SDK 3.0.2]
@@ -88,7 +88,7 @@ enum RestartFlags
kLatencyChanged = 1 << 3, ///< Latency has changed (IAudioProcessor.getLatencySamples) [SDK 3.0.0]
kParamTitlesChanged = 1 << 4, ///< Parameter titles or default values or flags have changed [SDK 3.0.0]
kMidiCCAssignmentChanged = 1 << 5, ///< MIDI Controller Assignments have changed [SDK 3.0.1]
kNoteExpressionChanged = 1 << 6, ///< Note Expression has changed (info, count...) [SDK 3.5.0]
kNoteExpressionChanged = 1 << 6, ///< Note Expression has changed (info, count, PhysicalUIMapping, ...) [SDK 3.5.0]
kIoTitlesChanged = 1 << 7, ///< Input and/or Output bus titles have changed [SDK 3.5.0]
kPrefetchableSupportChanged = 1 << 8, ///< Prefetch support has changed (\see IPrefetchableSupport) [SDK 3.6.1]
kRoutingInfoChanged = 1 << 9 ///< RoutingInfo has changed (\see IComponent) [SDK 3.6.6]
@@ -99,6 +99,7 @@ enum RestartFlags
\ingroup vstIHost vst300
- [host imp]
- [released: 3.0.0]
- [mandatory]

Allow transfer of parameter editing to component (processor) via host and support automation.
Cause the host to react on configuration changes (restartComponent)
@@ -134,6 +135,7 @@ DECLARE_CLASS_IID (IComponentHandler, 0x93A0BEA3, 0x0BD045DB, 0x8E890B0C, 0xC1E4
- [host imp]
- [extends IComponentHandler]
- [released: 3.1.0]
- [optional]

One part handles:
- Setting dirty state of Plug-in
@@ -211,11 +213,41 @@ public:

DECLARE_CLASS_IID (IComponentHandler2, 0xF040B4B3, 0xA36045EC, 0xABCDC045, 0xB4D5A2CC)

//------------------------------------------------------------------------
/** Extended Host callback interface IComponentHandlerBusActivation for an edit controller.
\ingroup vstIHost vst368
- [host imp]
- [extends IComponentHandler]
- [released: 3.6.8]
- [optional]

Allows the Plug-in to request the host to activate or deactivate a specific bus,
if the host accepts it will call later on IComponent::activateBus (see \ref IComponent::activateBus).
Useful especially for Instrument with more than 1 outputs, where the user could request
from the Plug-in UI a given output bus activation.

\see \ref IComponentHandler */
//------------------------------------------------------------------------
class IComponentHandlerBusActivation : public FUnknown
{
public:
//------------------------------------------------------------------------
/** request the host to activate or deactivate a specific bus. */
virtual tresult PLUGIN_API requestBusActivation (MediaType type, BusDirection dir, int32 index,
TBool state) = 0;

//------------------------------------------------------------------------
static const FUID iid;
};

DECLARE_CLASS_IID (IComponentHandlerBusActivation, 0x067D02C1, 0x5B4E274D, 0xA92D90FD, 0x6EAF7240)

//------------------------------------------------------------------------
/** Edit controller component interface.
\ingroup vstIPlug vst300
- [plug imp]
- [released: 3.0.0]
- [mandatory]

The Controller part of an effect or instrument with parameter handling (export, definition, conversion...).
\see IComponent::getControllerClassId, IMidiMapping */
@@ -290,6 +322,7 @@ typedef int32 KnobMode; ///< Knob Mode
- [plug imp]
- [extends IEditController]
- [released: 3.1.0]
- [optional]

Extension to inform the Plug-in about the host Knob Mode,
and to open the Plug-in about box or help documentation.
@@ -324,6 +357,7 @@ DECLARE_CLASS_IID (IEditController2, 0x7F4EFE59, 0xF3204967, 0xAC27A3AE, 0xAFB63
- [plug imp]
- [extends IEditController]
- [released: 3.0.1]
- [optional]

MIDI controllers are not transmitted directly to a VST component. MIDI as hardware protocol has
restrictions that can be avoided in software. Controller data in particular come along with unclear


+ 52
- 40
source/includes/vst3sdk/pluginterfaces/vst/ivstevents.h View File

@@ -1,11 +1,10 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstevents.h
// Created by : Steinberg, 11/2005
// Description : VST Events (MIDI) Interfaces
// Description : VST Events Interfaces
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
@@ -31,37 +30,37 @@ namespace Vst {
/** Note-on event specific data. Used in \ref Event (union)*/
struct NoteOnEvent
{
int16 channel; ///< channel index in event bus
int16 pitch; ///< range [0, 127] = [C-2, G8] with A3=440Hz
float tuning; ///< 1.f = +1 cent, -1.f = -1 cent
float velocity; ///< range [0.0, 1.0]
int32 length; ///< in sample frames (optional, Note Off has to follow in any case!)
int32 noteId; ///< note identifier (if not available then -1)
int16 channel; ///< channel index in event bus
int16 pitch; ///< range [0, 127] = [C-2, G8] with A3=440Hz
float tuning; ///< 1.f = +1 cent, -1.f = -1 cent
float velocity; ///< range [0.0, 1.0]
int32 length; ///< in sample frames (optional, Note Off has to follow in any case!)
int32 noteId; ///< note identifier (if not available then -1)
};

//------------------------------------------------------------------------
/** Note-off event specific data. Used in \ref Event (union)*/
struct NoteOffEvent
{
int16 channel; ///< channel index in event bus
int16 pitch; ///< range [0, 127] = [C-2, G8] with A3=440Hz
float velocity; ///< range [0.0, 1.0]
int32 noteId; ///< associated noteOn identifier (if not available then -1)
float tuning; ///< 1.f = +1 cent, -1.f = -1 cent
int16 channel; ///< channel index in event bus
int16 pitch; ///< range [0, 127] = [C-2, G8] with A3=440Hz
float velocity; ///< range [0.0, 1.0]
int32 noteId; ///< associated noteOn identifier (if not available then -1)
float tuning; ///< 1.f = +1 cent, -1.f = -1 cent
};

//------------------------------------------------------------------------
/** Data event specific data. Used in \ref Event (union)*/
struct DataEvent
{
uint32 size; ///< size in bytes of the data block bytes
uint32 type; ///< type of this data block (see \ref DataTypes)
const uint8* bytes; ///< pointer to the data block
uint32 size; ///< size in bytes of the data block bytes
uint32 type; ///< type of this data block (see \ref DataTypes)
const uint8* bytes; ///< pointer to the data block

/** Value for DataEvent::type */
enum DataTypes
{
kMidiSysEx = 0 ///< for MIDI system exclusive message
kMidiSysEx = 0 ///< for MIDI system exclusive message
};
};

@@ -69,33 +68,43 @@ struct DataEvent
/** PolyPressure event specific data. Used in \ref Event (union)*/
struct PolyPressureEvent
{
int16 channel; ///< channel index in event bus
int16 pitch; ///< range [0, 127] = [C-2, G8] with A3=440Hz
float pressure; ///< range [0.0, 1.0]
int32 noteId; ///< event should be applied to the noteId (if not -1)
int16 channel; ///< channel index in event bus
int16 pitch; ///< range [0, 127] = [C-2, G8] with A3=440Hz
float pressure; ///< range [0.0, 1.0]
int32 noteId; ///< event should be applied to the noteId (if not -1)
};

//------------------------------------------------------------------------
/** Chord event specific data. Used in \ref Event (union)*/
struct ChordEvent
{
int16 root; ///< range [0, 127] = [C-2, G8] with A3=440Hz
int16 bassNote; ///< range [0, 127] = [C-2, G8] with A3=440Hz
int16 mask; ///< root is bit 0
uint16 textLen; ///< the number of characters (TChar) between the beginning of text and the terminating
///< null character (without including the terminating null character itself)
const TChar* text; ///< UTF-16, null terminated Hosts Chord Name
int16 root; ///< range [0, 127] = [C-2, G8] with A3=440Hz
int16 bassNote; ///< range [0, 127] = [C-2, G8] with A3=440Hz
int16 mask; ///< root is bit 0
uint16 textLen; ///< the number of characters (TChar) between the beginning of text and the terminating
///< null character (without including the terminating null character itself)
const TChar* text; ///< UTF-16, null terminated Hosts Chord Name
};

//------------------------------------------------------------------------
/** Scale event specific data. Used in \ref Event (union)*/
struct ScaleEvent
{
int16 root; ///< range [0, 127] = root Note/Transpose Factor
int16 mask; ///< Bit 0 = C, Bit 1 = C#, ... (0x5ab5 = Major Scale)
uint16 textLen; ///< the number of characters (TChar) between the beginning of text and the terminating
///< null character (without including the terminating null character itself)
const TChar* text; ///< UTF-16, null terminated, Hosts Scale Name
int16 root; ///< range [0, 127] = root Note/Transpose Factor
int16 mask; ///< Bit 0 = C, Bit 1 = C#, ... (0x5ab5 = Major Scale)
uint16 textLen; ///< the number of characters (TChar) between the beginning of text and the terminating
///< null character (without including the terminating null character itself)
const TChar* text; ///< UTF-16, null terminated, Hosts Scale Name
};

//------------------------------------------------------------------------
/** Legacy MIDI CC Out event specific data. Used in \ref Event (union)*/
struct LegacyMIDICCOutEvent
{
uint8 controlNumber;///< see enum ControllerNumbers [0, 255]
int8 channel; ///< channel index in event bus [0, 15]
int8 value; ///< value of Controller [0, 127]
int8 value2; ///< [0, 127] used for pitch bend (kPitchBend) and polyPressure (kCtrlPolyPressure)
};

//------------------------------------------------------------------------
@@ -120,14 +129,15 @@ struct Event
/** Event Types - used for Event::type */
enum EventTypes
{
kNoteOnEvent = 0, ///< is \ref NoteOnEvent
kNoteOffEvent, ///< is \ref NoteOffEvent
kDataEvent, ///< is \ref DataEvent
kPolyPressureEvent, ///< is \ref PolyPressureEvent
kNoteExpressionValueEvent, ///< is \ref NoteExpressionValueEvent
kNoteExpressionTextEvent, ///< is \ref NoteExpressionTextEvent
kChordEvent, ///< is \ref ChordEvent
kScaleEvent ///< is \ref ScaleEvent
kNoteOnEvent = 0, ///< is \ref NoteOnEvent
kNoteOffEvent = 1, ///< is \ref NoteOffEvent
kDataEvent = 2, ///< is \ref DataEvent
kPolyPressureEvent = 3, ///< is \ref PolyPressureEvent
kNoteExpressionValueEvent = 4, ///< is \ref NoteExpressionValueEvent
kNoteExpressionTextEvent = 5, ///< is \ref NoteExpressionTextEvent
kChordEvent = 6, ///< is \ref ChordEvent
kScaleEvent = 7, ///< is \ref ScaleEvent
kLegacyMIDICCOutEvent = 65535 ///< is \ref LegacyMIDICCOutEvent
};

uint16 type; ///< a value from \ref EventTypes
@@ -141,6 +151,7 @@ struct Event
NoteExpressionTextEvent noteExpressionText; ///< type == kNoteExpressionTextEvent
ChordEvent chord; ///< type == kChordEvent
ScaleEvent scale; ///< type == kScaleEvent
LegacyMIDICCOutEvent midiCCOut; ///< type == kLegacyMIDICCOutEvent
};
};

@@ -149,6 +160,7 @@ struct Event
\ingroup vstIHost vst300
- [host imp]
- [released: 3.0.0]
- [mandatory]

\see ProcessData, Event */
//------------------------------------------------------------------------


+ 65
- 1
source/includes/vst3sdk/pluginterfaces/vst/ivsthostapplication.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivsthostapplication.h
@@ -27,6 +26,8 @@ namespace Vst {
\ingroup vstIHost vst300
- [host imp]
- [passed as 'context' in to IPluginBase::initialize () ]
- [released: 3.0.0]
- [mandatory]

Basic VST host application interface. */
//------------------------------------------------------------------------
@@ -62,6 +63,8 @@ inline IMessage* allocateMessage (IHostApplication* host)
\ingroup vstIHost vst310
- [host imp]
- [passed as 'context' to IPluginBase::initialize () ]
- [released: 3.1.0]
- [mandatory]

Informs the Plug-in that a VST 3 to VST 2 wrapper is used between the Plug-in and the real host.
Implemented by the VST 2 Wrapper. */
@@ -80,6 +83,8 @@ DECLARE_CLASS_IID (IVst3ToVst2Wrapper, 0x29633AEC, 0x1D1C47E2, 0xBB85B97B, 0xD36
\ingroup vstIHost vst310
- [host imp]
- [passed as 'context' to IPluginBase::initialize () ]
- [released: 3.1.0]
- [mandatory]

Informs the Plug-in that a VST 3 to AU wrapper is used between the Plug-in and the real host.
Implemented by the AU Wrapper. */
@@ -93,6 +98,65 @@ public:

DECLARE_CLASS_IID (IVst3ToAUWrapper, 0xA3B8C6C5, 0xC0954688, 0xB0916F0B, 0xB697AA44)

//------------------------------------------------------------------------
/** VST 3 to AAX Wrapper Interface.
\ingroup vstIHost vst368
- [host imp]
- [passed as 'context' to IPluginBase::initialize () ]
- [released: 3.6.8]
- [mandatory]

Informs the Plug-in that a VST 3 to AAX wrapper is used between the Plug-in and the real host.
Implemented by the AAX Wrapper. */
//------------------------------------------------------------------------
class IVst3ToAAXWrapper : public FUnknown
{
public:
//------------------------------------------------------------------------
static const FUID iid;
};
DECLARE_CLASS_IID (IVst3ToAAXWrapper, 0x6D319DC6, 0x60C56242, 0xB32C951B, 0x93BEF4C6)

//------------------------------------------------------------------------
/** Wrapper MPE Support Interface
\ingroup vstIHost vst3612
- [host imp]
- [passed as 'context' to IPluginBase::initialize () ]
- [released: 3.6.12]
- [optional]

Implemented on wrappers that support MPE to Note Expression translation.

Per default MPE input processing is enabled, the masterChannel will be zero, the memberBeginChannel
will be one and the memberEndChannel will be 14.

As MPE is a subset of the VST3 Note Expression feature, mapping from the three MPE expressions is
handled via the INoteExpressionPhysicalUIMapping interface.
*/
//------------------------------------------------------------------------
class IVst3WrapperMPESupport : public FUnknown
{
public:
//------------------------------------------------------------------------
/** enable or disable MPE processing
* @param state true to enable, false to disable MPE processing
* @return kResultTrue on success */
virtual tresult PLUGIN_API enableMPEInputProcessing (TBool state) = 0;
/** setup the MPE processing
* @param masterChannel MPE master channel (zero based)
* @param memberBeginChannel MPE member begin channel (zero based)
* @param memberEndChannel MPE member end channel (zero based)
* @return kResultTrue on success */
virtual tresult PLUGIN_API setMPEInputDeviceSettings (int32 masterChannel,
int32 memberBeginChannel,
int32 memberEndChannel) = 0;

//------------------------------------------------------------------------
static const FUID iid;
};

DECLARE_CLASS_IID (IVst3WrapperMPESupport, 0x44149067, 0x42CF4BF9, 0x8800B750, 0xF7359FE3)

//------------------------------------------------------------------------
} // namespace Vst
} // namespace Steinberg

+ 1
- 1
source/includes/vst3sdk/pluginterfaces/vst/ivstinterappaudio.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstinterappaudio.h
@@ -32,6 +31,7 @@ class IInterAppAudioPresetManager;
- [host imp]
- [passed as 'context' to IPluginBase::initialize () ]
- [released: 3.6.0]
- [optional]

Implemented by the InterAppAudio Wrapper. */
//------------------------------------------------------------------------


+ 2
- 1
source/includes/vst3sdk/pluginterfaces/vst/ivstmessage.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstmessage.h
@@ -32,6 +31,7 @@ namespace Vst {
- [host imp]
- [create via IHostApplication::createInstance]
- [released: 3.0.0]
- [mandatory]

Messages are sent from a VST-controller component to a VST-editor component and vice versa.
\see IAttributeList, IConnectionPoint, \ref vst3Communication */
@@ -61,6 +61,7 @@ DECLARE_CLASS_IID (IMessage, 0x936F033B, 0xC6C047DB, 0xBB0882F8, 0x13C1E613)
- [plug imp]
- [host imp]
- [released: 3.0.0]
- [mandatory]

This interface is used for the communication of separate components.
Note that some hosts will place a proxy object between the components so that they are not directly connected.


+ 8
- 3
source/includes/vst3sdk/pluginterfaces/vst/ivstmidicontrollers.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstmidicontrollers.h
@@ -103,9 +102,15 @@ enum ControllerNumbers

//---Extra--------------------------
kAfterTouch = 128, ///< After Touch
kPitchBend, ///< Pitch Bend
kPitchBend = 129, ///< Pitch Bend

kCountCtrlNumber ///< Count of Controller Number
kCountCtrlNumber, ///< Count of Controller Number

//---Extra for kLegacyMIDICCOutEvent-
kCtrlProgramChange = 130, ///< Program Change (use LegacyMIDICCOutEvent.value only)
kCtrlPolyPressure = 131, ///< Poly Pressure (use LegacyMIDICCOutEvent.value for pitch and
/// LegacyMIDICCOutEvent.value2 for pressure)
kCtrlQuarterFrame = 132 ///< Quarter Frame ((use LegacyMIDICCOutEvent.value only)
};

//------------------------------------------------------------------------


+ 57
- 0
source/includes/vst3sdk/pluginterfaces/vst/ivstmidilearn.h View File

@@ -0,0 +1,57 @@
//------------------------------------------------------------------------
// Project : VST SDK
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstmidilearn.h
// Created by : Steinberg, 11/2018
// Description : VST MIDI Learn
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

#include "pluginterfaces/base/funknown.h"
#include "pluginterfaces/vst/vsttypes.h"

//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {

//------------------------------------------------------------------------
/** MIDI Learn Interface.
\ingroup vstIPlug vst3612
- [plug imp]
- [extends IEditController]
- [released: 3.6.12]
- [optional]

If this interface is implemented by the edit controller, the host will call this method whenever
there is live MIDI-CC input for the plug-in. This way the plug-in can change it's MIDI-CC parameter
mapping and inform the host via the IComponentHandler::restartComponent with the
kMidiCCAssignmentChanged flag.
Use this if you want to implement custom MIDI-Learn functionality in your plug-in.
*/
//------------------------------------------------------------------------
class IMidiLearn : public FUnknown
{
public:
/** Called on live input MIDI-CC change associated to a given bus index and MIDI channel */
virtual tresult PLUGIN_API onLiveMIDIControllerInput (int32 busIndex, int16 channel,
CtrlNumber midiCC) = 0;

//------------------------------------------------------------------------
static const FUID iid;
};

DECLARE_CLASS_IID (IMidiLearn, 0x6B2449CC, 0x419740B5, 0xAB3C79DA, 0xC5FE5C86)


//------------------------------------------------------------------------
} // namespace Vst
} // namespace Steinberg

+ 9
- 7
source/includes/vst3sdk/pluginterfaces/vst/ivstnoteexpression.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstnoteexpression.h
@@ -35,7 +34,7 @@ VST predefines some types like volume, pan, tuning by defining their ranges and
Used by NoteExpressionEvent::typeId and NoteExpressionTypeID::typeId
\see NoteExpressionTypeInfo
*/
enum NoteExpressionTypeIDs
enum NoteExpressionTypeIDs : uint32
{
kVolumeTypeID = 0, ///< Volume, plain range [0 = -oo , 0.25 = 0dB, 0.5 = +6dB, 1 = +12dB]: plain = 20 * log (4 * norm)
kPanTypeID, ///< Panning (L-R), plain range [0 = left, 0.5 = center, 1 = right]
@@ -48,7 +47,10 @@ enum NoteExpressionTypeIDs
kTextTypeID, ///< TODO:
kPhonemeTypeID, ///< TODO:

kCustomStart = 100000 ///< custom note change type ids must start from here
kCustomStart = 100000, ///< start of custom note expression type ids
kCustomEnd = 200000, ///< end of custom note expression type ids
kInvalidTypeID = 0xFFFFFFFF ///< indicates an invalid note expression type
};

//------------------------------------------------------------------------
@@ -67,7 +69,7 @@ struct NoteExpressionValueDescription
int32 stepCount; ///< number of discrete steps (0: continuous, 1: toggle, discrete value otherwise - see \ref vst3parameterIntro)
};

#if WINDOWS && !PLATFORM_64
#if SMTG_OS_WINDOWS && !SMTG_PLATFORM_64
#include "pluginterfaces/vst/vstpshpack4.h"
#endif
//------------------------------------------------------------------------
@@ -105,7 +107,7 @@ struct NoteExpressionTextEvent
const TChar* text; ///< UTF-16, null terminated
};

#if WINDOWS && !PLATFORM_64
#if SMTG_OS_WINDOWS && !SMTG_PLATFORM_64
#include "pluginterfaces/base/falignpop.h"
#endif

@@ -151,7 +153,7 @@ Note that there is only one NoteExpressionTypeID per given channel of an event b
The method getNoteExpressionStringByValue allows conversion from a normalized value to a string representation
and the getNoteExpressionValueByString method from a string to a normalized value.

When the note expression state changes (per example when switching presets) the Plug-in needs
When the note expression state changes (for example when switching presets) the Plug-in needs
to inform the host about it via \ref IComponentHandler::restartComponent (kNoteExpressionChanged).
*/
//------------------------------------------------------------------------
@@ -181,7 +183,7 @@ DECLARE_CLASS_IID (INoteExpressionController, 0xB7F8F859, 0x41234872, 0x91169581
/** KeyswitchTypeIDs describes the type of a key switch
\see KeyswitchInfo
*/
enum KeyswitchTypeIDs
enum KeyswitchTypeIDs : uint32
{
kNoteOnKeyswitchTypeID = 0, ///< press before noteOn is played
kOnTheFlyKeyswitchTypeID, ///< press while noteOn is played


+ 4
- 3
source/includes/vst3sdk/pluginterfaces/vst/ivstparameterchanges.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstparameterchanges.h
@@ -32,6 +31,7 @@ namespace Vst {
\ingroup vstIHost vst300
- [host imp]
- [released: 3.0.0]
- [mandatory]

The change queue can be interpreted as segment of an automation curve. For each
processing block a segment with the size of the block is transmitted to the processor.
@@ -105,11 +105,12 @@ DECLARE_CLASS_IID (IParamValueQueue, 0x01263A18, 0xED074F6F, 0x98C9D356, 0x4686F
\ingroup vstIHost vst300
- [host imp]
- [released: 3.0.0]
- [mandatory]

This interface is used to transmit any changes that shall be applied to paramaters
This interface is used to transmit any changes that shall be applied to parameters
in the current processing block. A change can be caused by GUI interaction as
well as automation. They are transmitted as a list of queues (IParamValueQueue)
containing only queues for paramaters that actually did change.
containing only queues for parameters that actually did change.
\see IParamValueQueue, ProcessData */
//----------------------------------------------------------------------
class IParameterChanges: public FUnknown


+ 130
- 0
source/includes/vst3sdk/pluginterfaces/vst/ivstphysicalui.h View File

@@ -0,0 +1,130 @@
//------------------------------------------------------------------------
// Project : VST SDK
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstphysicalui.h
// Created by : Steinberg, 06/2018
// Description : VST Physical User Interface support
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------
#pragma once
#include "pluginterfaces/vst/ivstnoteexpression.h"
//------------------------------------------------------------------------
#include "pluginterfaces/base/falignpush.h"
//------------------------------------------------------------------------
//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
typedef uint32 PhysicalUITypeID;
//------------------------------------------------------------------------
/** PhysicalUITypeIDs describes the type of Physical UI (PUI) which could be associated to a note
expression. \see PhysicalUIMap
*/
enum PhysicalUITypeIDs
{
/** absolute X position when touching keys of PUIs. Range [0=left, 0.5=middle, 1=right] */
kPUIXMovement = 0,
/** absolute Y position when touching keys of PUIs. Range [0=bottom/near, 0.5=center, 1=top/far] */
kPUIYMovement,
/** pressing a key down on keys of PUIs. Range [0=No Pressure, 1=Full Pressure] */
kPUIPressure,
kPUITypeCount, ///< count of current defined PUIs
kInvalidPUITypeID = 0xFFFFFFFF ///< indicates an invalid or not initialized PUI type
};
//------------------------------------------------------------------------
/** PhysicalUIMap describes a mapping of a noteExpression Type to a Physical UI Type.
It is used in PhysicalUIMapList.
\see PhysicalUIMapList */
struct PhysicalUIMap
{
/** This represents the physical UI. /see PhysicalUITypeIDs, this is set by the caller of
* getPhysicalUIMapping */
PhysicalUITypeID physicalUITypeID;
/** This represents the associated noteExpression TypeID to the given physicalUITypeID. This
* will be filled by the plug-in in the call getPhysicalUIMapping, set it to kInvalidTypeID if
* no Note Expression is associated to the given PUI. */
NoteExpressionTypeID noteExpressionTypeID;
};
//------------------------------------------------------------------------
/** PhysicalUIMapList describes a list of PhysicalUIMap
\see INoteExpressionPhysicalUIMapping*/
struct PhysicalUIMapList
{
/** Count of entries in the map array, set by the caller of getPhysicalUIMapping. */
uint32 count;
/** Pointer to a list of PhysicalUIMap containing count entries. */
PhysicalUIMap* map;
};
//------------------------------------------------------------------------
/** Extended Plug-in interface IEditController for note expression event support
\ingroup vstIPlug vst3611
- [plug imp]
- [extends IEditController]
- [released: 3.6.11]
- [optional]
With this Plug-in interface, the host can retrieve the preferred physical mapping associated to note
expression supported by the Plug-in.
When the mapping changes (for example when switching presets) the Plug-in needs
to inform the host about it via \ref IComponentHandler::restartComponent (kNoteExpressionChanged).
\section INoteExpressionPhysicalUIMappingExample Example
\code
tresult PLUGIN_API myPlug::::getPhysicalUIMapping (int32 busIndex, int16 channel, PhysicalUIMapList& list)
{
if (busIndex == 0 && channel == 0)
{
for (uint32 i = 0; i < list.count; ++i)
{
NoteExpressionTypeID type = kInvalidTypeID;
if (kPUIXMovement == list.map[i].physicalUITypeID)
list.map[i].noteExpressionTypeID = kCustomStart + 1;
else if (kPUIYMovement == list.map[i].physicalUITypeID)
list.map[i].noteExpressionTypeID = kCustomStart + 2;
}
return kResultTrue;
}
return kResultFalse;
}
\endcode */
class INoteExpressionPhysicalUIMapping : public FUnknown
{
public:
/** Fills the list of mapped [physical UI (in) - note expression (out)] for a given bus index
* and channel. */
virtual tresult PLUGIN_API getPhysicalUIMapping (int32 busIndex, int16 channel,
PhysicalUIMapList& list) = 0;
//------------------------------------------------------------------------
static const FUID iid;
};
DECLARE_CLASS_IID (INoteExpressionPhysicalUIMapping, 0xB03078FF, 0x94D24AC8, 0x90CCD303, 0xD4133324)
//------------------------------------------------------------------------
} // namespace Vst
} // namespace Steinberg
//------------------------------------------------------------------------
#include "pluginterfaces/base/falignpop.h"
//------------------------------------------------------------------------

+ 64
- 0
source/includes/vst3sdk/pluginterfaces/vst/ivstpluginterfacesupport.h View File

@@ -0,0 +1,64 @@
//------------------------------------------------------------------------
// Project : VST SDK
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstpluginterfacesupport.h
// Created by : Steinberg, 11/2018
// Description : VST Interfaces
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

#include "pluginterfaces/base/funknown.h"
#include "vsttypes.h"

//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
/** Host callback interface for an edit controller.
\ingroup vstIHost vst3612
- [host imp]
- [released: 3.6.12]
- [optional]

Allow a Plug-in to ask the host if a given Plug-in interface is supported/used by the host.
It is implemented by the hostContext given when the component is initialized.

\code
tresult PLUGIN_API MyPluginController::initialize (FUnknown* context)
{
// ...
FUnknownPtr<IPlugInterfaceSupport> plugInterfaceSupport (context);
if (plugInterfaceSupport)
{
if (plugInterfaceSupport->isPlugInterfaceSupported (IMidiMapping::iid) == kResultTrue)
// IMidiMapping is used by the host
}
// ...
}
\endcode
\see IPluginBase */
//------------------------------------------------------------------------
class IPlugInterfaceSupport : public FUnknown
{
public:
/** Returns kResultTrue if the associated interface to the given _iid is supported/used by the host. */
virtual tresult PLUGIN_API isPlugInterfaceSupported (const TUID _iid) = 0;
//------------------------------------------------------------------------
static const FUID iid;
};

DECLARE_CLASS_IID (IPlugInterfaceSupport, 0x4FB58B9E, 0x9EAA4E0F, 0xAB361C1C, 0xCCB56FEA)

//------------------------------------------------------------------------
} // namespace Vst
} // namespace Steinberg

+ 1
- 1
source/includes/vst3sdk/pluginterfaces/vst/ivstplugview.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstplugview.h
@@ -35,6 +34,7 @@ namespace Vst {
- [plug imp]
- [extends IPlugView]
- [released: 3.0.2]
- [optional]

It is highly recommended to implement this interface.
A host can implement important functionality when a plug-in supports this interface.


+ 0
- 1
source/includes/vst3sdk/pluginterfaces/vst/ivstprefetchablesupport.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstprefetchablesupport.h


+ 0
- 1
source/includes/vst3sdk/pluginterfaces/vst/ivstprocesscontext.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstprocesscontext.h


+ 0
- 1
source/includes/vst3sdk/pluginterfaces/vst/ivstrepresentation.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstrepresentation.h


source/includes/vst3sdk/public.sdk/source/vst/vstspeakerarray.h → source/includes/vst3sdk/pluginterfaces/vst/ivsttestplugprovider.h View File

@@ -1,101 +1,89 @@
//-----------------------------------------------------------------------------
// Flags : clang-format SMTGSequencer
// Project : VST SDK
//
// Category : Helpers
// Filename : public.sdk/source/vst/vstspeakerarray,.h
// Created by : Steinberg, 04/2015
// Description : Helper class representing speaker arrangement as array of speaker types.
// Category : Validator
// Filename : public.sdk/source/vst/testsuite/iplugprovider.h
// Created by : Steinberg, 04/2005
// Description : VST Test Suite
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#pragma once

#include "pluginterfaces/vst/vsttypes.h"
#include "pluginterfaces/base/istringresult.h"
#include "pluginterfaces/vst/ivstcomponent.h"
#include "pluginterfaces/vst/ivsteditcontroller.h"

//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {

//------------------------------------------------------------------------
// SpeakerArray
/** Helper class representing speaker arrangement as array of speaker types. */
/** Test Helper.
* \ingroup TestClass
*
* This class provides access to the component and the controller of a plug-in when running a unit
* test (see ITest).
* You get this interface as the context argument in the ITestFactory::createTests method.
*/
//------------------------------------------------------------------------
class SpeakerArray
class ITestPlugProvider : public FUnknown
{
public:
//------------------------------------------------------------------------
SpeakerArray (SpeakerArrangement arr = 0)
{
setArrangement (arr);
}

enum { kMaxSpeakers = 64 };

typedef uint64 SpeakerType;

int32 total () const { return count; }
SpeakerType at (int32 index) const { return speaker[index]; }
/** get the component of the plug-in.
*
* The reference count of the component is increased in this function and you need to call
* releasePlugIn when done with the component.
*/
virtual IComponent* PLUGIN_API getComponent () = 0;
/** get the controller of the plug-in.
*
* The reference count of the controller is increased in this function and you need to call
* releasePlugIn when done with the controller.
*/
virtual IEditController* PLUGIN_API getController () = 0;
/** release the component and/or controller */
virtual tresult PLUGIN_API releasePlugIn (IComponent* component,
IEditController* controller) = 0;
/** get the sub categories of the plug-in */
virtual tresult PLUGIN_API getSubCategories (IStringResult& result) const = 0;
/** get the component UID of the plug-in */
virtual tresult PLUGIN_API getComponentUID (FUID& uid) const = 0;

void setArrangement (SpeakerArrangement arr)
{
count = 0;
memset (speaker, 0, sizeof (speaker));

for (int32 i = 0; i < kMaxSpeakers; i++)
{
SpeakerType mask = 1ll << i;
if (arr & mask)
speaker[count++] = mask;
}
}

SpeakerArrangement getArrangement () const
{
SpeakerArrangement arr = 0;
for (int32 i = 0; i < count; i++)
arr |= speaker[i];
return arr;
}

int32 getSpeakerIndex (SpeakerType which) const
{
for (int32 i = 0; i < count; i++)
if (speaker[i] == which)
return i;
return -1;
}
//------------------------------------------------------------------------
protected:
int32 count;
SpeakerType speaker[kMaxSpeakers];
static const FUID iid;
};

DECLARE_CLASS_IID (ITestPlugProvider, 0x86BE70EE, 0x4E99430F, 0x978F1E6E, 0xD68FB5BA)

//------------------------------------------------------------------------
} // namespace Vst
} // namespace Steinberg
} // Vst
} // Steinberg

+ 5
- 1
source/includes/vst3sdk/pluginterfaces/vst/ivstunits.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/ivstunits.h
@@ -71,6 +70,7 @@ static const int32 kAllProgramInvalid = -1; ///< all program information is inv
- [host imp]
- [extends IComponentHandler]
- [released: 3.0.0]
- [optional]

Host callback interface, used with IUnitInfo.
Retrieve via queryInterface from IComponentHandler.
@@ -102,6 +102,7 @@ DECLARE_CLASS_IID (IUnitHandler, 0x4B5147F8, 0x4654486B, 0x8DAB30BA, 0x163A3C56)
- [host imp]
- [extends IUnitHandler]
- [released: 3.6.5]
- [optional]

Host callback interface, used with IUnitInfo.
Retrieve via queryInterface from IComponentHandler.
@@ -128,6 +129,7 @@ DECLARE_CLASS_IID (IUnitHandler2, 0xF89F8CDF, 0x699E4BA5, 0x96AAC9A4, 0x81452B01
- [plug imp]
- [extends IEditController]
- [released: 3.0.0]
- [optional]

IUnitInfo describes the internal structure of the Plug-in.
- The root unit is the component itself, so getUnitCount must return 1 at least.
@@ -200,6 +202,7 @@ DECLARE_CLASS_IID (IUnitInfo, 0x3D4BD6B5, 0x913A4FD2, 0xA886E768, 0xA5EB92C1)
- [plug imp]
- [extends IComponent]
- [released: 3.0.0]
- [optional]

A component can either support program list data via this interface or
unit preset data (IUnitData), but not both!
@@ -231,6 +234,7 @@ DECLARE_CLASS_IID (IProgramListData, 0x8683B01F, 0x7B354F70, 0xA2651DEC, 0x353AF
- [plug imp]
- [extends IComponent]
- [released: 3.0.0]
- [optional]

A component can either support unit preset data via this interface or
program list data (IProgramListData), but not both!


+ 0
- 430
source/includes/vst3sdk/pluginterfaces/vst/vstpresetkeys.h View File

@@ -1,430 +0,0 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/vstpresetkeys.h
// Created by : Steinberg, 2006
// Description : VST Preset Keys
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once

#include "vsttypes.h"

//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
/** Predefined Preset Attributes */
//------------------------------------------------------------------------
namespace PresetAttributes
{
/**
\defgroup presetAttributes Predefined Preset Attributes*/
/*@{*/
const CString kPlugInName = "PlugInName"; ///< Plug-in name
const CString kPlugInCategory = "PlugInCategory"; ///< eg. "Fx|Dynamics", "Instrument", "Instrument|Synth"

const CString kInstrument = "MusicalInstrument";///< eg. instrument group (like 'Piano' or 'Piano|A. Piano')
const CString kStyle = "MusicalStyle"; ///< eg. 'Pop', 'Jazz', 'Classic'
const CString kCharacter = "MusicalCharacter"; ///< eg. instrument nature (like 'Soft' 'Dry' 'Acoustic')

const CString kStateType = "StateType"; ///< Type of the given state see \ref StateType : Project / Default Preset or Normal Preset
const CString kFilePathStringType = "FilePathString"; ///< Full file path string (if available) where the preset comes from (be sure to use a bigger string when asking for it (with 1024 characters))
/*@}*/
};

//------------------------------------------------------------------------
/** Predefined StateType used for Key kStateType */
//------------------------------------------------------------------------
namespace StateType {
/**
\defgroup stateType Context of State Restoration */
/*@{*/
//------------------------------------------------------------------------
const CString kProject = "Project"; ///< the state is restored from a project loading or it is saved in a project
const CString kDefault = "Default"; ///< the state is restored from a preset (marked as default) or the host wants to store a default state of the plug-in

//------------------------------------------------------------------------
/*@}*/
}

//------------------------------------------------------------------------
/** Predefined Musical Instrument */
//------------------------------------------------------------------------
namespace MusicalInstrument
{
/**
\defgroup musicalInstrument Predefined Musical Instrument */
/*@{*/
const CString kAccordion = "Accordion";
const CString kAccordionAccordion = "Accordion|Accordion";
const CString kAccordionHarmonica = "Accordion|Harmonica";
const CString kAccordionOther = "Accordion|Other";

const CString kBass = "Bass";
const CString kBassABass = "Bass|A. Bass";
const CString kBassEBass = "Bass|E. Bass";
const CString kBassSynthBass = "Bass|Synth Bass";
const CString kBassOther = "Bass|Other";

const CString kBrass = "Brass";
const CString kBrassFrenchHorn = "Brass|French Horn";
const CString kBrassTrumpet = "Brass|Trumpet";
const CString kBrassTrombone = "Brass|Trombone";
const CString kBrassTuba = "Brass|Tuba";
const CString kBrassSection = "Brass|Section";
const CString kBrassSynth = "Brass|Synth";
const CString kBrassOther = "Brass|Other";

const CString kChromaticPerc = "Chromatic Perc";
const CString kChromaticPercBell = "Chromatic Perc|Bell";
const CString kChromaticPercMallett = "Chromatic Perc|Mallett";
const CString kChromaticPercWood = "Chromatic Perc|Wood";
const CString kChromaticPercPercussion = "Chromatic Perc|Percussion";
const CString kChromaticPercTimpani = "Chromatic Perc|Timpani";
const CString kChromaticPercOther = "Chromatic Perc|Other";

const CString kDrumPerc = "Drum&Perc";
const CString kDrumPercDrumsetGM = "Drum&Perc|Drumset GM";
const CString kDrumPercDrumset = "Drum&Perc|Drumset";
const CString kDrumPercDrumMenues = "Drum&Perc|Drum Menues";
const CString kDrumPercBeats = "Drum&Perc|Beats";
const CString kDrumPercPercussion = "Drum&Perc|Percussion";
const CString kDrumPercKickDrum = "Drum&Perc|Kick Drum";
const CString kDrumPercSnareDrum = "Drum&Perc|Snare Drum";
const CString kDrumPercToms = "Drum&Perc|Toms";
const CString kDrumPercHiHats = "Drum&Perc|HiHats";
const CString kDrumPercCymbals = "Drum&Perc|Cymbals";
const CString kDrumPercOther = "Drum&Perc|Other";

const CString kEthnic = "Ethnic";
const CString kEthnicAsian = "Ethnic|Asian";
const CString kEthnicAfrican = "Ethnic|African";
const CString kEthnicEuropean = "Ethnic|European";
const CString kEthnicLatin = "Ethnic|Latin";
const CString kEthnicAmerican = "Ethnic|American";
const CString kEthnicAlien = "Ethnic|Alien";
const CString kEthnicOther = "Ethnic|Other";

const CString kGuitar = "Guitar/Plucked";
const CString kGuitarAGuitar = "Guitar/Plucked|A. Guitar";
const CString kGuitarEGuitar = "Guitar/Plucked|E. Guitar";
const CString kGuitarHarp = "Guitar/Plucked|Harp";
const CString kGuitarEthnic = "Guitar/Plucked|Ethnic";
const CString kGuitarOther = "Guitar/Plucked|Other";

const CString kKeyboard = "Keyboard";
const CString kKeyboardClavi = "Keyboard|Clavi";
const CString kKeyboardEPiano = "Keyboard|E. Piano";
const CString kKeyboardHarpsichord = "Keyboard|Harpsichord";
const CString kKeyboardOther = "Keyboard|Other";

const CString kMusicalFX = "Musical FX";
const CString kMusicalFXHitsStabs = "Musical FX|Hits&Stabs";
const CString kMusicalFXMotion = "Musical FX|Motion";
const CString kMusicalFXSweeps = "Musical FX|Sweeps";
const CString kMusicalFXBeepsBlips = "Musical FX|Beeps&Blips";
const CString kMusicalFXScratches = "Musical FX|Scratches";
const CString kMusicalFXOther = "Musical FX|Other";

const CString kOrgan = "Organ";
const CString kOrganElectric = "Organ|Electric";
const CString kOrganPipe = "Organ|Pipe";
const CString kOrganOther = "Organ|Other";

const CString kPiano = "Piano";
const CString kPianoAPiano = "Piano|A. Piano";
const CString kPianoEGrand = "Piano|E. Grand";
const CString kPianoOther = "Piano|Other";

const CString kSoundFX = "Sound FX";
const CString kSoundFXNature = "Sound FX|Nature";
const CString kSoundFXMechanical = "Sound FX|Mechanical";
const CString kSoundFXSynthetic = "Sound FX|Synthetic";
const CString kSoundFXOther = "Sound FX|Other";

const CString kStrings = "Strings";
const CString kStringsViolin = "Strings|Violin";
const CString kStringsViola = "Strings|Viola";
const CString kStringsCello = "Strings|Cello";
const CString kStringsBass = "Strings|Bass";
const CString kStringsSection = "Strings|Section";
const CString kStringsSynth = "Strings|Synth";
const CString kStringsOther = "Strings|Other";

const CString kSynthLead = "Synth Lead";
const CString kSynthLeadAnalog = "Synth Lead|Analog";
const CString kSynthLeadDigital = "Synth Lead|Digital";
const CString kSynthLeadArpeggio = "Synth Lead|Arpeggio";
const CString kSynthLeadOther = "Synth Lead|Other";

const CString kSynthPad = "Synth Pad";
const CString kSynthPadSynthChoir = "Synth Pad|Synth Choir";
const CString kSynthPadAnalog = "Synth Pad|Analog";
const CString kSynthPadDigital = "Synth Pad|Digital";
const CString kSynthPadMotion = "Synth Pad|Motion";
const CString kSynthPadOther = "Synth Pad|Other";

const CString kSynthComp = "Synth Comp";
const CString kSynthCompAnalog = "Synth Comp|Analog";
const CString kSynthCompDigital = "Synth Comp|Digital";
const CString kSynthCompOther = "Synth Comp|Other";

const CString kVocal = "Vocal";
const CString kVocalLeadVocal = "Vocal|Lead Vocal";
const CString kVocalAdlibs = "Vocal|Adlibs";
const CString kVocalChoir = "Vocal|Choir";
const CString kVocalSolo = "Vocal|Solo";
const CString kVocalFX = "Vocal|FX";
const CString kVocalSpoken = "Vocal|Spoken";
const CString kVocalOther = "Vocal|Other";

const CString kWoodwinds = "Woodwinds";
const CString kWoodwindsEthnic = "Woodwinds|Ethnic";
const CString kWoodwindsFlute = "Woodwinds|Flute";
const CString kWoodwindsOboe = "Woodwinds|Oboe";
const CString kWoodwindsEnglHorn = "Woodwinds|Engl. Horn";
const CString kWoodwindsClarinet = "Woodwinds|Clarinet";
const CString kWoodwindsSaxophone = "Woodwinds|Saxophone";
const CString kWoodwindsBassoon = "Woodwinds|Bassoon";
const CString kWoodwindsOther = "Woodwinds|Other";
/*@}*/
};

//------------------------------------------------------------------------
/** Predefined Musical Style */
//------------------------------------------------------------------------
namespace MusicalStyle
{
/**
\defgroup musicalStyle Predefined Musical Style */
/*@{*/
const CString kAlternativeIndie = "Alternative/Indie";
const CString kAlternativeIndieGothRock = "Alternative/Indie|Goth Rock";
const CString kAlternativeIndieGrunge = "Alternative/Indie|Grunge";
const CString kAlternativeIndieNewWave = "Alternative/Indie|New Wave";
const CString kAlternativeIndiePunk = "Alternative/Indie|Punk";
const CString kAlternativeIndieCollegeRock = "Alternative/Indie|College Rock";
const CString kAlternativeIndieDarkWave = "Alternative/Indie|Dark Wave";
const CString kAlternativeIndieHardcore = "Alternative/Indie|Hardcore";

const CString kAmbientChillOut = "Ambient/ChillOut";
const CString kAmbientChillOutNewAgeMeditation = "Ambient/ChillOut|New Age/Meditation";
const CString kAmbientChillOutDarkAmbient = "Ambient/ChillOut|Dark Ambient";
const CString kAmbientChillOutDowntempo = "Ambient/ChillOut|Downtempo";
const CString kAmbientChillOutLounge = "Ambient/ChillOut|Lounge";

const CString kBlues = "Blues";
const CString kBluesAcousticBlues = "Blues|Acoustic Blues";
const CString kBluesCountryBlues = "Blues|Country Blues";
const CString kBluesElectricBlues = "Blues|Electric Blues";
const CString kBluesChicagoBlues = "Blues|Chicago Blues";

const CString kClassical = "Classical";
const CString kClassicalBaroque = "Classical|Baroque";
const CString kClassicalChamberMusic = "Classical|Chamber Music";
const CString kClassicalMedieval = "Classical|Medieval";
const CString kClassicalModernComposition = "Classical|Modern Composition";
const CString kClassicalOpera = "Classical|Opera";
const CString kClassicalGregorian = "Classical|Gregorian";
const CString kClassicalRenaissance = "Classical|Renaissance";
const CString kClassicalClassic = "Classical|Classic";
const CString kClassicalRomantic = "Classical|Romantic";
const CString kClassicalSoundtrack = "Classical|Soundtrack";

const CString kCountry = "Country";
const CString kCountryCountryWestern = "Country|Country/Western";
const CString kCountryHonkyTonk = "Country|Honky Tonk";
const CString kCountryUrbanCowboy = "Country|Urban Cowboy";
const CString kCountryBluegrass = "Country|Bluegrass";
const CString kCountryAmericana = "Country|Americana";
const CString kCountrySquaredance = "Country|Squaredance";
const CString kCountryNorthAmericanFolk = "Country|North American Folk";

const CString kElectronicaDance = "Electronica/Dance";
const CString kElectronicaDanceMinimal = "Electronica/Dance|Minimal";
const CString kElectronicaDanceClassicHouse = "Electronica/Dance|Classic House";
const CString kElectronicaDanceElektroHouse = "Electronica/Dance|Elektro House";
const CString kElectronicaDanceFunkyHouse = "Electronica/Dance|Funky House";
const CString kElectronicaDanceIndustrial = "Electronica/Dance|Industrial";
const CString kElectronicaDanceElectronicBodyMusic = "Electronica/Dance|Electronic Body Music";
const CString kElectronicaDanceTripHop = "Electronica/Dance|Trip Hop";
const CString kElectronicaDanceTechno = "Electronica/Dance|Techno";
const CString kElectronicaDanceDrumNBassJungle = "Electronica/Dance|Drum'n'Bass/Jungle";
const CString kElectronicaDanceElektro = "Electronica/Dance|Elektro";
const CString kElectronicaDanceTrance = "Electronica/Dance|Trance";
const CString kElectronicaDanceDub = "Electronica/Dance|Dub";
const CString kElectronicaDanceBigBeats = "Electronica/Dance|Big Beats";

const CString kExperimental = "Experimental";
const CString kExperimentalNewMusic = "Experimental|New Music";
const CString kExperimentalFreeImprovisation = "Experimental|Free Improvisation";
const CString kExperimentalElectronicArtMusic = "Experimental|Electronic Art Music";
const CString kExperimentalNoise = "Experimental|Noise";

const CString kJazz = "Jazz";
const CString kJazzNewOrleansJazz = "Jazz|New Orleans Jazz";
const CString kJazzTraditionalJazz = "Jazz|Traditional Jazz";
const CString kJazzOldtimeJazzDixiland = "Jazz|Oldtime Jazz/Dixiland";
const CString kJazzFusion = "Jazz|Fusion";
const CString kJazzAvantgarde = "Jazz|Avantgarde";
const CString kJazzLatinJazz = "Jazz|Latin Jazz";
const CString kJazzFreeJazz = "Jazz|Free Jazz";
const CString kJazzRagtime = "Jazz|Ragtime";

const CString kPop = "Pop";
const CString kPopBritpop = "Pop|Britpop";
const CString kPopRock = "Pop|Pop/Rock";
const CString kPopTeenPop = "Pop|Teen Pop";
const CString kPopChartDance = "Pop|Chart Dance";
const CString kPop80sPop = "Pop|80's Pop";
const CString kPopDancehall = "Pop|Dancehall";
const CString kPopDisco = "Pop|Disco";

const CString kRockMetal = "Rock/Metal";
const CString kRockMetalBluesRock = "Rock/Metal|Blues Rock";
const CString kRockMetalClassicRock = "Rock/Metal|Classic Rock";
const CString kRockMetalHardRock = "Rock/Metal|Hard Rock";
const CString kRockMetalRockRoll = "Rock/Metal|Rock &amp; Roll";
const CString kRockMetalSingerSongwriter = "Rock/Metal|Singer/Songwriter";
const CString kRockMetalHeavyMetal = "Rock/Metal|Heavy Metal";
const CString kRockMetalDeathBlackMetal = "Rock/Metal|Death/Black Metal";
const CString kRockMetalNuMetal = "Rock/Metal|NuMetal";
const CString kRockMetalReggae = "Rock/Metal|Reggae";
const CString kRockMetalBallad = "Rock/Metal|Ballad";
const CString kRockMetalAlternativeRock = "Rock/Metal|Alternative Rock";
const CString kRockMetalRockabilly = "Rock/Metal|Rockabilly";
const CString kRockMetalThrashMetal = "Rock/Metal|Thrash Metal";
const CString kRockMetalProgressiveRock = "Rock/Metal|Progressive Rock";

const CString kUrbanHipHopRB = "Urban (Hip-Hop / R&B)";
const CString kUrbanHipHopRBClassic = "Urban (Hip-Hop / R&B)|Classic R&B";
const CString kUrbanHipHopRBModern = "Urban (Hip-Hop / R&B)|Modern R&B";
const CString kUrbanHipHopRBPop = "Urban (Hip-Hop / R&B)|R&B Pop";
const CString kUrbanHipHopRBWestCoastHipHop = "Urban (Hip-Hop / R&B)|WestCoast Hip-Hop";
const CString kUrbanHipHopRBEastCoastHipHop = "Urban (Hip-Hop / R&B)|EastCoast Hip-Hop";
const CString kUrbanHipHopRBRapHipHop = "Urban (Hip-Hop / R&B)|Rap/Hip Hop";
const CString kUrbanHipHopRBSoul = "Urban (Hip-Hop / R&B)|Soul";
const CString kUrbanHipHopRBFunk = "Urban (Hip-Hop / R&B)|Funk";

const CString kWorldEthnic = "World/Ethnic";
const CString kWorldEthnicAfrica = "World/Ethnic|Africa";
const CString kWorldEthnicAsia = "World/Ethnic|Asia";
const CString kWorldEthnicCeltic = "World/Ethnic|Celtic";
const CString kWorldEthnicEurope = "World/Ethnic|Europe";
const CString kWorldEthnicKlezmer = "World/Ethnic|Klezmer";
const CString kWorldEthnicScandinavia = "World/Ethnic|Scandinavia";
const CString kWorldEthnicEasternEurope = "World/Ethnic|Eastern Europe";
const CString kWorldEthnicIndiaOriental = "World/Ethnic|India/Oriental";
const CString kWorldEthnicNorthAmerica = "World/Ethnic|North America";
const CString kWorldEthnicSouthAmerica = "World/Ethnic|South America";
const CString kWorldEthnicAustralia = "World/Ethnic|Australia";
/*@}*/
};

//------------------------------------------------------------------------
/** Predefined Musical Character */
//------------------------------------------------------------------------
namespace MusicalCharacter
{
/**
\defgroup musicalCharacter Predefined Musical Character */
/*@{*/
//----TYPE------------------------------------
const CString kMono = "Mono";
const CString kPoly = "Poly";

const CString kSplit = "Split";
const CString kLayer = "Layer";

const CString kGlide = "Glide";
const CString kGlissando = "Glissando";

const CString kMajor = "Major";
const CString kMinor = "Minor";

const CString kSingle = "Single";
const CString kEnsemble = "Ensemble";

const CString kAcoustic = "Acoustic";
const CString kElectric = "Electric";

const CString kAnalog = "Analog";
const CString kDigital = "Digital";

const CString kVintage = "Vintage";
const CString kModern = "Modern";

const CString kOld = "Old";
const CString kNew = "New";

//----TONE------------------------------------
const CString kClean = "Clean";
const CString kDistorted = "Distorted";

const CString kDry = "Dry";
const CString kProcessed = "Processed";

const CString kHarmonic = "Harmonic";
const CString kDissonant = "Dissonant";

const CString kClear = "Clear";
const CString kNoisy = "Noisy";

const CString kThin = "Thin";
const CString kRich = "Rich";

const CString kDark = "Dark";
const CString kBright = "Bright";

const CString kCold = "Cold";
const CString kWarm = "Warm";

const CString kMetallic = "Metallic";
const CString kWooden = "Wooden";

const CString kGlass = "Glass";
const CString kPlastic = "Plastic";

//----ENVELOPE------------------------------------
const CString kPercussive = "Percussive";
const CString kSoft = "Soft";

const CString kFast = "Fast";
const CString kSlow = "Slow";

const CString kShort = "Short";
const CString kLong = "Long";

const CString kAttack = "Attack";
const CString kRelease = "Release";

const CString kDecay = "Decay";
const CString kSustain = "Sustain";

const CString kFastAttack = "Fast Attack";
const CString kSlowAttack = "Slow Attack";

const CString kShortRelease = "Short Release";
const CString kLongRelease = "Long Release";

const CString kStatic = "Static";
const CString kMoving = "Moving";

const CString kLoop = "Loop";
const CString kOneShot = "One Shot";
/*@}*/
};

//------------------------------------------------------------------------
} // namespace Vst
} // namespace Steinberg

+ 0
- 1
source/includes/vst3sdk/pluginterfaces/vst/vstpshpack4.h View File

@@ -1,6 +1,5 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/vstpshpack4.h


+ 825
- 0
source/includes/vst3sdk/pluginterfaces/vst/vstspeaker.h View File

@@ -0,0 +1,825 @@
//------------------------------------------------------------------------
// Project : VST SDK
//
// Category : Interfaces
// Filename : pluginterfaces/vst/vstspeaker.h
// Created by : Steinberg, 01/2018
// Description : common defines
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this distribution
// and at www.steinberg.net/sdklicenses.
// No part of the SDK, including this file, may be copied, modified, propagated,
// or distributed except according to the terms contained in the LICENSE file.
//-----------------------------------------------------------------------------

#pragma once
#include "vsttypes.h"

//#include "pluginterfaces/base/ftype.h"

//------------------------------------------------------------------------
namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
/** \defgroup speakerArrangements Speaker Arrangements
\image html "vst3_speaker_types.jpg"
\n
A SpeakerArrangement is a bitset combination of speakers. For example:
\code
const SpeakerArrangement kStereo = kSpeakerL | kSpeakerR; // => hex: 0x03 / binary: 0011.
\endcode*/
//------------------------------------------------------------------------

//------------------------------------------------------------------------
/** Speaker Definitions.
\ingroup speakerArrangements */
//------------------------------------------------------------------------
/**@{*/
const Speaker kSpeakerL = 1 << 0; ///< Left (L)
const Speaker kSpeakerR = 1 << 1; ///< Right (R)
const Speaker kSpeakerC = 1 << 2; ///< Center (C)
const Speaker kSpeakerLfe = 1 << 3; ///< Subbass (Lfe)
const Speaker kSpeakerLs = 1 << 4; ///< Left Surround (Ls)
const Speaker kSpeakerRs = 1 << 5; ///< Right Surround (Rs)
const Speaker kSpeakerLc = 1 << 6; ///< Left of Center (Lc) - Front Left Center
const Speaker kSpeakerRc = 1 << 7; ///< Right of Center (Rc) - Front Right Center
const Speaker kSpeakerS = 1 << 8; ///< Surround (S)
const Speaker kSpeakerCs = kSpeakerS; ///< Center of Surround (Cs) - Back Center - Surround (S)
const Speaker kSpeakerSl = 1 << 9; ///< Side Left (Sl)
const Speaker kSpeakerSr = 1 << 10; ///< Side Right (Sr)
const Speaker kSpeakerTc = 1 << 11; ///< Top Center Over-head, Top Middle (Tc)
const Speaker kSpeakerTfl = 1 << 12; ///< Top Front Left (Tfl)
const Speaker kSpeakerTfc = 1 << 13; ///< Top Front Center (Tfc)
const Speaker kSpeakerTfr = 1 << 14; ///< Top Front Right (Tfr)
const Speaker kSpeakerTrl = 1 << 15; ///< Top Rear/Back Left (Trl)
const Speaker kSpeakerTrc = 1 << 16; ///< Top Rear/Back Center (Trc)
const Speaker kSpeakerTrr = 1 << 17; ///< Top Rear/Back Right (Trr)
const Speaker kSpeakerLfe2 = 1 << 18; ///< Subbass 2 (Lfe2)
const Speaker kSpeakerM = 1 << 19; ///< Mono (M)

const Speaker kSpeakerACN0 = (Speaker)1 << 20; ///< Ambisonic ACN 0
const Speaker kSpeakerACN1 = (Speaker)1 << 21; ///< Ambisonic ACN 1
const Speaker kSpeakerACN2 = (Speaker)1 << 22; ///< Ambisonic ACN 2
const Speaker kSpeakerACN3 = (Speaker)1 << 23; ///< Ambisonic ACN 3
const Speaker kSpeakerACN4 = (Speaker)1 << 38; ///< Ambisonic ACN 4
const Speaker kSpeakerACN5 = (Speaker)1 << 39; ///< Ambisonic ACN 5
const Speaker kSpeakerACN6 = (Speaker)1 << 40; ///< Ambisonic ACN 6
const Speaker kSpeakerACN7 = (Speaker)1 << 41; ///< Ambisonic ACN 7
const Speaker kSpeakerACN8 = (Speaker)1 << 42; ///< Ambisonic ACN 8
const Speaker kSpeakerACN9 = (Speaker)1 << 43; ///< Ambisonic ACN 9
const Speaker kSpeakerACN10 = (Speaker)1 << 44; ///< Ambisonic ACN 10
const Speaker kSpeakerACN11 = (Speaker)1 << 45; ///< Ambisonic ACN 11
const Speaker kSpeakerACN12 = (Speaker)1 << 46; ///< Ambisonic ACN 12
const Speaker kSpeakerACN13 = (Speaker)1 << 47; ///< Ambisonic ACN 13
const Speaker kSpeakerACN14 = (Speaker)1 << 48; ///< Ambisonic ACN 14
const Speaker kSpeakerACN15 = (Speaker)1 << 49; ///< Ambisonic ACN 15

const Speaker kSpeakerTsl = 1 << 24; ///< Top Side Left (Tsl)
const Speaker kSpeakerTsr = 1 << 25; ///< Top Side Right (Tsr)
const Speaker kSpeakerLcs = 1 << 26; ///< Left of Center Surround (Lcs) - Back Left Center
const Speaker kSpeakerRcs = 1 << 27; ///< Right of Center Surround (Rcs) - Back Right Center

const Speaker kSpeakerBfl = 1 << 28; ///< Bottom Front Left (Bfl)
const Speaker kSpeakerBfc = 1 << 29; ///< Bottom Front Center (Bfc)
const Speaker kSpeakerBfr = 1 << 30; ///< Bottom Front Right (Bfr)

const Speaker kSpeakerPl = (Speaker)1 << 31; ///< Proximity Left (Pl)
const Speaker kSpeakerPr = (Speaker)1 << 32; ///< Proximity Right (Pr)

const Speaker kSpeakerBsl = (Speaker)1 << 33; ///< Bottom Side Left (Bsl)
const Speaker kSpeakerBsr = (Speaker)1 << 34; ///< Bottom Side Right (Bsr)
const Speaker kSpeakerBrl = (Speaker)1 << 35; ///< Bottom Rear Left (Brl)
const Speaker kSpeakerBrc = (Speaker)1 << 36; ///< Bottom Rear Center (Brc)
const Speaker kSpeakerBrr = (Speaker)1 << 37; ///< Bottom Rear Right (Brr)
//------------------------------------------------------------------------
/** @}*/

//------------------------------------------------------------------------
/** Speaker Arrangement Definitions (SpeakerArrangement)*/
//------------------------------------------------------------------------
namespace SpeakerArr
{
//------------------------------------------------------------------------
/** Speaker Arrangement Definitions.
\ingroup speakerArrangements */
/*@{*/
const SpeakerArrangement kEmpty = 0; ///< empty arrangement
const SpeakerArrangement kMono = kSpeakerM; ///< M
const SpeakerArrangement kStereo = kSpeakerL | kSpeakerR; ///< L R
const SpeakerArrangement kStereoSurround = kSpeakerLs | kSpeakerRs; ///< Ls Rs
const SpeakerArrangement kStereoCenter = kSpeakerLc | kSpeakerRc; ///< Lc Rc
const SpeakerArrangement kStereoSide = kSpeakerSl | kSpeakerSr; ///< Sl Sr
const SpeakerArrangement kStereoCLfe = kSpeakerC | kSpeakerLfe; ///< C Lfe
const SpeakerArrangement kStereoTF = kSpeakerTfl | kSpeakerTfr; ///< Tfl Tfr
const SpeakerArrangement kStereoTS = kSpeakerTsl | kSpeakerTsr; ///< Tsl Tsr
const SpeakerArrangement kStereoTR = kSpeakerTrl | kSpeakerTrr; ///< Trl Trr
const SpeakerArrangement kStereoBF = kSpeakerBfl | kSpeakerBfr; ///< Bfl Bfr

/** L R C */
const SpeakerArrangement k30Cine = kSpeakerL | kSpeakerR | kSpeakerC;
/** L R S */
const SpeakerArrangement k30Music = kSpeakerL | kSpeakerR | kSpeakerS;
/** L R C Lfe */
const SpeakerArrangement k31Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe;
/** L R Lfe S */
const SpeakerArrangement k31Music = kSpeakerL | kSpeakerR | kSpeakerLfe | kSpeakerS;
/** L R C S (LCRS) */
const SpeakerArrangement k40Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerS;
/** L R Ls Rs (Quadro) */
const SpeakerArrangement k40Music = kSpeakerL | kSpeakerR | kSpeakerLs | kSpeakerRs;
/** L R C Lfe S (LCRS+Lfe) */
const SpeakerArrangement k41Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerS;
/** L R Lfe Ls Rs (Quadro+Lfe) */
const SpeakerArrangement k41Music = kSpeakerL | kSpeakerR | kSpeakerLfe | kSpeakerLs | kSpeakerRs;
/** L R C Ls Rs */
const SpeakerArrangement k50 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs;
/** L R C Lfe Ls Rs */
const SpeakerArrangement k51 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs;
/** L R C Ls Rs Cs */
const SpeakerArrangement k60Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerCs;
/** L R Ls Rs Sl Sr */
const SpeakerArrangement k60Music = kSpeakerL | kSpeakerR | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr;
/** L R C Lfe Ls Rs Cs */
const SpeakerArrangement k61Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerCs;
/** L R Lfe Ls Rs Sl Sr */
const SpeakerArrangement k61Music = kSpeakerL | kSpeakerR | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr;
/** L R C Ls Rs Lc Rc */
const SpeakerArrangement k70Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc;
/** L R C Ls Rs Sl Sr */
const SpeakerArrangement k70Music = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr;
/** L R C Lfe Ls Rs Lc Rc */
const SpeakerArrangement k71Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc;
const SpeakerArrangement k71CineFullFront= k71Cine;
/** L R C Lfe Ls Rs Lcs Rcs */
const SpeakerArrangement k71CineFullRear = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerLcs | kSpeakerRcs;
/** L R C Lfe Ls Rs Sl Sr */
const SpeakerArrangement k71Music = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr;
const SpeakerArrangement k71CineSideFill = k71Music;
/** L R C Lfe Ls Rs Pl Pr */
const SpeakerArrangement k71Proximity = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerPl | kSpeakerPr;
/** L R C Ls Rs Lc Rc Cs */
const SpeakerArrangement k80Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc | kSpeakerCs;
/** L R C Ls Rs Cs Sl Sr */
const SpeakerArrangement k80Music = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerCs | kSpeakerSl | kSpeakerSr;
/** L R C Lfe Ls Rs Lc Rc Cs */
const SpeakerArrangement k81Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc | kSpeakerCs;
/** L R C Lfe Ls Rs Cs Sl Sr */
const SpeakerArrangement k81Music = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerCs | kSpeakerSl | kSpeakerSr;


/** First-Order with Ambisonic Channel Number (ACN) ordering and SN3D normalization */
const SpeakerArrangement kAmbi1stOrderACN = kSpeakerACN0 | kSpeakerACN1 | kSpeakerACN2 | kSpeakerACN3;
/** Second-Order with Ambisonic Channel Number (ACN) ordering and SN3D normalization */
const SpeakerArrangement kAmbi2cdOrderACN = kAmbi1stOrderACN | kSpeakerACN4 | kSpeakerACN5 | kSpeakerACN6 | kSpeakerACN7 | kSpeakerACN8;
/** Third-Order with Ambisonic Channel Number (ACN) ordering and SN3D normalization */
const SpeakerArrangement kAmbi3rdOrderACN = kAmbi2cdOrderACN | kSpeakerACN9 | kSpeakerACN10 | kSpeakerACN11 | kSpeakerACN12 | kSpeakerACN13 | kSpeakerACN14 | kSpeakerACN15;


/*-----------*/
/* 3D formats */
/*-----------*/
/** L R Ls Rs Tfl Tfr Trl Trr */
const SpeakerArrangement k80Cube = kSpeakerL | kSpeakerR | kSpeakerLs | kSpeakerRs | kSpeakerTfl| kSpeakerTfr| kSpeakerTrl | kSpeakerTrr;
/** L R C Lfe Ls Rs Cs Tc */
const SpeakerArrangement k71CineTopCenter = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerCs | kSpeakerTc;
/** L R C Lfe Ls Rs Cs Tfc */
const SpeakerArrangement k71CineCenterHigh = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerCs | kSpeakerTfc;
/** L R C Lfe Ls Rs Tfl Tfr */
const SpeakerArrangement k71CineFrontHigh = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerTfl | kSpeakerTfr;
const SpeakerArrangement k71MPEG3D = k71CineFrontHigh;
/** L R C Lfe Ls Rs Tsl Tsr */
const SpeakerArrangement k71CineSideHigh = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerTsl | kSpeakerTsr;

/** L R Lfe Ls Rs Tfl Tfc Tfr Bfc */
const SpeakerArrangement k81MPEG3D = kSpeakerL | kSpeakerR | kSpeakerLfe | kSpeakerLs | kSpeakerRs |
kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerBfc;

/** L R C Ls Rs Tfl Tfr Trl Trr */
const SpeakerArrangement k90 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs |
kSpeakerTfl| kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
const SpeakerArrangement k50_4 = k90;
/** L R C Lfe Ls Rs Tfl Tfr Trl Trr */
const SpeakerArrangement k91 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs |
kSpeakerTfl| kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
const SpeakerArrangement k51_4 = k91;

/** L R C Lfe Ls Rs Sl Sr Tsl Tsr */
const SpeakerArrangement k71_2 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs |
kSpeakerRs | kSpeakerSl | kSpeakerSr | kSpeakerTsl | kSpeakerTsr;
const SpeakerArrangement k91Atmos = k71_2;

/** L R C Ls Rs Tc Tfl Tfr Trl Trr */
const SpeakerArrangement k100 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs |
kSpeakerTc | kSpeakerTfl | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
/** L R C Lfe Ls Rs Tc Tfl Tfr Trl Trr */
const SpeakerArrangement k101 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs |
kSpeakerTc | kSpeakerTfl | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
const SpeakerArrangement k101MPEG3D = k101;

/** L R C Lfe Ls Rs Tfl Tfc Tfr Trl Trr Lfe2 */
const SpeakerArrangement k102 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs |
kSpeakerTfl| kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr | kSpeakerLfe2;

/** L R C Ls Rs Tc Tfl Tfc Tfr Trl Trr */
const SpeakerArrangement k110 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs |
kSpeakerTc | kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
/** L R C Lfe Ls Rs Tc Tfl Tfc Tfr Trl Trr */
const SpeakerArrangement k111 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs |
kSpeakerTc | kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;

/** L R C Ls Rs Sl Sr Tfl Tfr Trl Trr */
const SpeakerArrangement k70_4 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr |
kSpeakerTfl | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;

/** L R C Lfe Ls Rs Sl Sr Tfl Tfr Trl Trr */
const SpeakerArrangement k71_4 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr |
kSpeakerTfl | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
const SpeakerArrangement k111MPEG3D = k71_4;

/** L R C Lfe Ls Rs Lc Rc Tfl Tfc Tfr Trl Trr Lfe2 */
const SpeakerArrangement k122 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc |
kSpeakerTfl| kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr | kSpeakerLfe2;
/** L R C Ls Rs Sl Sr Tc Tfl Tfc Tfr Trl Trr */
const SpeakerArrangement k130 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr |
kSpeakerTc | kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
/** L R C Lfe Ls Rs Sl Sr Tc Tfl Tfc Tfr Trl Trr */
const SpeakerArrangement k131 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr |
kSpeakerTc | kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;

/** L R Ls Rs Sl Sr Tfl Tfr Trl Trr Bfl Bfr Brl Brr */
const SpeakerArrangement k140 = kSpeakerL | kSpeakerR | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr |
kSpeakerTfl | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr |
kSpeakerBfl | kSpeakerBfr | kSpeakerBrl | kSpeakerBrr;

/** L R C Lfe Ls Rs Lc Rc Cs Sl Sr Tc Tfl Tfc Tfr Trl Trc Trr Lfe2 Tsl Tsr Bfl Bfc Bfr */
const SpeakerArrangement k222 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc | kSpeakerCs | kSpeakerSl | kSpeakerSr |
kSpeakerTc | kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrc | kSpeakerTrr | kSpeakerLfe2 | kSpeakerTsl | kSpeakerTsr |
kSpeakerBfl| kSpeakerBfc | kSpeakerBfr;


//------------------------------------------------------------------------
/** Speaker Arrangement String Representation.
\ingroup speakerArrangements */
/*@{*/
const CString kStringEmpty = "";
const CString kStringMono = "Mono";
const CString kStringStereo = "Stereo";
const CString kStringStereoR = "Stereo (Ls Rs)";
const CString kStringStereoC = "Stereo (Lc Rc)";
const CString kStringStereoSide = "Stereo (Sl Sr)";
const CString kStringStereoCLfe = "Stereo (C LFE)";
const CString kStringStereoTF = "Stereo (Tfl Tfr)";
const CString kStringStereoTS = "Stereo (Tsl Tsr)";
const CString kStringStereoTR = "Stereo (Trl Trr)";
const CString kStringStereoBF = "Stereo (Bfl Bfr)";

const CString kString30Cine = "LRC";
const CString kString30Music = "LRS";
const CString kString31Cine = "LRC+LFE";
const CString kString31Music = "LRS+LFE";
const CString kString40Cine = "LRCS";
const CString kString40Music = "Quadro";
const CString kString41Cine = "LRCS+LFE";
const CString kString41Music = "Quadro+LFE";
const CString kString50 = "5.0";
const CString kString51 = "5.1";
const CString kString60Cine = "6.0 Cine";
const CString kString60Music = "6.0 Music";
const CString kString61Cine = "6.1 Cine";
const CString kString61Music = "6.1 Music";
const CString kString70Cine = "7.0 Cine (SDDS)";
const CString kString70Music = "7.0 Music (Dolby)";
const CString kString71Cine = "7.1 Cine (SDDS)";
const CString kString71Music = "7.1 Music (Dolby)";
const CString kString71CineTopCenter = "7.1 Cine Top Center";
const CString kString71CineCenterHigh = "7.1 Cine Center High";
const CString kString71CineFrontHigh = "7.1 Cine Front High";
const CString kString71CineSideHigh = "7.1 Cine Side High";
const CString kString71CineFullRear = "7.1 Cine Full Rear";
const CString kString71Proximity = "7.1 Proximity";
const CString kString80Cine = "8.0 Cine";
const CString kString80Music = "8.0 Music";
const CString kString80Cube = "8.0 Cube";
const CString kString81Cine = "8.1 Cine";
const CString kString81Music = "8.1 Music";
const CString kString102 = "10.2 Experimental";
const CString kString122 = "12.2";
const CString kString50_4 = "5.0.4";
const CString kString51_4 = "5.1.4";
const CString kString91Atmos = "9.1 Dolby Atmos";
const CString kString100 = "10.0 Auro-3D";
const CString kString101 = "10.1 Auro-3D";
const CString kString110 = "11.0 Auro-3D";
const CString kString111 = "11.1 Auro-3D";
const CString kString130 = "13.0 Auro-3D";
const CString kString131 = "13.1 Auro-3D";
const CString kString81MPEG = "8.1 MPEG";
const CString kString70_4 = "7.0.4";
const CString kString71_4 = "7.1.4";
const CString kString140 = "14.0";
const CString kString222 = "22.2";
const CString kStringAmbi1stOrder = "1st Order Ambisonics";
const CString kStringAmbi2cdOrder = "2nd Order Ambisonics";
const CString kStringAmbi3rdOrder = "3rd Order Ambisonics";

/*@}*/

//------------------------------------------------------------------------
/** Speaker Arrangement String Representation with Speakers Name.
\ingroup speakerArrangements */
/*@{*/
const CString kStringMonoS = "M";
const CString kStringStereoS = "L R";
const CString kStringStereoRS = "Ls Rs";
const CString kStringStereoCS = "Lc Rc";
const CString kStringStereoSS = "Sl Sr";
const CString kStringStereoCLfeS= "C LFE";
const CString kStringStereoTFS = "Tfl Tfr";
const CString kStringStereoTSS = "Tsl Tsr";
const CString kStringStereoTRS = "Trl Trr";
const CString kStringStereoBFS = "Bfl Bfr";
const CString kString30CineS = "L R C";
const CString kString30MusicS = "L R S";
const CString kString31CineS = "L R C LFE";
const CString kString31MusicS = "L R LFE S";
const CString kString40CineS = "L R C S";
const CString kString40MusicS = "L R Ls Rs";
const CString kString41CineS = "L R C LFE S";
const CString kString41MusicS = "L R LFE Ls Rs";
const CString kString50S = "L R C Ls Rs";
const CString kString51S = "L R C LFE Ls Rs";
const CString kString60CineS = "L R C Ls Rs Cs";
const CString kString60MusicS = "L R Ls Rs Sl Sr";
const CString kString61CineS = "L R C LFE Ls Rs Cs";
const CString kString61MusicS = "L R LFE Ls Rs Sl Sr";
const CString kString70CineS = "L R C Ls Rs Lc Rc";
const CString kString70MusicS = "L R C Ls Rs Sl Sr";
const CString kString71CineS = "L R C LFE Ls Rs Lc Rc";
const CString kString71MusicS = "L R C LFE Ls Rs Sl Sr";
const CString kString80CineS = "L R C Ls Rs Lc Rc Cs";
const CString kString80MusicS = "L R C Ls Rs Cs Sl Sr";
const CString kString81CineS = "L R C LFE Ls Rs Lc Rc Cs";
const CString kString81MusicS = "L R C LFE Ls Rs Cs Sl Sr";
const CString kString80CubeS = "L R Ls Rs Tfl Tfr Trl Trr";
const CString kString71CineTopCenterS = "L R C LFE Ls Rs Cs Tc";
const CString kString71CineCenterHighS = "L R C LFE Ls Rs Cs Tfc";
const CString kString71CineFrontHighS = "L R C LFE Ls Rs Tfl Tfl";
const CString kString71CineSideHighS = "L R C LFE Ls Rs Tsl Tsl";
const CString kString71CineFullRearS = "L R C LFE Ls Rs Lcs Rcs";
const CString kString71ProximityS = "L R C LFE Ls Rs Pl Pr";
const CString kString50_4S = "L R C Ls Rs Tfl Tfr Trl Trr";
const CString kString51_4S = "L R C LFE Ls Rs Tfl Tfr Trl Trr";
const CString kString91AtmosS = "L R C LFE Ls Rs Sl Sr Tsl Tsr";
const CString kString100S = "L R C Ls Rs Tc Tfl Tfr Trl Trr";
const CString kString101S = "L R C LFE Ls Rs Tc Tfl Tfr Trl Trr";
const CString kString110S = "L R C Ls Rs Tc Tfl Tfc Tfr Trl Trr";
const CString kString111S = "L R C LFE Ls Rs Tc Tfl Tfc Tfr Trl Trr";
const CString kStringk70_4S = "L R C Ls Rs Sl Sr Tfl Tfr Trl Trr";
const CString kStringk71_4S = "L R C LFE Ls Rs Sl Sr Tfl Tfr Trl Trr";
const CString kString130S = "L R C Ls Rs Sl Sr Tc Tfl Tfc Tfr Trl Trr";
const CString kString131S = "L R C LFE Ls Rs Sl Sr Tc Tfl Tfc Tfr Trl Trr";
const CString kString102S = "L R C LFE Ls Rs Tfl Tfc Tfr Trl Trr LFE2";
const CString kString122S = "L R C LFE Ls Rs Lc Rc Tfl Tfc Tfr Trl Trr LFE2";
const CString kString81MPEGS = "L R LFE Ls Rs Tfl Tfc Tfr Bfc";
const CString kString140S = "L R Ls Rs Sl Sr Tfl Tfr Trl Trr Bfl Bfr Brl Brr";
const CString kString222S = "L R C LFE Ls Rs Lc Rc Cs Sl Sr Tc Tfl Tfc Tfr Trl Trc Trr LFE2 Tsl Tsr Bfl Bfc Bfr";

const CString kStringAmbi1stOrderS = "0 1 2 3";
const CString kStringAmbi2cdOrderS = "0 1 2 3 4 5 6 7 8";
const CString kStringAmbi3rdOrderS = "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15";
/*@}*/

//------------------------------------------------------------------------
/** Returns number of channels used in speaker arrangement.
\ingroup speakerArrangements */
/*@{*/
inline int32 getChannelCount (SpeakerArrangement arr)
{
int32 count = 0;
while (arr)
{
if (arr & (SpeakerArrangement)1)
++count;
arr >>= 1;
}
return count;
}

//------------------------------------------------------------------------
/** Returns the index of a given speaker in a speaker arrangement (-1 if speaker is not part of the
* arrangement). */
inline int32 getSpeakerIndex (Speaker speaker, SpeakerArrangement arrangement)
{
// check if speaker is present in arrangement
if ((arrangement & speaker) == 0)
return -1;

int32 result = 0;
Speaker i = 1;
while (i < speaker)
{
if (arrangement & i)
result++;
i <<= 1;
}

return result;
}

//------------------------------------------------------------------------
/** Returns the speaker for a given index in a speaker arrangement (return 0 when out of range). */
inline Speaker getSpeaker (const SpeakerArrangement& arr, int32 index)
{
SpeakerArrangement arrTmp = arr;

int32 index2 = -1;
int32 pos = -1;
while (arrTmp)
{
if (arrTmp & 0x1)
index2++;
pos++;
if (index2 == index)
return (Speaker)1 << pos;
arrTmp = arrTmp >> 1;
}
return 0;
}

//------------------------------------------------------------------------
/** Returns true if arrSubSet is a subset speaker of arr (means each speaker of arrSubSet is
* included in arr). */
inline bool isSubsetOf (const SpeakerArrangement& arrSubSet, const SpeakerArrangement& arr)
{
return (arrSubSet == (arrSubSet & arr));
}

//------------------------------------------------------------------------
/** Returns true if arrangement is a Auro configuration. */
inline bool isAuro (const SpeakerArrangement& arr)
{
if (arr == k90 || arr == k91 || arr == k100 || arr == k101 || arr == k110 || arr == k111 ||
arr == k130 || arr == k131)
{
return true;
}
return false;
}

//------------------------------------------------------------------------
/** Returns true if arrangement is a Auro configuration. */
inline bool isAmbisonics (const SpeakerArrangement& arr)
{
if (arr == kAmbi1stOrderACN || arr == kAmbi2cdOrderACN || arr == kAmbi3rdOrderACN)
{
return true;
}
return false;
}

//------------------------------------------------------------------------
/** Returns the speaker arrangement associated to a string representation.
Returns kEmpty if no associated arrangement is known.
*/
inline SpeakerArrangement getSpeakerArrangementFromString (CString arrStr)
{
if (!strcmp8 (arrStr, kStringMono))
return kMono;
if (!strcmp8 (arrStr, kStringStereo))
return kStereo;
if (!strcmp8 (arrStr, kStringStereoR))
return kStereoSurround;
if (!strcmp8 (arrStr, kStringStereoC))
return kStereoCenter;
if (!strcmp8 (arrStr, kStringStereoSide))
return kStereoSide;
if (!strcmp8 (arrStr, kStringStereoCLfe))
return kStereoCLfe;
if (!strcmp8 (arrStr, kStringStereoTF))
return kStereoTF;
if (!strcmp8 (arrStr, kStringStereoTS))
return kStereoTS;
if (!strcmp8 (arrStr, kStringStereoTR))
return kStereoTR;
if (!strcmp8 (arrStr, kStringStereoBF))
return kStereoBF;
if (!strcmp8 (arrStr, kString30Cine))
return k30Cine;
if (!strcmp8 (arrStr, kString30Music))
return k30Music;
if (!strcmp8 (arrStr, kString31Cine))
return k31Cine;
if (!strcmp8 (arrStr, kString31Music))
return k31Music;
if (!strcmp8 (arrStr, kString40Cine))
return k40Cine;
if (!strcmp8 (arrStr, kString40Music))
return k40Music;
if (!strcmp8 (arrStr, kString41Cine))
return k41Cine;
if (!strcmp8 (arrStr, kString41Music))
return k41Music;
if (!strcmp8 (arrStr, kString50))
return k50;
if (!strcmp8 (arrStr, kString51))
return k51;
if (!strcmp8 (arrStr, kString60Cine))
return k60Cine;
if (!strcmp8 (arrStr, kString60Music))
return k60Music;
if (!strcmp8 (arrStr, kString61Cine))
return k61Cine;
if (!strcmp8 (arrStr, kString61Music))
return k61Music;
if (!strcmp8 (arrStr, kString70Cine))
return k70Cine;
if (!strcmp8 (arrStr, kString70Music))
return k70Music;
if (!strcmp8 (arrStr, kString71Cine))
return k71Cine;
if (!strcmp8 (arrStr, kString71Music))
return k71Music;
if (!strcmp8 (arrStr, kString71Proximity))
return k71Proximity;
if (!strcmp8 (arrStr, kString80Cine))
return k80Cine;
if (!strcmp8 (arrStr, kString80Music))
return k80Music;
if (!strcmp8 (arrStr, kString81Cine))
return k81Cine;
if (!strcmp8 (arrStr, kString81Music))
return k81Music;
if (!strcmp8 (arrStr, kString102))
return k102;
if (!strcmp8 (arrStr, kString122))
return k122;
if (!strcmp8 (arrStr, kString80Cube))
return k80Cube;
if (!strcmp8 (arrStr, kString71CineTopCenter))
return k71CineTopCenter;
if (!strcmp8 (arrStr, kString71CineCenterHigh))
return k71CineCenterHigh;
if (!strcmp8 (arrStr, kString71CineFrontHigh))
return k71CineFrontHigh;
if (!strcmp8 (arrStr, kString71CineSideHigh))
return k71CineSideHigh;
if (!strcmp8 (arrStr, kString71CineFullRear))
return k71CineFullRear;
if (!strcmp8 (arrStr, kString50_4))
return k50_4;
if (!strcmp8 (arrStr, kString51_4))
return k51_4;
if (!strcmp8 (arrStr, kString81MPEG))
return k81MPEG3D;
if (!strcmp8 (arrStr, kString91Atmos))
return k91Atmos;
if (!strcmp8 (arrStr, kString100))
return k100;
if (!strcmp8 (arrStr, kString101))
return k101;
if (!strcmp8 (arrStr, kString110))
return k110;
if (!strcmp8 (arrStr, kString111))
return k111;
if (!strcmp8 (arrStr, kString70_4))
return k70_4;
if (!strcmp8 (arrStr, kString71_4))
return k71_4;
if (!strcmp8 (arrStr, kString130))
return k130;
if (!strcmp8 (arrStr, kString131))
return k131;
if (!strcmp8 (arrStr, kString140))
return k140;
if (!strcmp8 (arrStr, kString222))
return k222;
if (!strcmp8 (arrStr, kStringAmbi1stOrder))
return kAmbi1stOrderACN;
if (!strcmp8 (arrStr, kStringAmbi2cdOrder))
return kAmbi2cdOrderACN;
if (!strcmp8 (arrStr, kStringAmbi3rdOrder))
return kAmbi3rdOrderACN;
return kEmpty;
}

//------------------------------------------------------------------------
/** Returns the string representation of a given speaker arrangement.
Returns kStringEmpty if arr is unknown.
*/
inline CString getSpeakerArrangementString (SpeakerArrangement arr, bool withSpeakersName)
{
switch (arr)
{
case kMono: return withSpeakersName ? kStringMonoS : kStringMono;
case kStereo: return withSpeakersName ? kStringStereoS : kStringStereo;
case kStereoSurround: return withSpeakersName ? kStringStereoRS : kStringStereoR;
case kStereoCenter: return withSpeakersName ? kStringStereoCS : kStringStereoC;
case kStereoSide: return withSpeakersName ? kStringStereoSS : kStringStereoSide;
case kStereoCLfe: return withSpeakersName ? kStringStereoCLfeS: kStringStereoCLfe;
case kStereoTF: return withSpeakersName ? kStringStereoTFS : kStringStereoTF;
case kStereoTS: return withSpeakersName ? kStringStereoTSS : kStringStereoTS;
case kStereoTR: return withSpeakersName ? kStringStereoTRS : kStringStereoTR;
case kStereoBF: return withSpeakersName ? kStringStereoBFS : kStringStereoBF;
case k30Cine: return withSpeakersName ? kString30CineS : kString30Cine;
case k30Music: return withSpeakersName ? kString30MusicS : kString30Music;
case k31Cine: return withSpeakersName ? kString31CineS : kString31Cine;
case k31Music: return withSpeakersName ? kString31MusicS : kString31Music;
case k40Cine: return withSpeakersName ? kString40CineS : kString40Cine;
case k40Music: return withSpeakersName ? kString40MusicS : kString40Music;
case k41Cine: return withSpeakersName ? kString41CineS : kString41Cine;
case k41Music: return withSpeakersName ? kString41MusicS : kString41Music;
case k50: return withSpeakersName ? kString50S : kString50;
case k51: return withSpeakersName ? kString51S : kString51;
case k60Cine: return withSpeakersName ? kString60CineS : kString60Cine;
case k60Music: return withSpeakersName ? kString60MusicS : kString60Music;
case k61Cine: return withSpeakersName ? kString61CineS : kString61Cine;
case k61Music: return withSpeakersName ? kString61MusicS : kString61Music;
case k70Cine: return withSpeakersName ? kString70CineS : kString70Cine;
case k70Music: return withSpeakersName ? kString70MusicS : kString70Music;
case k71Cine: return withSpeakersName ? kString71CineS : kString71Cine;
case k71Music: return withSpeakersName ? kString71MusicS : kString71Music;
case k71Proximity: return withSpeakersName ? kString71ProximityS : kString71Proximity;
case k80Cine: return withSpeakersName ? kString80CineS : kString80Cine;
case k80Music: return withSpeakersName ? kString80MusicS : kString80Music;
case k81Cine: return withSpeakersName ? kString81CineS : kString81Cine;
case k81Music: return withSpeakersName ? kString81MusicS : kString81Music;
case k81MPEG3D: return withSpeakersName ? kString81MPEGS : kString81MPEG;
case k102: return withSpeakersName ? kString102S : kString102;
case k122: return withSpeakersName ? kString122S : kString122;
case k80Cube: return withSpeakersName ? kString80CubeS : kString80Cube;
case k71CineTopCenter: return withSpeakersName ? kString71CineTopCenterS : kString71CineTopCenter;
case k71CineCenterHigh: return withSpeakersName ? kString71CineCenterHighS : kString71CineCenterHigh;
case k71CineFrontHigh: return withSpeakersName ? kString71CineFrontHighS : kString71CineFrontHigh;
case k71CineSideHigh: return withSpeakersName ? kString71CineSideHighS : kString71CineSideHigh;
case k71CineFullRear: return withSpeakersName ? kString71CineFullRearS : kString71CineFullRear;
case k91Atmos: return withSpeakersName ? kString91AtmosS : kString91Atmos;
case k100: return withSpeakersName ? kString100S : kString100;
case k101: return withSpeakersName ? kString101S : kString101;
case k110: return withSpeakersName ? kString110S : kString110;
case k111: return withSpeakersName ? kString111S : kString111;

case k50_4: return withSpeakersName ? kString50_4S : kString50_4;
case k51_4: return withSpeakersName ? kString51_4S : kString51_4;
case k70_4: return withSpeakersName ? kStringk70_4S : kString70_4;
case k71_4: return withSpeakersName ? kStringk71_4S : kString71_4;
case k130: return withSpeakersName ? kString130S : kString130;
case k131: return withSpeakersName ? kString131S : kString131;
case k140: return withSpeakersName ? kString140S : kString140;
case k222: return withSpeakersName ? kString222S : kString222;
break;
}

if (arr == kAmbi1stOrderACN)
return withSpeakersName ? kStringAmbi1stOrderS : kStringAmbi1stOrder;
if (arr == kAmbi2cdOrderACN)
return withSpeakersName ? kStringAmbi2cdOrderS : kStringAmbi2cdOrder;
if (arr == kAmbi3rdOrderACN)
return withSpeakersName ? kStringAmbi3rdOrderS : kStringAmbi3rdOrder;

return kStringEmpty;
}

//------------------------------------------------------------------------
/** Returns a CString representation of a given speaker in a given arrangement
*/
inline CString getSpeakerShortName (const SpeakerArrangement& arr, int32 index)
{
SpeakerArrangement arrTmp = arr;

bool found = false;
int32 index2 = -1;
int32 pos = -1;
while (arrTmp)
{
if (arrTmp & 0x1)
index2++;
pos++;
if (index2 == index)
{
found = true;
break;
}
arrTmp = arrTmp >> 1;
}

if (!found)
return "";

Speaker speaker = (Speaker)1 << pos;
if (speaker == kSpeakerL)
return "L";
if (speaker == kSpeakerR)
return "R";
if (speaker == kSpeakerC)
return "C";
if (speaker == kSpeakerLfe)
return "LFE";
if (speaker == kSpeakerLs)
return "Ls";
if (speaker == kSpeakerRs)
return "Rs";
if (speaker == kSpeakerLc)
return "Lc";
if (speaker == kSpeakerRc)
return "Rc";
if (speaker == kSpeakerS)
return "S";
if (speaker == kSpeakerSl)
return "Sl";
if (speaker == kSpeakerSr)
return "Sr";
if (speaker == kSpeakerTc)
return "Tc";
if (speaker == kSpeakerTfl)
return "Tfl";
if (speaker == kSpeakerTfc)
return "Tfc";
if (speaker == kSpeakerTfr)
return "Tfr";
if (speaker == kSpeakerTrl)
return "Trl";
if (speaker == kSpeakerTrc)
return "Trc";
if (speaker == kSpeakerTrr)
return "Trr";
if (speaker == kSpeakerLfe2)
return "LFE2";
if (speaker == kSpeakerM)
return "M";

if (speaker == kSpeakerACN0)
return "0";
if (speaker == kSpeakerACN1)
return "1";
if (speaker == kSpeakerACN2)
return "2";
if (speaker == kSpeakerACN3)
return "3";
if (speaker == kSpeakerACN4)
return "4";
if (speaker == kSpeakerACN5)
return "5";
if (speaker == kSpeakerACN6)
return "6";
if (speaker == kSpeakerACN7)
return "7";
if (speaker == kSpeakerACN8)
return "8";
if (speaker == kSpeakerACN9)
return "9";
if (speaker == kSpeakerACN10)
return "10";
if (speaker == kSpeakerACN11)
return "11";
if (speaker == kSpeakerACN12)
return "12";
if (speaker == kSpeakerACN13)
return "13";
if (speaker == kSpeakerACN14)
return "14";
if (speaker == kSpeakerACN15)
return "15";

if (speaker == kSpeakerTsl)
return "Tsl";
if (speaker == kSpeakerTsr)
return "Tsr";
if (speaker == kSpeakerLcs)
return "Lcs";
if (speaker == kSpeakerRcs)
return "Rcs";

if (speaker == kSpeakerBfl)
return "Bfl";
if (speaker == kSpeakerBfc)
return "Bfc";
if (speaker == kSpeakerBfr)
return "Bfr";
if (speaker == kSpeakerPl)
return "Pl";
if (speaker == kSpeakerPr)
return "Pr";
if (speaker == kSpeakerBsl)
return "Bsl";
if (speaker == kSpeakerBsr)
return "Bsr";
if (speaker == kSpeakerBrl)
return "Brl";
if (speaker == kSpeakerBrc)
return "Brc";
if (speaker == kSpeakerBrr)
return "Brr";

return "";
}

/*@}*/

//------------------------------------------------------------------------
} // namespace SpeakerArr
} // namespace Vst
} // namespace Steinberg

+ 11
- 687
source/includes/vst3sdk/pluginterfaces/vst/vsttypes.h View File

@@ -1,11 +1,10 @@
//------------------------------------------------------------------------
// Project : VST SDK
// Version : 3.6.7
//
// Category : Interfaces
// Filename : pluginterfaces/vst/vsttypes.h
// Created by : Steinberg, 12/2005
// Description : common defines
// Description : Common Defines
//
//-----------------------------------------------------------------------------
// This file is part of a Steinberg SDK. It is subject to the license terms
@@ -24,50 +23,34 @@ namespace Steinberg {
namespace Vst {
//------------------------------------------------------------------------
#ifndef kVstVersionString
#define kVstVersionString "VST 3.6.7" ///< SDK version for PClassInfo2
#define kVstVersionString "VST 3.6.13" ///< SDK version for PClassInfo2
#endif

#define kVstVersionMajor 3
#define kVstVersionMinor 6
#define kVstVersionSub 7
#define kVstVersionSub 13

// this allows to write things like: #if VST_VERSION >= 0x030500 // note that 3.10.0 is 0x030a00
#define VST_VERSION ((kVstVersionMajor << 16) | (kVstVersionMinor << 8) | kVstVersionSub)

//------------------------------------------------------------------------
// struct alignment definitions
//------------------------------------------------------------------------
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#define VST3_STRUCT struct __attribute__((aligned(4)))
#elif WINDOWS
#if PLATFORM_64
#define VST3_PACKED_SIZE 8
#else
#define VST3_PACKED_SIZE 4
#endif
#define VST3_STRUCT __declspec(align(VST3_PACKED_SIZE)) struct
#else
#error "unsupported compiler"
#endif

//------------------------------------------------------------------------
/** \defgroup vst3typedef VST 3 Data Types
*/
/*@{*/
//------------------------------------------------------------------------
// string types
// String Types
//------------------------------------------------------------------------
typedef char16 TChar; ///< UTF-16 character
typedef TChar String128[128]; ///< 128 character UTF-16 string
typedef const char8* CString; ///< C-String

//------------------------------------------------------------------------
// general
// General
//------------------------------------------------------------------------
typedef int32 MediaType; ///< media type (audio/event)
typedef int32 BusDirection; ///< bus direction (in/out)
typedef int32 BusType; ///< bus type (main/aux)
typedef int32 IoMode; ///< I/O mode
typedef int32 IoMode; ///< I/O mode (see \ref vst3IoMode)
typedef int32 UnitID; ///< unit identifier
typedef double ParamValue; ///< parameter value type
typedef uint32 ParamID; ///< parameter identifier
@@ -79,684 +62,25 @@ typedef int64 TSamples; ///< time expressed in audio samples

typedef uint32 ColorSpec; ///< color defining by 4 component ARGB value (Alpha/Red/Green/Blue)

//------------------------------------------------------------------------
static const ParamID kNoParamId = 0xffffffff; ///< default for uninitialized parameter ID
// static const ParamID kNoParamId = std::numeric_limits<ParamID>::max ();

//------------------------------------------------------------------------
// Audio Types
//------------------------------------------------------------------------
typedef float Sample32; ///< 32-bit precision audio sample
typedef double Sample64; ///< 64-bit precision audio sample
typedef double SampleRate; ///< sample rate
/*@}*/

//------------------------------------------------------------------------
/** \defgroup speakerArrangements Speaker Arrangements
\image html "vst3_speaker_types.jpg"
\n
A SpeakerArrangement is a bitset combination of speakers. For example:
\code
const SpeakerArrangement kStereo = kSpeakerL | kSpeakerR; // => hex: 0x03 / binary: 0011.
\endcode*/
// Speaker Arrangements Types
//------------------------------------------------------------------------
/**@{*/
typedef uint64 SpeakerArrangement; ///< Bitset of speakers
typedef uint64 Speaker; ///< Bit for one speaker
/**@}*/

//------------------------------------------------------------------------
/** Speaker Definitions.
\ingroup speakerArrangements */
//------------------------------------------------------------------------
/**@{*/
const Speaker kSpeakerL = 1 << 0; ///< Left (L)
const Speaker kSpeakerR = 1 << 1; ///< Right (R)
const Speaker kSpeakerC = 1 << 2; ///< Center (C)
const Speaker kSpeakerLfe = 1 << 3; ///< Subbass (Lfe)
const Speaker kSpeakerLs = 1 << 4; ///< Left Surround (Ls)
const Speaker kSpeakerRs = 1 << 5; ///< Right Surround (Rs)
const Speaker kSpeakerLc = 1 << 6; ///< Left of Center (Lc) - Front Left Center
const Speaker kSpeakerRc = 1 << 7; ///< Right of Center (Rc) - Front Right Center
const Speaker kSpeakerS = 1 << 8; ///< Surround (S)
const Speaker kSpeakerCs = kSpeakerS; ///< Center of Surround (Cs) - Back Center - Surround (S)
const Speaker kSpeakerSl = 1 << 9; ///< Side Left (Sl)
const Speaker kSpeakerSr = 1 << 10; ///< Side Right (Sr)
const Speaker kSpeakerTc = 1 << 11; ///< Top Center Over-head, Top Middle (Tc)
const Speaker kSpeakerTfl = 1 << 12; ///< Top Front Left (Tfl)
const Speaker kSpeakerTfc = 1 << 13; ///< Top Front Center (Tfc)
const Speaker kSpeakerTfr = 1 << 14; ///< Top Front Right (Tfr)
const Speaker kSpeakerTrl = 1 << 15; ///< Top Rear/Back Left (Trl)
const Speaker kSpeakerTrc = 1 << 16; ///< Top Rear/Back Center (Trc)
const Speaker kSpeakerTrr = 1 << 17; ///< Top Rear/Back Right (Trr)
const Speaker kSpeakerLfe2 = 1 << 18; ///< Subbass 2 (Lfe2)
const Speaker kSpeakerM = 1 << 19; ///< Mono (M)

const Speaker kSpeakerW = 1 << 20; ///< B-Format W
const Speaker kSpeakerX = 1 << 21; ///< B-Format X
const Speaker kSpeakerY = 1 << 22; ///< B-Format Y
const Speaker kSpeakerZ = 1 << 23; ///< B-Format Z

const Speaker kSpeakerTsl = 1 << 24; ///< Top Side Left (Tsl)
const Speaker kSpeakerTsr = 1 << 25; ///< Top Side Right (Tsr)
const Speaker kSpeakerLcs = 1 << 26; ///< Left of Center Surround (Lcs) - Back Left Center
const Speaker kSpeakerRcs = 1 << 27; ///< Right of Center Surround (Rcs) - Back Right Center

const Speaker kSpeakerBfl = 1 << 28; ///< Bottom Front Left (Bfl)
const Speaker kSpeakerBfc = 1 << 29; ///< Bottom Front Center (Bfc)
const Speaker kSpeakerBfr = 1 << 30; ///< Bottom Front Right (Bfr)

const Speaker kSpeakerPl = (Speaker)1 << 31; ///< Proximity Left (Pl)
const Speaker kSpeakerPr = (Speaker)1 << 32; ///< Proximity Right (Pr)
//------------------------------------------------------------------------
/** @}*/

//------------------------------------------------------------------------
/** Speaker Arrangement Definitions (SpeakerArrangement)*/
//------------------------------------------------------------------------
namespace SpeakerArr
{
//------------------------------------------------------------------------
/** Speaker Arrangement Definitions.
\ingroup speakerArrangements */
/*@{*/
const SpeakerArrangement kEmpty = 0; ///< empty arrangement
const SpeakerArrangement kMono = kSpeakerM; ///< M
const SpeakerArrangement kStereo = kSpeakerL | kSpeakerR; ///< L R
const SpeakerArrangement kStereoSurround = kSpeakerLs | kSpeakerRs; ///< Ls Rs
const SpeakerArrangement kStereoCenter = kSpeakerLc | kSpeakerRc; ///< Lc Rc
const SpeakerArrangement kStereoSide = kSpeakerSl | kSpeakerSr; ///< Sl Sr
const SpeakerArrangement kStereoCLfe = kSpeakerC | kSpeakerLfe; ///< C Lfe
const SpeakerArrangement kStereoTF = kSpeakerTfl | kSpeakerTfr; ///< Tfl Tfr
const SpeakerArrangement kStereoTS = kSpeakerTsl | kSpeakerTsr; ///< Tsl Tsr
const SpeakerArrangement kStereoTR = kSpeakerTrl | kSpeakerTrr; ///< Trl Trr
const SpeakerArrangement kStereoBF = kSpeakerBfl | kSpeakerBfr; ///< Bfl Bfr

/** L R C */
const SpeakerArrangement k30Cine = kSpeakerL | kSpeakerR | kSpeakerC;
/** L R S */
const SpeakerArrangement k30Music = kSpeakerL | kSpeakerR | kSpeakerS;
/** L R C Lfe */
const SpeakerArrangement k31Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe;
/** L R Lfe S */
const SpeakerArrangement k31Music = kSpeakerL | kSpeakerR | kSpeakerLfe | kSpeakerS;
/** L R C S (LCRS) */
const SpeakerArrangement k40Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerS;
/** L R Ls Rs (Quadro) */
const SpeakerArrangement k40Music = kSpeakerL | kSpeakerR | kSpeakerLs | kSpeakerRs;
/** L R C Lfe S (LCRS+Lfe) */
const SpeakerArrangement k41Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerS;
/** L R Lfe Ls Rs (Quadro+Lfe) */
const SpeakerArrangement k41Music = kSpeakerL | kSpeakerR | kSpeakerLfe | kSpeakerLs | kSpeakerRs;
/** L R C Ls Rs */
const SpeakerArrangement k50 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs;
/** L R C Lfe Ls Rs */
const SpeakerArrangement k51 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs;
/** L R C Ls Rs Cs */
const SpeakerArrangement k60Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerCs;
/** L R Ls Rs Sl Sr */
const SpeakerArrangement k60Music = kSpeakerL | kSpeakerR | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr;
/** L R C Lfe Ls Rs Cs */
const SpeakerArrangement k61Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerCs;
/** L R Lfe Ls Rs Sl Sr */
const SpeakerArrangement k61Music = kSpeakerL | kSpeakerR | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr;
/** L R C Ls Rs Lc Rc */
const SpeakerArrangement k70Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc;
/** L R C Ls Rs Sl Sr */
const SpeakerArrangement k70Music = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr;
/** L R C Lfe Ls Rs Lc Rc */
const SpeakerArrangement k71Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc;
const SpeakerArrangement k71CineFullFront= k71Cine;
/** L R C Lfe Ls Rs Lcs Rcs */
const SpeakerArrangement k71CineFullRear = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerLcs | kSpeakerRcs;
/** L R C Lfe Ls Rs Sl Sr */
const SpeakerArrangement k71Music = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr;
const SpeakerArrangement k71CineSideFill = k71Music;
/** L R C Lfe Ls Rs Pl Pr */
const SpeakerArrangement k71Proximity = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerPl | kSpeakerPr;
/** L R C Ls Rs Lc Rc Cs */
const SpeakerArrangement k80Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc | kSpeakerCs;
/** L R C Ls Rs Cs Sl Sr */
const SpeakerArrangement k80Music = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerCs | kSpeakerSl | kSpeakerSr;
/** L R C Lfe Ls Rs Lc Rc Cs */
const SpeakerArrangement k81Cine = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc | kSpeakerCs;
/** L R C Lfe Ls Rs Cs Sl Sr */
const SpeakerArrangement k81Music = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerCs | kSpeakerSl | kSpeakerSr;

/** W X Y Z (First Order) */
const SpeakerArrangement kBFormat1stOrder = kSpeakerW | kSpeakerX | kSpeakerY | kSpeakerZ;
const SpeakerArrangement kBFormat = kBFormat1stOrder;

/*-----------*/
/* 3D formats */
/*-----------*/
/** L R Ls Rs Tfl Tfr Trl Trr */
const SpeakerArrangement k80Cube = kSpeakerL | kSpeakerR | kSpeakerLs | kSpeakerRs | kSpeakerTfl| kSpeakerTfr| kSpeakerTrl | kSpeakerTrr;
/** L R C Lfe Ls Rs Cs Tc */
const SpeakerArrangement k71CineTopCenter = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerCs | kSpeakerTc;
/** L R C Lfe Ls Rs Cs Tfc */
const SpeakerArrangement k71CineCenterHigh = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerCs | kSpeakerTfc;
/** L R C Lfe Ls Rs Tfl Tfr */
const SpeakerArrangement k71CineFrontHigh = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerTfl | kSpeakerTfr;
const SpeakerArrangement k71MPEG3D = k71CineFrontHigh;
/** L R C Lfe Ls Rs Tsl Tsr */
const SpeakerArrangement k71CineSideHigh = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerTsl | kSpeakerTsr;

/** L R Lfe Ls Rs Tfl Tfc Tfr Bfc */
const SpeakerArrangement k81MPEG3D = kSpeakerL | kSpeakerR | kSpeakerLfe | kSpeakerLs | kSpeakerRs |
kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerBfc;

/** L R C Ls Rs Tfl Tfr Trl Trr */
const SpeakerArrangement k90 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs |
kSpeakerTfl| kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
/** L R C Lfe Ls Rs Tfl Tfr Trl Trr */
const SpeakerArrangement k91 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs |
kSpeakerTfl| kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;

/** L R C Lfe Ls Rs Sl Sr Tsl Tsr */
const SpeakerArrangement k71_2 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs |
kSpeakerRs | kSpeakerSl | kSpeakerSr | kSpeakerTsl | kSpeakerTsr;
const SpeakerArrangement k91Atmos = k71_2;

/** L R C Ls Rs Tc Tfl Tfr Trl Trr */
const SpeakerArrangement k100 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs |
kSpeakerTc | kSpeakerTfl | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
/** L R C Lfe Ls Rs Tc Tfl Tfr Trl Trr */
const SpeakerArrangement k101 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs |
kSpeakerTc | kSpeakerTfl | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
const SpeakerArrangement k101MPEG3D = k101;

/** L R C Lfe Ls Rs Tfl Tfc Tfr Trl Trr Lfe2 */
const SpeakerArrangement k102 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs |
kSpeakerTfl| kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr | kSpeakerLfe2;

/** L R C Ls Rs Tc Tfl Tfc Tfr Trl Trr */
const SpeakerArrangement k110 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs |
kSpeakerTc | kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
/** L R C Lfe Ls Rs Tc Tfl Tfc Tfr Trl Trr */
const SpeakerArrangement k111 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs |
kSpeakerTc | kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
/** L R C Lfe Ls Rs Lc Rc Tfl Tfc Tfr Trl Trr Lfe2 */
const SpeakerArrangement k122 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc |
kSpeakerTfl| kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr | kSpeakerLfe2;
/** L R C Ls Rs Cs Tc Tfl Tfc Tfr Trl Trc Trr */
const SpeakerArrangement k130 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr |
kSpeakerTc | kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;
/** L R C Lfe Ls Rs Cs Tc Tfl Tfc Tfr Trl Trc Trr */
const SpeakerArrangement k131 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerSl | kSpeakerSr |
kSpeakerTc | kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrr;

/** L R C Lfe Ls Rs Lc Rc Cs Sl Sr Tc Tfl Tfc Tfr Trl Trc Trr Lfe2 Tsl Tsr Bfl Bfc Bfr */
const SpeakerArrangement k222 = kSpeakerL | kSpeakerR | kSpeakerC | kSpeakerLfe | kSpeakerLs | kSpeakerRs | kSpeakerLc | kSpeakerRc | kSpeakerCs | kSpeakerSl | kSpeakerSr |
kSpeakerTc | kSpeakerTfl | kSpeakerTfc | kSpeakerTfr | kSpeakerTrl | kSpeakerTrc | kSpeakerTrr | kSpeakerLfe2 | kSpeakerTsl | kSpeakerTsr |
kSpeakerBfl| kSpeakerBfc | kSpeakerBfr;

//------------------------------------------------------------------------
/** Speaker Arrangement String Representation.
\ingroup speakerArrangements */
/*@{*/
const CString kStringEmpty = "";
const CString kStringMono = "Mono";
const CString kStringStereo = "Stereo";
const CString kStringStereoR = "Stereo (Ls Rs)";
const CString kStringStereoC = "Stereo (Lc Rc)";
const CString kStringStereoSide = "Stereo (Sl Sr)";
const CString kStringStereoCLfe = "Stereo (C LFE)";
const CString kStringStereoTF = "Stereo (Tfl Tfr)";
const CString kStringStereoTS = "Stereo (Tsl Tsr)";
const CString kStringStereoTR = "Stereo (Trl Trr)";
const CString kStringStereoBF = "Stereo (Bfl Bfr)";

const CString kString30Cine = "LRC";
const CString kString30Music = "LRS";
const CString kString31Cine = "LRC+LFE";
const CString kString31Music = "LRS+LFE";
const CString kString40Cine = "LRCS";
const CString kString40Music = "Quadro";
const CString kString41Cine = "LRCS+LFE";
const CString kString41Music = "Quadro+LFE";
const CString kString50 = "5.0";
const CString kString51 = "5.1";
const CString kString60Cine = "6.0 Cine";
const CString kString60Music = "6.0 Music";
const CString kString61Cine = "6.1 Cine";
const CString kString61Music = "6.1 Music";
const CString kString70Cine = "7.0 Cine (SDDS)";
const CString kString70Music = "7.0 Music (Dolby)";
const CString kString71Cine = "7.1 Cine (SDDS)";
const CString kString71Music = "7.1 Music (Dolby)";
const CString kString71CineTopCenter = "7.1 Cine Top Center";
const CString kString71CineCenterHigh = "7.1 Cine Center High";
const CString kString71CineFrontHigh = "7.1 Cine Front High";
const CString kString71CineSideHigh = "7.1 Cine Side High";
const CString kString71CineFullRear = "7.1 Cine Full Rear";
const CString kString71Proximity = "7.1 Proximity";
const CString kString80Cine = "8.0 Cine";
const CString kString80Music = "8.0 Music";
const CString kString80Cube = "8.0 Cube";
const CString kString81Cine = "8.1 Cine";
const CString kString81Music = "8.1 Music";
const CString kString102 = "10.2 Experimental";
const CString kString122 = "12.2";
const CString kString90 = "9.0 Auro-3D";
const CString kString91 = "9.1 Auro-3D";
const CString kString91Atmos = "9.1 Dolby Atmos";
const CString kString100 = "10.0 Auro-3D";
const CString kString101 = "10.1 Auro-3D";
const CString kString110 = "11.0 Auro-3D";
const CString kString111 = "11.1 Auro-3D";
const CString kString130 = "13.0 Auro-3D";
const CString kString131 = "13.1 Auro-3D";
const CString kString81MPEG = "8.1 MPEG";
const CString kString222 = "22.2";
const CString kStringBFormat1stOrder = "BFormat";
/*@}*/

//------------------------------------------------------------------------
/** Speaker Arrangement String Representation with Speakers Name.
\ingroup speakerArrangements */
/*@{*/
const CString kStringMonoS = "M";
const CString kStringStereoS = "L R";
const CString kStringStereoRS = "Ls Rs";
const CString kStringStereoCS = "Lc Rc";
const CString kStringStereoSS = "Sl Sr";
const CString kStringStereoCLfeS= "C LFE";
const CString kStringStereoTFS = "Tfl Tfr";
const CString kStringStereoTSS = "Tsl Tsr";
const CString kStringStereoTRS = "Trl Trr";
const CString kStringStereoBFS = "Bfl Bfr";
const CString kString30CineS = "L R C";
const CString kString30MusicS = "L R S";
const CString kString31CineS = "L R C LFE";
const CString kString31MusicS = "L R LFE S";
const CString kString40CineS = "L R C S";
const CString kString40MusicS = "L R Ls Rs";
const CString kString41CineS = "L R C LFE S";
const CString kString41MusicS = "L R LFE Ls Rs";
const CString kString50S = "L R C Ls Rs";
const CString kString51S = "L R C LFE Ls Rs";
const CString kString60CineS = "L R C Ls Rs Cs";
const CString kString60MusicS = "L R Ls Rs Sl Sr";
const CString kString61CineS = "L R C LFE Ls Rs Cs";
const CString kString61MusicS = "L R LFE Ls Rs Sl Sr";
const CString kString70CineS = "L R C Ls Rs Lc Rc";
const CString kString70MusicS = "L R C Ls Rs Sl Sr";
const CString kString71CineS = "L R C LFE Ls Rs Lc Rc";
const CString kString71MusicS = "L R C LFE Ls Rs Sl Sr";
const CString kString80CineS = "L R C Ls Rs Lc Rc Cs";
const CString kString80MusicS = "L R C Ls Rs Cs Sl Sr";
const CString kString81CineS = "L R C LFE Ls Rs Lc Rc Cs";
const CString kString81MusicS = "L R C LFE Ls Rs Cs Sl Sr";
const CString kString80CubeS = "L R Ls Rs Tfl Tfr Trl Trr";
const CString kStringBFormat1stOrderS = "W X Y Z";
const CString kString71CineTopCenterS = "L R C LFE Ls Rs Cs Tc";
const CString kString71CineCenterHighS = "L R C LFE Ls Rs Cs Tfc";
const CString kString71CineFrontHighS = "L R C LFE Ls Rs Tfl Tfl";
const CString kString71CineSideHighS = "L R C LFE Ls Rs Tsl Tsl";
const CString kString71CineFullRearS = "L R C LFE Ls Rs Lcs Rcs";
const CString kString71ProximityS = "L R C LFE Ls Rs Pl Pr";
const CString kString90S = "L R C Ls Rs Tfl Tfr Trl Trr";
const CString kString91S = "L R C LFE Ls Rs Tfl Tfr Trl Trr";
const CString kString91AtmosS = "L R C LFE Ls Rs Sl Sr Tsl Tsr";
const CString kString100S = "L R C Ls Rs Tc Tfl Tfr Trl Trr";
const CString kString101S = "L R C LFE Ls Rs Tc Tfl Tfr Trl Trr";
const CString kString110S = "L R C Ls Rs Tc Tfl Tfc Tfr Trl Trr";
const CString kString111S = "L R C LFE Ls Rs Tc Tfl Tfc Tfr Trl Trr";
const CString kString130S = "L R C Ls Rs Sl Sr Tc Tfl Tfc Tfr Trl Trr";
const CString kString131S = "L R C LFE Ls Rs Sl Sr Tc Tfl Tfc Tfr Trl Trr";
const CString kString102S = "L R C LFE Ls Rs Tfl Tfc Tfr Trl Trr LFE2";
const CString kString122S = "L R C LFE Ls Rs Lc Rc Tfl Tfc Tfr Trl Trr LFE2";
const CString kString81MPEGS = "L R LFE Ls Rs Tfl Tfc Tfr Bfc";
const CString kString222S = "L R C LFE Ls Rs Lc Rc Cs Sl Sr Tc Tfl Tfc Tfr Trl Trc Trr LFE2 Tsl Tsr Bfl Bfc Bfr";

/*@}*/

//------------------------------------------------------------------------
/** Returns number of channels used in speaker arrangement.
\ingroup speakerArrangements */
/*@{*/
inline int32 getChannelCount (SpeakerArrangement arr)
{
int32 count = 0;
while (arr)
{
if (arr & (SpeakerArrangement)1)
++count;
arr >>= 1;
}
return count;
}

//------------------------------------------------------------------------
/** Returns the index of a given speaker in a speaker arrangement (-1 if speaker is not part of the arrangement). */
inline int32 getSpeakerIndex (Speaker speaker, SpeakerArrangement arrangement)
{
// check if speaker is present in arrangement
if ((arrangement & speaker) == 0)
return -1;

int32 result = 0;
Speaker i = 1;
while (i < speaker)
{
if (arrangement & i)
result++;
i <<= 1;
}

return result;
}

//------------------------------------------------------------------------
/** Returns the speaker for a given index in a speaker arrangement (return 0 when out of range). */
inline Speaker getSpeaker (const SpeakerArrangement& arr, int32 index)
{
SpeakerArrangement arrTmp = arr;

int32 index2 = -1;
int32 pos = -1;
while (arrTmp)
{
if (arrTmp & 0x1)
index2++;
pos++;
if (index2 == index)
return (Speaker)1 << pos;
arrTmp = arrTmp >> 1;
}
return 0;
}

//------------------------------------------------------------------------
/** Returns true if arrSubSet is a subset speaker of arr (means each speaker of arrSubSet is included in arr). */
inline bool isSubsetOf (const SpeakerArrangement& arrSubSet, const SpeakerArrangement& arr)
{
return (arrSubSet == (arrSubSet & arr));
}

//------------------------------------------------------------------------
/** Returns the speaker arrangement associated to a string representation.
Returns kEmpty if no associated arrangement is known.
*/
inline SpeakerArrangement getSpeakerArrangementFromString (CString arrStr)
{
if (!strcmp8 (arrStr, kStringMono))
return kMono;
if (!strcmp8 (arrStr, kStringStereo))
return kStereo;
if (!strcmp8 (arrStr, kStringStereoR))
return kStereoSurround;
if (!strcmp8 (arrStr, kStringStereoC))
return kStereoCenter;
if (!strcmp8 (arrStr, kStringStereoSide))
return kStereoSide;
if (!strcmp8 (arrStr, kStringStereoCLfe))
return kStereoCLfe;
if (!strcmp8 (arrStr, kStringStereoTF))
return kStereoTF;
if (!strcmp8 (arrStr, kStringStereoTS))
return kStereoTS;
if (!strcmp8 (arrStr, kStringStereoTR))
return kStereoTR;
if (!strcmp8 (arrStr, kStringStereoBF))
return kStereoBF;
if (!strcmp8 (arrStr, kString30Cine))
return k30Cine;
if (!strcmp8 (arrStr, kString30Music))
return k30Music;
if (!strcmp8 (arrStr, kString31Cine))
return k31Cine;
if (!strcmp8 (arrStr, kString31Music))
return k31Music;
if (!strcmp8 (arrStr, kString40Cine))
return k40Cine;
if (!strcmp8 (arrStr, kString40Music))
return k40Music;
if (!strcmp8 (arrStr, kString41Cine))
return k41Cine;
if (!strcmp8 (arrStr, kString41Music))
return k41Music;
if (!strcmp8 (arrStr, kString50))
return k50;
if (!strcmp8 (arrStr, kString51))
return k51;
if (!strcmp8 (arrStr, kString60Cine))
return k60Cine;
if (!strcmp8 (arrStr, kString60Music))
return k60Music;
if (!strcmp8 (arrStr, kString61Cine))
return k61Cine;
if (!strcmp8 (arrStr, kString61Music))
return k61Music;
if (!strcmp8 (arrStr, kString70Cine))
return k70Cine;
if (!strcmp8 (arrStr, kString70Music))
return k70Music;
if (!strcmp8 (arrStr, kString71Cine))
return k71Cine;
if (!strcmp8 (arrStr, kString71Music))
return k71Music;
if (!strcmp8 (arrStr, kString71Proximity))
return k71Proximity;
if (!strcmp8 (arrStr, kString80Cine))
return k80Cine;
if (!strcmp8 (arrStr, kString80Music))
return k80Music;
if (!strcmp8 (arrStr, kString81Cine))
return k81Cine;
if (!strcmp8 (arrStr, kString81Music))
return k81Music;
if (!strcmp8 (arrStr, kString102))
return k102;
if (!strcmp8 (arrStr, kString122))
return k122;
if (!strcmp8 (arrStr, kString80Cube))
return k80Cube;
if (!strcmp8 (arrStr, kStringBFormat1stOrder))
return kBFormat1stOrder;
if (!strcmp8 (arrStr, kString71CineTopCenter))
return k71CineTopCenter;
if (!strcmp8 (arrStr, kString71CineCenterHigh))
return k71CineCenterHigh;
if (!strcmp8 (arrStr, kString71CineFrontHigh))
return k71CineFrontHigh;
if (!strcmp8 (arrStr, kString71CineSideHigh))
return k71CineSideHigh;
if (!strcmp8 (arrStr, kString71CineFullRear))
return k71CineFullRear;
if (!strcmp8 (arrStr, kString90))
return k90;
if (!strcmp8 (arrStr, kString81MPEG))
return k81MPEG3D;
if (!strcmp8 (arrStr, kString91))
return k91;
if (!strcmp8 (arrStr, kString91Atmos))
return k91Atmos;
if (!strcmp8 (arrStr, kString100))
return k100;
if (!strcmp8 (arrStr, kString101))
return k101;
if (!strcmp8 (arrStr, kString110))
return k110;
if (!strcmp8 (arrStr, kString111))
return k111;
if (!strcmp8 (arrStr, kString130))
return k130;
if (!strcmp8 (arrStr, kString131))
return k131;
if (!strcmp8 (arrStr, kString222))
return k222;
return kEmpty;
}

//------------------------------------------------------------------------
/** Returns the string representation of a given speaker arrangement.
Returns kStringEmpty if arr is unknown.
*/
inline CString getSpeakerArrangementString (SpeakerArrangement arr, bool withSpeakersName)
{
switch (arr)
{
case kMono: return withSpeakersName ? kStringMonoS : kStringMono;
case kStereo: return withSpeakersName ? kStringStereoS : kStringStereo;
case kStereoSurround: return withSpeakersName ? kStringStereoRS : kStringStereoR;
case kStereoCenter: return withSpeakersName ? kStringStereoCS : kStringStereoC;
case kStereoSide: return withSpeakersName ? kStringStereoSS : kStringStereoSide;
case kStereoCLfe: return withSpeakersName ? kStringStereoCLfeS: kStringStereoCLfe;
case kStereoTF: return withSpeakersName ? kStringStereoTFS : kStringStereoTF;
case kStereoTS: return withSpeakersName ? kStringStereoTSS : kStringStereoTS;
case kStereoTR: return withSpeakersName ? kStringStereoTRS : kStringStereoTR;
case kStereoBF: return withSpeakersName ? kStringStereoBFS : kStringStereoBF;
case k30Cine: return withSpeakersName ? kString30CineS : kString30Cine;
case k30Music: return withSpeakersName ? kString30MusicS : kString30Music;
case k31Cine: return withSpeakersName ? kString31CineS : kString31Cine;
case k31Music: return withSpeakersName ? kString31MusicS : kString31Music;
case k40Cine: return withSpeakersName ? kString40CineS : kString40Cine;
case k40Music: return withSpeakersName ? kString40MusicS : kString40Music;
case k41Cine: return withSpeakersName ? kString41CineS : kString41Cine;
case k41Music: return withSpeakersName ? kString41MusicS : kString41Music;
case k50: return withSpeakersName ? kString50S : kString50;
case k51: return withSpeakersName ? kString51S : kString51;
case k60Cine: return withSpeakersName ? kString60CineS : kString60Cine;
case k60Music: return withSpeakersName ? kString60MusicS : kString60Music;
case k61Cine: return withSpeakersName ? kString61CineS : kString61Cine;
case k61Music: return withSpeakersName ? kString61MusicS : kString61Music;
case k70Cine: return withSpeakersName ? kString70CineS : kString70Cine;
case k70Music: return withSpeakersName ? kString70MusicS : kString70Music;
case k71Cine: return withSpeakersName ? kString71CineS : kString71Cine;
case k71Music: return withSpeakersName ? kString71MusicS : kString71Music;
case k71Proximity: return withSpeakersName ? kString71ProximityS : kString71Proximity;
case k80Cine: return withSpeakersName ? kString80CineS : kString80Cine;
case k80Music: return withSpeakersName ? kString80MusicS : kString80Music;
case k81Cine: return withSpeakersName ? kString81CineS : kString81Cine;
case k81Music: return withSpeakersName ? kString81MusicS : kString81Music;
case k81MPEG3D: return withSpeakersName ? kString81MPEGS : kString81MPEG;
case k102: return withSpeakersName ? kString102S : kString102;
case k122: return withSpeakersName ? kString122S : kString122;
case k80Cube: return withSpeakersName ? kString80CubeS : kString80Cube;
case kBFormat1stOrder: return withSpeakersName ? kStringBFormat1stOrderS : kStringBFormat1stOrder;
case k71CineTopCenter: return withSpeakersName ? kString71CineTopCenterS : kString71CineTopCenter;
case k71CineCenterHigh: return withSpeakersName ? kString71CineCenterHighS : kString71CineCenterHigh;
case k71CineFrontHigh: return withSpeakersName ? kString71CineFrontHighS : kString71CineFrontHigh;
case k71CineSideHigh: return withSpeakersName ? kString71CineSideHighS : kString71CineSideHigh;
case k71CineFullRear: return withSpeakersName ? kString71CineFullRearS : kString71CineFullRear;
case k90: return withSpeakersName ? kString90S : kString90;
case k91: return withSpeakersName ? kString91S : kString91;
case k91Atmos: return withSpeakersName ? kString91AtmosS : kString91Atmos;
case k100: return withSpeakersName ? kString100S : kString100;
case k101: return withSpeakersName ? kString101S : kString101;
case k110: return withSpeakersName ? kString110S : kString110;
case k111: return withSpeakersName ? kString111S : kString111;
case k130: return withSpeakersName ? kString130S : kString130;
case k131: return withSpeakersName ? kString131S : kString131;
case k222: return withSpeakersName ? kString222S : kString222;
break;
}
return kStringEmpty;
}

//------------------------------------------------------------------------
/** Returns a CString representation of a given speaker in a given arrangement
*/
inline CString getSpeakerShortName (const SpeakerArrangement& arr, int32 index)
{
SpeakerArrangement arrTmp = arr;

bool found = false;
int32 index2 = -1;
int32 pos = -1;
while (arrTmp)
{
if (arrTmp & 0x1)
index2++;
pos++;
if (index2 == index)
{
found = true;
break;
}
arrTmp = arrTmp >> 1;
}

if (!found)
return "";

switch ((Speaker)1 << pos)
{
case kSpeakerL:
return "L";
case kSpeakerR:
return "R";
case kSpeakerC:
return "C";
case kSpeakerLfe:
return "LFE";
case kSpeakerLs:
return "Ls";
case kSpeakerRs:
return "Rs";
case kSpeakerLc:
return "Lc";
case kSpeakerRc:
return "Rc";
case kSpeakerS:
return "S";
case kSpeakerSl:
return "Sl";
case kSpeakerSr:
return "Sr";
case kSpeakerTc:
return "Tc";
case kSpeakerTfl:
return "Tfl";
case kSpeakerTfc:
return "Tfc";
case kSpeakerTfr:
return "Tfr";
case kSpeakerTrl:
return "Trl";
case kSpeakerTrc:
return "Trc";
case kSpeakerTrr:
return "Trr";
case kSpeakerLfe2:
return "LFE2";
case kSpeakerM:
return "M";

case kSpeakerW:
return "W";
case kSpeakerX:
return "X";
case kSpeakerY:
return "Y";
case kSpeakerZ:
return "Z";

case kSpeakerTsl:
return "Tsl";
case kSpeakerTsr:
return "Tsr";
case kSpeakerLcs:
return "Lcs";
case kSpeakerRcs:
return "Rcs";

case kSpeakerBfl:
return "Bfl";
case kSpeakerBfc:
return "Bfc";
case kSpeakerBfr:
return "Bfr";
case kSpeakerPl:
return "Pl";
case kSpeakerPr:
return "Pr";
}
return "";
}

/*@}*/

//------------------------------------------------------------------------
} // namespace SpeakerArr
} // namespace Vst
} // namespace Steinberg

+ 0
- 85
source/includes/vst3sdk/public.sdk/CMakeLists.txt View File

@@ -1,85 +0,0 @@

set(sdk_sources
source/common/pluginview.cpp
source/main/pluginfactoryvst3.cpp
source/vst/vstaudioeffect.cpp
source/vst/vstbus.cpp
source/vst/vstbypassprocessor.cpp
source/vst/vstcomponent.cpp
source/vst/vstcomponentbase.cpp
source/vst/vsteditcontroller.cpp
source/vst/vstinitiids.cpp
source/vst/vstnoteexpressiontypes.cpp
source/vst/vstparameters.cpp
source/vst/vstpresetfile.cpp
source/vst/vstrepresentation.cpp
)

set(pluginterfaces_sources
${SDK_ROOT}/pluginterfaces/base/falignpop.h
${SDK_ROOT}/pluginterfaces/base/falignpush.h
${SDK_ROOT}/pluginterfaces/base/fplatform.h
${SDK_ROOT}/pluginterfaces/base/fstrdefs.h
${SDK_ROOT}/pluginterfaces/base/ftypes.h
${SDK_ROOT}/pluginterfaces/base/funknown.h
${SDK_ROOT}/pluginterfaces/base/futils.h
${SDK_ROOT}/pluginterfaces/base/fvariant.h
${SDK_ROOT}/pluginterfaces/base/geoconstants.h
${SDK_ROOT}/pluginterfaces/base/ibstream.h
${SDK_ROOT}/pluginterfaces/base/icloneable.h
${SDK_ROOT}/pluginterfaces/base/ierrorcontext.h
${SDK_ROOT}/pluginterfaces/base/ipersistent.h
${SDK_ROOT}/pluginterfaces/base/ipluginbase.h
${SDK_ROOT}/pluginterfaces/base/istringresult.h
${SDK_ROOT}/pluginterfaces/base/iupdatehandler.h
${SDK_ROOT}/pluginterfaces/base/keycodes.h
${SDK_ROOT}/pluginterfaces/base/pluginbasefwd.h
${SDK_ROOT}/pluginterfaces/base/smartpointer.h
${SDK_ROOT}/pluginterfaces/base/ucolorspec.h
${SDK_ROOT}/pluginterfaces/base/conststringtable.cpp
${SDK_ROOT}/pluginterfaces/base/conststringtable.h
${SDK_ROOT}/pluginterfaces/base/funknown.cpp
${SDK_ROOT}/pluginterfaces/base/ustring.cpp
${SDK_ROOT}/pluginterfaces/base/ustring.h
)

set(vst_includes
${SDK_ROOT}/pluginterfaces/gui/iplugview.h
${SDK_ROOT}/pluginterfaces/gui/iplugviewcontentscalesupport.h
${SDK_ROOT}/pluginterfaces/vst/ivstattributes.h
${SDK_ROOT}/pluginterfaces/vst/ivstaudioprocessor.h
${SDK_ROOT}/pluginterfaces/vst/ivstautomationstate.h
${SDK_ROOT}/pluginterfaces/vst/ivstchannelcontextinfo.h
${SDK_ROOT}/pluginterfaces/vst/ivstcomponent.h
${SDK_ROOT}/pluginterfaces/vst/ivstcontextmenu.h
${SDK_ROOT}/pluginterfaces/vst/ivsteditcontroller.h
${SDK_ROOT}/pluginterfaces/vst/ivstevents.h
${SDK_ROOT}/pluginterfaces/vst/ivsthostapplication.h
${SDK_ROOT}/pluginterfaces/vst/ivstinterappaudio.h
${SDK_ROOT}/pluginterfaces/vst/ivstmessage.h
${SDK_ROOT}/pluginterfaces/vst/ivstmidicontrollers.h
${SDK_ROOT}/pluginterfaces/vst/ivstnoteexpression.h
${SDK_ROOT}/pluginterfaces/vst/ivstparameterchanges.h
${SDK_ROOT}/pluginterfaces/vst/ivstplugview.h
${SDK_ROOT}/pluginterfaces/vst/ivstprefetchablesupport.h
${SDK_ROOT}/pluginterfaces/vst/ivstprocesscontext.h
${SDK_ROOT}/pluginterfaces/vst/ivstrepresentation.h
${SDK_ROOT}/pluginterfaces/vst/ivstunits.h
${SDK_ROOT}/pluginterfaces/vst/vstpresetkeys.h
${SDK_ROOT}/pluginterfaces/vst/vstpshpack4.h
${SDK_ROOT}/pluginterfaces/vst/vsttypes.h
)

add_library(sdk STATIC ${sdk_sources} ${pluginterfaces_sources} ${vst_includes})
target_link_libraries(sdk PRIVATE base)

# iOS target
if(MAC AND XCODE AND IOS_DEVELOPMENT_TEAM)
add_library(sdk_ios STATIC ${sdk_sources} ${pluginterfaces_sources} ${vst_includes})
smtg_set_platform_ios(sdk_ios)
target_link_libraries(sdk_ios PRIVATE base_ios)
endif()

source_group("public.sdk" FILES ${sdk_sources})
source_group("vst" FILES ${vst_includes})
source_group("base" FILES ${pluginterfaces_sources})

+ 1
- 1
source/includes/vst3sdk/public.sdk/LICENSE.txt View File

@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:


+ 15
- 0
source/includes/vst3sdk/public.sdk/README.md View File

@@ -0,0 +1,15 @@
# Welcome to VST SDK 3 public_sdk
Here are located:
- helper classes implementing VST3 Interfaces
- samples of VST3 hosting and VST3 Plug-Ins
- AAX Wrapper
- AU Wrapper
- AUv3 Wrapper
- VST2 Wrapper
- InterAppAudio
## License & Usage guidelines
More details are found at [www.steinberg.net/sdklicenses_vst3](http://www.steinberg.net/sdklicenses_vst3)

+ 1
- 1
source/includes/vst3sdk/public.sdk/source/common/memorystream.cpp View File

@@ -8,7 +8,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:


+ 1
- 1
source/includes/vst3sdk/public.sdk/source/common/memorystream.h View File

@@ -8,7 +8,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:


+ 4
- 22
source/includes/vst3sdk/public.sdk/source/common/pluginview.cpp View File

@@ -8,7 +8,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -42,11 +42,8 @@ namespace Steinberg {
// CPluginView implementation
//------------------------------------------------------------------------
CPluginView::CPluginView (const ViewRect* _rect)
: rect (0, 0, 0, 0)
, systemWindow (0)
, plugFrame (0)
: rect (0, 0, 0, 0), systemWindow (nullptr), plugFrame (nullptr)
{
//TODO FUNKNOWN_CTOR
if (_rect)
rect = *_rect;
}
@@ -54,23 +51,8 @@ CPluginView::CPluginView (const ViewRect* _rect)
//------------------------------------------------------------------------
CPluginView::~CPluginView ()
{
//TODO FUNKNOWN_DTOR
}

//------------------------------------------------------------------------
// TODO IMPLEMENT_REFCOUNT (CPluginView)

//------------------------------------------------------------------------
/* TODO
tresult PLUGIN_API CPluginView::queryInterface (const char* iid, void** obj)
{
QUERY_INTERFACE (iid, obj, Steinberg::FUnknown::iid, IPlugView)
QUERY_INTERFACE (iid, obj, Steinberg::IPlugView::iid, IPlugView)
*obj = 0;
return kNoInterface;
}*/


//------------------------------------------------------------------------
tresult PLUGIN_API CPluginView::isPlatformTypeSupported (FIDString /*type*/)
{
@@ -81,7 +63,7 @@ tresult PLUGIN_API CPluginView::isPlatformTypeSupported (FIDString /*type*/)
tresult PLUGIN_API CPluginView::attached (void* parent, FIDString /*type*/)
{
systemWindow = parent;
attachedToParent ();
return kResultOk;
}
@@ -89,7 +71,7 @@ tresult PLUGIN_API CPluginView::attached (void* parent, FIDString /*type*/)
//------------------------------------------------------------------------
tresult PLUGIN_API CPluginView::removed ()
{
systemWindow = 0;
systemWindow = nullptr;

removedFromParent ();
return kResultOk;


+ 3
- 3
source/includes/vst3sdk/public.sdk/source/common/pluginview.h View File

@@ -8,7 +8,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -51,7 +51,7 @@ class CPluginView: public FObject,
{
public:
//------------------------------------------------------------------------
CPluginView (const ViewRect* rect = 0);
CPluginView (const ViewRect* rect = nullptr);
virtual ~CPluginView ();

/** Returns its current frame rectangle. */
@@ -61,7 +61,7 @@ public:
void setRect (const ViewRect& r) { rect = r; }

/** Checks if this view is attached to its parent view. */
bool isAttached () const { return systemWindow != 0; }
bool isAttached () const { return systemWindow != nullptr; }

/** Calls when this view will be attached to its parent view. */
virtual void attachedToParent () {}


+ 0
- 105
source/includes/vst3sdk/public.sdk/source/main/dllmain.cpp View File

@@ -1,105 +0,0 @@
//-----------------------------------------------------------------------------
// Project : SDK Core
// Version : 1.0
//
// Category : Common Base Classes
// Filename : public.sdk/source/main/dllmain.cpp
// Created by : Steinberg, 01/2004
// Description : Windows DLL Entry
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#include "pluginterfaces/base/ftypes.h"

#include <windows.h>

#if defined (_MSC_VER) && defined (DEVELOPMENT)
#include <crtdbg.h>
#endif

#ifdef UNICODE
#define tstrrchr wcsrchr
#else
#define tstrrchr strrchr
#endif

//------------------------------------------------------------------------
HINSTANCE ghInst = 0;
void* moduleHandle = 0;
Steinberg::tchar gPath[MAX_PATH] = {0};

//------------------------------------------------------------------------
#define DllExport __declspec( dllexport )

//------------------------------------------------------------------------
extern bool InitModule (); ///< must be provided by Plug-in: called when the library is loaded
extern bool DeinitModule (); ///< must be provided by Plug-in: called when the library is unloaded

//------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif
bool DllExport InitDll () ///< must be called from host right after loading dll
{
return InitModule ();
}
bool DllExport ExitDll () ///< must be called from host right before unloading dll
{
return DeinitModule ();
}
#ifdef __cplusplus
} // extern "C"
#endif

//------------------------------------------------------------------------
BOOL WINAPI DllMain (HINSTANCE hInst, DWORD dwReason, LPVOID /*lpvReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
#if defined (_MSC_VER) && defined (DEVELOPMENT)
_CrtSetReportMode ( _CRT_WARN, _CRTDBG_MODE_DEBUG );
_CrtSetReportMode ( _CRT_ERROR, _CRTDBG_MODE_DEBUG );
_CrtSetReportMode ( _CRT_ASSERT, _CRTDBG_MODE_DEBUG );
int flag = _CrtSetDbgFlag (_CRTDBG_REPORT_FLAG);
_CrtSetDbgFlag (flag | _CRTDBG_LEAK_CHECK_DF);
#endif

moduleHandle = ghInst = hInst;

// gets the path of the component
if (GetModuleFileName (ghInst, gPath, MAX_PATH) > 0)
{
Steinberg::tchar* bkslash = tstrrchr (gPath, TEXT ('\\'));
if (bkslash)
gPath[bkslash - gPath + 1] = 0;
}
}

return TRUE;
}

+ 0
- 80
source/includes/vst3sdk/public.sdk/source/main/linuxmain.cpp View File

@@ -1,80 +0,0 @@
//-----------------------------------------------------------------------------
// Project : SDK Core
// Version : 1.0
//
// Category : Common Base Classes
// Filename : public.sdk/source/main/linuxmain.cpp
// Created by : Steinberg, 01/2004
// Description : Linux Component Entry
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#define EXPORT __attribute__ ((visibility ("default")))
#else
#define EXPORT
#endif

//------------------------------------------------------------------------
void* moduleHandle = 0;

//------------------------------------------------------------------------
bool InitModule (); ///< must be provided by Plug-in: called when the library is loaded
bool DeinitModule (); ///< must be provided by Plug-in: called when the library is unloaded

//------------------------------------------------------------------------
extern "C"
{
EXPORT bool ModuleEntry (void*);
EXPORT bool ModuleExit (void);
}

static int counter {0};

//------------------------------------------------------------------------
bool ModuleEntry (void* sharedLibraryHandle)
{
if (++counter == 1)
{
moduleHandle = sharedLibraryHandle;
return InitModule ();
}
return true;
}

//------------------------------------------------------------------------
bool ModuleExit (void)
{
if (--counter == 0)
{
moduleHandle = nullptr;
return DeinitModule ();
}
return true;
}

+ 0
- 3
source/includes/vst3sdk/public.sdk/source/main/macexport.exp View File

@@ -1,3 +0,0 @@
_GetPluginFactory
_bundleEntry
_bundleExit

+ 0
- 113
source/includes/vst3sdk/public.sdk/source/main/macmain.cpp View File

@@ -1,113 +0,0 @@
//-----------------------------------------------------------------------------
// Project : SDK Core
// Version : 1.0
//
// Category : Common Base Classes
// Filename : public.sdk/source/main/macmain.cpp
// Created by : Steinberg, 01/2004
// Description : Mac OS X Bundle Entry
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#ifndef __CF_USE_FRAMEWORK_INCLUDES__
#define __CF_USE_FRAMEWORK_INCLUDES__ 1
#endif

#include <CoreFoundation/CoreFoundation.h>

#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#define EXPORT __attribute__ ((visibility ("default")))
#else
#define EXPORT
#endif

//------------------------------------------------------------------------
CFBundleRef ghInst = 0;
unsigned int bundleRefCounter = 0; // counting for bundleEntry/bundleExit pairs
void* moduleHandle = 0;
#define MAX_PATH 2048
char gPath[MAX_PATH] = {0};

//------------------------------------------------------------------------
bool InitModule (); ///< must be provided by Plug-in: called when the library is loaded
bool DeinitModule (); ///< must be provided by Plug-in: called when the library is unloaded

//------------------------------------------------------------------------
extern "C"
{
EXPORT bool bundleEntry (CFBundleRef);
EXPORT bool bundleExit (void);
}

#include <vector>

std::vector< CFBundleRef > gBundleRefs;

//------------------------------------------------------------------------
bool bundleEntry (CFBundleRef ref)
{
if (ref)
{
bundleRefCounter++;
CFRetain (ref);
// hold all bundle refs until plug-in is fully uninitialized
gBundleRefs.push_back (ref);
if (!moduleHandle)
{
ghInst = ref;
moduleHandle = ref;
// optain the bundle path
CFURLRef tempURL = CFBundleCopyBundleURL (ref);
CFURLGetFileSystemRepresentation (tempURL, true, (UInt8*)gPath, MAX_PATH);
CFRelease (tempURL);
}
}
return InitModule ();
}

//------------------------------------------------------------------------
bool bundleExit (void)
{
if (DeinitModule ())
{
if (--bundleRefCounter == 0)
{ // release the CFBundleRef's once all bundleExit clients called in
// there is no way to identify the proper CFBundleRef of the bundleExit call
for (size_t i = 0; i < gBundleRefs.size(); i++)
CFRelease (gBundleRefs[i]);
gBundleRefs.clear();
}
return true;
}
return false;
}

+ 0
- 278
source/includes/vst3sdk/public.sdk/source/main/pluginfactoryvst3.cpp View File

@@ -1,278 +0,0 @@
//------------------------------------------------------------------------
// Project : VST SDK
//
// Category : Common Base Classes
// Filename : public.sdk/source/main/pluginfactoryvst3.cpp
// Created by : Steinberg, 01/2004
// Description : Standard Plug-in Factory
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#include "pluginfactoryvst3.h"
#include "pluginterfaces/gui/iplugview.h"
#include "pluginterfaces/base/ibstream.h"

#include <stdlib.h>

namespace Steinberg {

CPluginFactory* gPluginFactory = 0;

DEF_CLASS_IID (IPluginBase)
DEF_CLASS_IID (IPlugView)
DEF_CLASS_IID (IPlugViewIdleHandler)
DEF_CLASS_IID (IPlugFrame)
DEF_CLASS_IID (IPlugFrameIdle)
DEF_CLASS_IID (IBStream)
DEF_CLASS_IID (IPluginFactory)
DEF_CLASS_IID (IPluginFactory2)
DEF_CLASS_IID (IPluginFactory3)
//------------------------------------------------------------------------
// CPluginFactory implementation
//------------------------------------------------------------------------
CPluginFactory::CPluginFactory (const PFactoryInfo& info)
: classes (0)
, classCount (0)
, maxClassCount (0)
{
FUNKNOWN_CTOR

factoryInfo = info;
}

//------------------------------------------------------------------------
CPluginFactory::~CPluginFactory ()
{
if (gPluginFactory == this)
gPluginFactory = 0;

if (classes)
free (classes);

FUNKNOWN_DTOR
}

//------------------------------------------------------------------------
IMPLEMENT_REFCOUNT (CPluginFactory)

//------------------------------------------------------------------------
tresult PLUGIN_API CPluginFactory::queryInterface (FIDString _iid, void** obj)
{
QUERY_INTERFACE (_iid, obj, IPluginFactory::iid, IPluginFactory)
QUERY_INTERFACE (_iid, obj, IPluginFactory2::iid, IPluginFactory2)
QUERY_INTERFACE (_iid, obj, IPluginFactory3::iid, IPluginFactory3)
QUERY_INTERFACE (_iid, obj, FUnknown::iid, IPluginFactory)
*obj = 0;
return kNoInterface;
}

//------------------------------------------------------------------------
bool CPluginFactory::registerClass (const PClassInfo* info,
FUnknown* (*createFunc)(void*), void* context)
{
if (!info || !createFunc)
return false;

PClassInfo2 info2;
memcpy (&info2, info, sizeof (PClassInfo));
return registerClass (&info2, createFunc, context);
}

//------------------------------------------------------------------------
bool CPluginFactory::registerClass (const PClassInfo2* info,
FUnknown* (*createFunc)(void*), void* context)
{
if (!info || !createFunc)
return false;

if (classCount >= maxClassCount)
{
if (!growClasses ())
return false;
}

PClassEntry& entry = classes[classCount];
entry.info8 = *info;
entry.info16.fromAscii (*info);
entry.createFunc = createFunc;
entry.context = context;
entry.isUnicode = false;

classCount++;
return true;
}

//------------------------------------------------------------------------
bool CPluginFactory::registerClass (const PClassInfoW* info,
FUnknown* (*createFunc)(void*), void* context)
{
if (!info || !createFunc)
return false;

if (classCount >= maxClassCount)
{
if (!growClasses ())
return false;
}

PClassEntry& entry = classes[classCount];
entry.info16 = *info;
entry.createFunc = createFunc;
entry.context = context;
entry.isUnicode = true;

classCount++;
return true;
}

//------------------------------------------------------------------------
bool CPluginFactory::growClasses ()
{
static const int32 delta = 10;

size_t size = (maxClassCount + delta) * sizeof (PClassEntry);
void* memory = classes;

if (!memory)
memory = malloc (size);
else
memory = realloc (memory, size);

if (!memory)
return false;

classes = (PClassEntry*)memory;
maxClassCount += delta;
return true;
}

//------------------------------------------------------------------------
bool CPluginFactory::isClassRegistered (const FUID& cid)
{
for (int32 i = 0; i < classCount; i++)
{
if (cid == classes[i].info16.cid)
return true;
}
return false;
}

//------------------------------------------------------------------------
tresult PLUGIN_API CPluginFactory::getFactoryInfo (PFactoryInfo* info)
{
if (info)
memcpy (info, &factoryInfo, sizeof (PFactoryInfo));
return kResultOk;
}

//------------------------------------------------------------------------
int32 PLUGIN_API CPluginFactory::countClasses ()
{
return classCount;
}

//------------------------------------------------------------------------
tresult PLUGIN_API CPluginFactory::getClassInfo (int32 index, PClassInfo* info)
{
if (info && (index >= 0 && index < classCount))
{
if (classes[index].isUnicode)
{
memset (info, 0, sizeof (PClassInfo));
return kResultFalse;
}

memcpy (info, &classes[index].info8, sizeof (PClassInfo));
return kResultOk;
}
return kInvalidArgument;
}

//------------------------------------------------------------------------
tresult PLUGIN_API CPluginFactory::getClassInfo2 (int32 index, PClassInfo2* info)
{
if (info && (index >= 0 && index < classCount))
{
if (classes[index].isUnicode)
{
memset (info, 0, sizeof (PClassInfo2));
return kResultFalse;
}

memcpy (info, &classes[index].info8, sizeof (PClassInfo2));
return kResultOk;
}
return kInvalidArgument;
}

//------------------------------------------------------------------------
tresult PLUGIN_API CPluginFactory::getClassInfoUnicode (int32 index, PClassInfoW* info)
{
if (info && (index >= 0 && index < classCount))
{
memcpy (info, &classes[index].info16, sizeof (PClassInfoW));
return kResultOk;
}
return kInvalidArgument;
}

//------------------------------------------------------------------------
tresult PLUGIN_API CPluginFactory::createInstance (FIDString cid, FIDString _iid, void** obj)
{
for (int32 i = 0; i < classCount; i++)
{
if (memcmp (classes[i].info16.cid, cid, sizeof (TUID)) == 0)
{
FUnknown* instance = classes[i].createFunc (classes[i].context);
if (instance)
{
if (instance->queryInterface (_iid, obj) == kResultOk)
{
instance->release ();
return kResultOk;
}
else
instance->release ();
}
break;
}
}

*obj = 0;
return kNoInterface;
}

//------------------------------------------------------------------------
tresult PLUGIN_API CPluginFactory::setHostContext (FUnknown* /*context*/)
{
return kNotImplemented;
}

} // namespace Steinberg

+ 0
- 175
source/includes/vst3sdk/public.sdk/source/main/pluginfactoryvst3.h View File

@@ -1,175 +0,0 @@
//------------------------------------------------------------------------
// Project : VST SDK
//
// Category : Common Base Classes
// Filename : public.sdk/source/main/pluginfactoryvst3.h
// Created by : Steinberg, 01/2004
// Description : Standard Plug-in Factory
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#pragma once

#include "pluginterfaces/base/ipluginbase.h"

namespace Steinberg {

//------------------------------------------------------------------------
/** Default Class Factory implementation.
\ingroup sdkBase
\see \ref classFactoryMacros */
//------------------------------------------------------------------------
class CPluginFactory : public IPluginFactory3
{
public:
//------------------------------------------------------------------------
CPluginFactory (const PFactoryInfo& info);
virtual ~CPluginFactory ();

//------------------------------------------------------------------------
/** Registers a Plug-in class with classInfo version 1, returns true for success. */
bool registerClass (const PClassInfo* info,
FUnknown* (*createFunc)(void*),
void* context = 0);

/** Registers a Plug-in class with classInfo version 2, returns true for success. */
bool registerClass (const PClassInfo2* info,
FUnknown* (*createFunc)(void*),
void* context = 0);

/** Registers a Plug-in class with classInfo Unicode version, returns true for success. */
bool registerClass (const PClassInfoW* info,
FUnknown* (*createFunc)(void*),
void* context = 0);


/** Check if a class for a given classId is already registered. */
bool isClassRegistered (const FUID& cid);

//------------------------------------------------------------------------
DECLARE_FUNKNOWN_METHODS

//---from IPluginFactory------
tresult PLUGIN_API getFactoryInfo (PFactoryInfo* info) SMTG_OVERRIDE;
int32 PLUGIN_API countClasses () SMTG_OVERRIDE;
tresult PLUGIN_API getClassInfo (int32 index, PClassInfo* info) SMTG_OVERRIDE;
tresult PLUGIN_API createInstance (FIDString cid, FIDString _iid, void** obj) SMTG_OVERRIDE;

//---from IPluginFactory2-----
tresult PLUGIN_API getClassInfo2 (int32 index, PClassInfo2* info) SMTG_OVERRIDE;

//---from IPluginFactory3-----
tresult PLUGIN_API getClassInfoUnicode (int32 index, PClassInfoW* info) SMTG_OVERRIDE;
tresult PLUGIN_API setHostContext (FUnknown* context) SMTG_OVERRIDE;

//------------------------------------------------------------------------
protected:
/// @cond
struct PClassEntry
{
//-----------------------------------
PClassInfo2 info8;
PClassInfoW info16;

FUnknown* (*createFunc)(void*);
void* context;
bool isUnicode;
//-----------------------------------
};
/// @endcond

PFactoryInfo factoryInfo;
PClassEntry* classes;
int32 classCount;
int32 maxClassCount;

bool growClasses ();
};

extern CPluginFactory* gPluginFactory;
//------------------------------------------------------------------------
} // namespace Steinberg


//------------------------------------------------------------------------
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#define EXPORT_FACTORY __attribute__ ((visibility ("default")))
#else
#define EXPORT_FACTORY
#endif

//------------------------------------------------------------------------
/** \defgroup classFactoryMacros Macros for defining the class factory
\ingroup sdkBase

\b Example - How to use the class factory macros:
\code
BEGIN_FACTORY ("Steinberg Technologies",
"http://www.steinberg.de",
"mailto:info@steinberg.de",
PFactoryInfo::kNoFlags)

DEF_CLASS (INLINE_UID (0x00000000, 0x00000000, 0x00000000, 0x00000000),
PClassInfo::kManyInstances,
"Service",
"Test Service",
TestService::newInstance)

END_FACTORY
\endcode

@{*/

#define BEGIN_FACTORY(vendor,url,email,flags) using namespace Steinberg; \
EXPORT_FACTORY IPluginFactory* PLUGIN_API GetPluginFactory () { \
if (!gPluginFactory) \
{ static PFactoryInfo factoryInfo (vendor,url,email,flags); \
gPluginFactory = new CPluginFactory (factoryInfo); \

#define DEF_CLASS(cid,cardinality,category,name,createMethod) \
{ TUID lcid = cid; static PClassInfo componentClass (lcid,cardinality,category,name); \
gPluginFactory->registerClass (&componentClass,createMethod); }

#define DEF_CLASS1(cid,cardinality,category,name,createMethod) \
{ static PClassInfo componentClass (cid,cardinality,category,name); \
gPluginFactory->registerClass (&componentClass,createMethod); }

#define DEF_CLASS2(cid,cardinality,category,name,classFlags,subCategories,version,sdkVersion,createMethod) \
{ TUID lcid = cid; static PClassInfo2 componentClass (lcid,cardinality,category,name,classFlags,subCategories, 0 ,version,sdkVersion);\
gPluginFactory->registerClass (&componentClass,createMethod); }

#define DEF_CLASS_W(cid,cardinality,category,name,classFlags,subCategories,version,sdkVersion,createMethod) \
{ TUID lcid = cid; static PClassInfoUnicode componentClass (lcid,cardinality,category,name,classFlags,subCategories, 0,version,sdkVersion);\
gPluginFactory->registerClass (&componentClass,createMethod); }


#define END_FACTORY } else gPluginFactory->addRef (); \
return gPluginFactory; }

/** @} */

+ 0
- 4
source/includes/vst3sdk/public.sdk/source/main/winexport.def View File

@@ -1,4 +0,0 @@
EXPORTS
GetPluginFactory
InitDll
ExitDll

+ 0
- 105
source/includes/vst3sdk/public.sdk/source/vst/hosting/eventlist.cpp View File

@@ -1,105 +0,0 @@
//-----------------------------------------------------------------------------
// Project : VST SDK
//
// Category : Helpers
// Filename : public.sdk/source/vst/hosting/eventlist.cpp
// Created by : Steinberg, 03/05/2008.
// Description : VST 3 event list implementation
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#include "eventlist.h"

namespace Steinberg {
namespace Vst {

//-----------------------------------------------------------------------------
IMPLEMENT_FUNKNOWN_METHODS (EventList, IEventList, IEventList::iid)

//-----------------------------------------------------------------------------
EventList::EventList (int32 maxSize) : events (nullptr), maxSize (maxSize), fillCount (0)
{
FUNKNOWN_CTOR
setMaxSize (maxSize);
}

//-----------------------------------------------------------------------------
EventList::~EventList ()
{
setMaxSize (0);
FUNKNOWN_DTOR
}

//-----------------------------------------------------------------------------
void EventList::setMaxSize (int32 _maxSize)
{
if (events)
{
delete[] events;
events = nullptr;
}
if (_maxSize > 0)
events = new Event[_maxSize];
maxSize = _maxSize;
}

//-----------------------------------------------------------------------------
tresult PLUGIN_API EventList::getEvent (int32 index, Event& e)
{
if (fillCount > index)
{
memcpy (&e, &events[index], sizeof (Event));
return kResultTrue;
}
return kResultFalse;
}

//-----------------------------------------------------------------------------
tresult PLUGIN_API EventList::addEvent (Event& e)
{
if (maxSize > fillCount)
{
memcpy (&events[fillCount], &e, sizeof (Event));
fillCount++;
return kResultTrue;
}
return kResultFalse;
}

//-----------------------------------------------------------------------------
Event* EventList::getEventByIndex (int32 index)
{
if (index < fillCount)
return &events[index];
return nullptr;
}

//------------------------------------------------------------------------
} // namespace Vst
} // namespace Steinberg

+ 21
- 9
source/includes/vst3sdk/public.sdk/source/vst/hosting/hostclasses.cpp View File

@@ -8,7 +8,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -41,6 +41,14 @@
namespace Steinberg {
namespace Vst {

//-----------------------------------------------------------------------------
HostApplication::HostApplication ()
{
FUNKNOWN_CTOR

mPlugInterfaceSupport = owned (NEW PlugInterfaceSupport);
}

//-----------------------------------------------------------------------------
tresult PLUGIN_API HostApplication::getName (String128 name)
{
@@ -52,8 +60,8 @@ tresult PLUGIN_API HostApplication::getName (String128 name)
//-----------------------------------------------------------------------------
tresult PLUGIN_API HostApplication::createInstance (TUID cid, TUID _iid, void** obj)
{
FUID classID (cid);
FUID interfaceID (_iid);
FUID classID (FUID::fromTUID (cid));
FUID interfaceID (FUID::fromTUID (_iid));
if (classID == IMessage::iid && interfaceID == IMessage::iid)
{
*obj = new HostMessage;
@@ -64,7 +72,7 @@ tresult PLUGIN_API HostApplication::createInstance (TUID cid, TUID _iid, void**
*obj = new HostAttributeList;
return kResultTrue;
}
*obj = 0;
*obj = nullptr;
return kResultFalse;
}

@@ -73,7 +81,11 @@ tresult PLUGIN_API HostApplication::queryInterface (const char* _iid, void** obj
{
QUERY_INTERFACE (_iid, obj, FUnknown::iid, IHostApplication)
QUERY_INTERFACE (_iid, obj, IHostApplication::iid, IHostApplication)
*obj = 0;

if (mPlugInterfaceSupport && mPlugInterfaceSupport->queryInterface (iid, obj) == kResultTrue)
return kResultOk;

*obj = nullptr;
return kResultFalse;
}

@@ -94,7 +106,7 @@ uint32 PLUGIN_API HostApplication::release ()
//-----------------------------------------------------------------------------
IMPLEMENT_FUNKNOWN_METHODS (HostMessage, IMessage, IMessage::iid)
//-----------------------------------------------------------------------------
HostMessage::HostMessage () : messageId (0), attributeList (0)
HostMessage::HostMessage () : messageId (nullptr), attributeList (nullptr)
{
FUNKNOWN_CTOR
}
@@ -102,7 +114,7 @@ HostMessage::HostMessage () : messageId (0), attributeList (0)
//-----------------------------------------------------------------------------
HostMessage::~HostMessage ()
{
setMessageID (0);
setMessageID (nullptr);
if (attributeList)
attributeList->release ();
FUNKNOWN_DTOR
@@ -119,7 +131,7 @@ void PLUGIN_API HostMessage::setMessageID (const char* mid)
{
if (messageId)
delete[] messageId;
messageId = 0;
messageId = nullptr;
if (mid)
{
size_t len = strlen (mid) + 1;
@@ -195,7 +207,7 @@ protected:
Type type;
};

typedef std::map<String, HostAttribute*>::iterator mapIterator;
using mapIterator = std::map<String, HostAttribute*>::iterator;

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------


+ 10
- 5
source/includes/vst3sdk/public.sdk/source/vst/hosting/hostclasses.h View File

@@ -8,7 +8,7 @@
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
// (c) 2019, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
@@ -36,10 +36,9 @@

#pragma once

#include "pluginterfaces/vst/ivsthostapplication.h"

#include "public.sdk/source/vst/hosting/pluginterfacesupport.h"
#include "base/source/fstring.h"
#include "pluginterfaces/vst/ivsthostapplication.h"
#include <map>

namespace Steinberg {
@@ -52,13 +51,19 @@ namespace Vst {
class HostApplication : public IHostApplication
{
public:
HostApplication () { FUNKNOWN_CTOR }
HostApplication ();
virtual ~HostApplication () { FUNKNOWN_DTOR }

//--- IHostApplication ---------------
tresult PLUGIN_API getName (String128 name) SMTG_OVERRIDE;
tresult PLUGIN_API createInstance (TUID cid, TUID _iid, void** obj) SMTG_OVERRIDE;

DECLARE_FUNKNOWN_METHODS

PlugInterfaceSupport* getPlugInterfaceSupport () const { return mPlugInterfaceSupport; }

protected:
IPtr<PlugInterfaceSupport> mPlugInterfaceSupport;
};

class HostAttribute;


+ 0
- 284
source/includes/vst3sdk/public.sdk/source/vst/hosting/module.cpp View File

@@ -1,284 +0,0 @@
//-----------------------------------------------------------------------------
// Project : VST SDK
//
// Category : Helpers
// Filename : public.sdk/source/vst/hosting/module.cpp
// Created by : Steinberg, 08/2016
// Description : hosting module classes
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#include "module.h"
#include "stringconvert.h"
#include <sstream>
#include <utility>

//------------------------------------------------------------------------
namespace VST3 {
namespace Hosting {

//------------------------------------------------------------------------
FactoryInfo::FactoryInfo (PFactoryInfo&& other) noexcept
{
*this = std::move (other);
}

//------------------------------------------------------------------------
FactoryInfo& FactoryInfo::operator= (FactoryInfo&& other) noexcept
{
info = std::move (other.info);
other.info = {};
return *this;
}

//------------------------------------------------------------------------
FactoryInfo& FactoryInfo::operator= (PFactoryInfo&& other) noexcept
{
info = std::move (other);
other = {};
return *this;
}

//------------------------------------------------------------------------
std::string FactoryInfo::vendor () const noexcept
{
return StringConvert::convert (info.vendor, PFactoryInfo::kNameSize);
}

//------------------------------------------------------------------------
std::string FactoryInfo::url () const noexcept
{
return StringConvert::convert (info.url, PFactoryInfo::kURLSize);
}

//------------------------------------------------------------------------
std::string FactoryInfo::email () const noexcept
{
return StringConvert::convert (info.email, PFactoryInfo::kEmailSize);
}

//------------------------------------------------------------------------
Steinberg::int32 FactoryInfo::flags () const noexcept
{
return info.flags;
}

//------------------------------------------------------------------------
bool FactoryInfo::classesDiscardable () const noexcept
{
return (info.flags & PFactoryInfo::kClassesDiscardable) != 0;
}

//------------------------------------------------------------------------
bool FactoryInfo::licenseCheck () const noexcept
{
return (info.flags & PFactoryInfo::kLicenseCheck) != 0;
}

//------------------------------------------------------------------------
bool FactoryInfo::componentNonDiscardable () const noexcept
{
return (info.flags & PFactoryInfo::kComponentNonDiscardable) != 0;
}

//------------------------------------------------------------------------
//------------------------------------------------------------------------
//------------------------------------------------------------------------
PluginFactory::PluginFactory (const PluginFactoryPtr& factory) noexcept : factory (factory)
{
}

//------------------------------------------------------------------------
void PluginFactory::setHostContext (Steinberg::FUnknown* context) const noexcept
{
if (auto f = Steinberg::FUnknownPtr<Steinberg::IPluginFactory3> (factory))
f->setHostContext (context);
}

//------------------------------------------------------------------------
FactoryInfo PluginFactory::info () const noexcept
{
Steinberg::PFactoryInfo i;
factory->getFactoryInfo (&i);
return FactoryInfo (std::move (i));
}

//------------------------------------------------------------------------
uint32_t PluginFactory::classCount () const noexcept
{
auto count = factory->countClasses ();
assert (count >= 0);
return static_cast<uint32_t> (count);
}

//------------------------------------------------------------------------
PluginFactory::ClassInfos PluginFactory::classInfos () const noexcept
{
auto count = classCount ();
ClassInfos classes;
classes.reserve (count);
auto f3 = Steinberg::FUnknownPtr<Steinberg::IPluginFactory3> (factory);
auto f2 = Steinberg::FUnknownPtr<Steinberg::IPluginFactory2> (factory);
Steinberg::PClassInfo ci;
Steinberg::PClassInfo2 ci2;
Steinberg::PClassInfoW ci3;
for (uint32_t i = 0; i < count; ++i)
{
if (f3 && f3->getClassInfoUnicode (i, &ci3) == Steinberg::kResultTrue)
classes.emplace_back (ci3);
else if (f2 && f2->getClassInfo2 (i, &ci2) == Steinberg::kResultTrue)
classes.emplace_back (ci2);
else if (factory->getClassInfo (i, &ci) == Steinberg::kResultTrue)
classes.emplace_back (ci);
auto& classInfo = classes.back ();
if (classInfo.vendor ().empty ())
classInfo.get ().vendor = info ().vendor ();
}
return classes;
}

//------------------------------------------------------------------------
//------------------------------------------------------------------------
//------------------------------------------------------------------------
const UID& ClassInfo::ID () const noexcept
{
return data.classID;
}

//------------------------------------------------------------------------
int32_t ClassInfo::cardinality () const noexcept
{
return data.cardinality;
}

//------------------------------------------------------------------------
const std::string& ClassInfo::category () const noexcept
{
return data.category;
}

//------------------------------------------------------------------------
const std::string& ClassInfo::name () const noexcept
{
return data.name;
}

//------------------------------------------------------------------------
const std::string& ClassInfo::vendor () const noexcept
{
return data.vendor;
}

//------------------------------------------------------------------------
const std::string& ClassInfo::version () const noexcept
{
return data.version;
}

//------------------------------------------------------------------------
const std::string& ClassInfo::sdkVersion () const noexcept
{
return data.sdkVersion;
}

//------------------------------------------------------------------------
const ClassInfo::SubCategories& ClassInfo::subCategories () const noexcept
{
return data.subCategories;
}

//------------------------------------------------------------------------
Steinberg::uint32 ClassInfo::classFlags () const noexcept
{
return data.classFlags;
}

//------------------------------------------------------------------------
ClassInfo::ClassInfo (const PClassInfo& info) noexcept
{
data.classID = info.cid;
data.cardinality = info.cardinality;
data.category = StringConvert::convert (info.category, PClassInfo::kCategorySize);
data.name = StringConvert::convert (info.name, PClassInfo::kNameSize);
}

//------------------------------------------------------------------------
ClassInfo::ClassInfo (const PClassInfo2& info) noexcept
{
data.classID = info.cid;
data.cardinality = info.cardinality;
data.category = StringConvert::convert (info.category, PClassInfo::kCategorySize);
data.name = StringConvert::convert (info.name, PClassInfo::kNameSize);
data.vendor = StringConvert::convert (info.vendor, PClassInfo2::kVendorSize);
data.version = StringConvert::convert (info.version, PClassInfo2::kVersionSize);
data.sdkVersion = StringConvert::convert (info.sdkVersion, PClassInfo2::kVersionSize);
parseSubCategories (
StringConvert::convert (info.subCategories, PClassInfo2::kSubCategoriesSize));
data.classFlags = info.classFlags;
}

//------------------------------------------------------------------------
ClassInfo::ClassInfo (const PClassInfoW& info) noexcept
{
data.classID = info.cid;
data.cardinality = info.cardinality;
data.category = StringConvert::convert (info.category, PClassInfo::kCategorySize);
data.name = StringConvert::convert (info.name, PClassInfo::kNameSize);
data.vendor = StringConvert::convert (info.vendor, PClassInfo2::kVendorSize);
data.version = StringConvert::convert (info.version, PClassInfo2::kVersionSize);
data.sdkVersion = StringConvert::convert (info.sdkVersion, PClassInfo2::kVersionSize);
parseSubCategories (
StringConvert::convert (info.subCategories, PClassInfo2::kSubCategoriesSize));
data.classFlags = info.classFlags;
}

//------------------------------------------------------------------------
void ClassInfo::parseSubCategories (const std::string& str) noexcept
{
std::stringstream stream (str);
std::string item;
while (std::getline (stream, item, '|'))
data.subCategories.emplace_back (move (item));
}

//------------------------------------------------------------------------
std::string ClassInfo::subCategoriesString () const noexcept
{
std::string result;
if (data.subCategories.empty ())
return result;
result = data.subCategories[0];
for (auto index = 1u; index < data.subCategories.size (); ++index)
result += "|" + data.subCategories[index];
return result;
}

//------------------------------------------------------------------------
} // Hosting
} // VST3

+ 0
- 193
source/includes/vst3sdk/public.sdk/source/vst/hosting/module.h View File

@@ -1,193 +0,0 @@
//-----------------------------------------------------------------------------
// Project : VST SDK
//
// Category : Helpers
// Filename : public.sdk/source/vst/hosting/module.h
// Created by : Steinberg, 08/2016
// Description : hosting module classes
//
//-----------------------------------------------------------------------------
// LICENSE
// (c) 2017, Steinberg Media Technologies GmbH, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------

#pragma once

#include "uid.h"
#include "pluginterfaces/base/ipluginbase.h"
#include <utility>
#include <vector>

//------------------------------------------------------------------------
namespace VST3 {
namespace Hosting {

//------------------------------------------------------------------------
class FactoryInfo
{
public:
//------------------------------------------------------------------------
using PFactoryInfo = Steinberg::PFactoryInfo;

FactoryInfo () noexcept {}
~FactoryInfo () noexcept {}
FactoryInfo (const FactoryInfo&) noexcept = default;
FactoryInfo (PFactoryInfo&&) noexcept;
FactoryInfo (FactoryInfo&&) noexcept = default;
FactoryInfo& operator= (const FactoryInfo&) noexcept = default;
FactoryInfo& operator= (FactoryInfo&&) noexcept;
FactoryInfo& operator= (PFactoryInfo&&) noexcept;

std::string vendor () const noexcept;
std::string url () const noexcept;
std::string email () const noexcept;
Steinberg::int32 flags () const noexcept;
bool classesDiscardable () const noexcept;
bool licenseCheck () const noexcept;
bool componentNonDiscardable () const noexcept;

PFactoryInfo& get () noexcept { return info; }
//------------------------------------------------------------------------
private:
PFactoryInfo info {};
};

//------------------------------------------------------------------------
class ClassInfo
{
public:
//------------------------------------------------------------------------
using SubCategories = std::vector<std::string>;
using PClassInfo = Steinberg::PClassInfo;
using PClassInfo2 = Steinberg::PClassInfo2;
using PClassInfoW = Steinberg::PClassInfoW;

//------------------------------------------------------------------------
ClassInfo () noexcept {}
explicit ClassInfo (const PClassInfo& info) noexcept;
explicit ClassInfo (const PClassInfo2& info) noexcept;
explicit ClassInfo (const PClassInfoW& info) noexcept;
ClassInfo (const ClassInfo&) = default;
ClassInfo& operator= (const ClassInfo&) = default;
ClassInfo (ClassInfo&&) = default;
ClassInfo& operator= (ClassInfo&&) = default;

const UID& ID () const noexcept;
int32_t cardinality () const noexcept;
const std::string& category () const noexcept;
const std::string& name () const noexcept;
const std::string& vendor () const noexcept;
const std::string& version () const noexcept;
const std::string& sdkVersion () const noexcept;
const SubCategories& subCategories () const noexcept;
std::string subCategoriesString () const noexcept;
Steinberg::uint32 classFlags () const noexcept;

struct Data
{
UID classID;
int32_t cardinality;
std::string category;
std::string name;
std::string vendor;
std::string version;
std::string sdkVersion;
SubCategories subCategories;
Steinberg::uint32 classFlags = 0;
};

Data& get () noexcept { return data; }
//------------------------------------------------------------------------
private:
void parseSubCategories (const std::string& str) noexcept;
Data data {};
};

//------------------------------------------------------------------------
class PluginFactory
{
public:
//------------------------------------------------------------------------
using ClassInfos = std::vector<ClassInfo>;
using PluginFactoryPtr = Steinberg::IPtr<Steinberg::IPluginFactory>;

//------------------------------------------------------------------------
explicit PluginFactory (const PluginFactoryPtr& factory) noexcept;

void setHostContext (Steinberg::FUnknown* context) const noexcept;

FactoryInfo info () const noexcept;
uint32_t classCount () const noexcept;
ClassInfos classInfos () const noexcept;

template <typename T>
Steinberg::IPtr<T> createInstance (const UID& classID) const noexcept;

const PluginFactoryPtr& get () const noexcept { return factory; }
//------------------------------------------------------------------------
private:
PluginFactoryPtr factory;
};

//------------------------------------------------------------------------
class Module
{
public:
//------------------------------------------------------------------------
using Ptr = std::shared_ptr<Module>;
using PathList = std::vector<std::string>;

//------------------------------------------------------------------------
static Ptr create (const std::string& path, std::string& errorDescription);
static PathList getModulePaths ();

const std::string& getName () const noexcept { return name; }
const std::string& getPath () const noexcept { return path; }
const PluginFactory& getFactory () const noexcept { return factory; }
//------------------------------------------------------------------------
protected:
virtual ~Module () noexcept = default;
virtual bool load (const std::string& path, std::string& errorDescription) = 0;

PluginFactory factory {nullptr};
std::string name;
std::string path;
};

//------------------------------------------------------------------------
template <typename T>
inline Steinberg::IPtr<T> PluginFactory::createInstance (const UID& classID) const noexcept
{
T* obj = nullptr;
if (factory->createInstance (classID.data (), T::iid, reinterpret_cast<void**> (&obj)) ==
Steinberg::kResultTrue)
return Steinberg::owned (obj);
return nullptr;
}

//------------------------------------------------------------------------
} // Hosting
} // VST3

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save