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

148 lines
5.2KB

  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. //
  4. // Category : Interfaces
  5. // Filename : pluginterfaces/vst/ivstattributes.h
  6. // Created by : Steinberg, 05/2006
  7. // Description : VST Attribute Interfaces
  8. //
  9. //-----------------------------------------------------------------------------
  10. // This file is part of a Steinberg SDK. It is subject to the license terms
  11. // in the LICENSE file found in the top-level directory of this distribution
  12. // and at www.steinberg.net/sdklicenses.
  13. // No part of the SDK, including this file, may be copied, modified, propagated,
  14. // or distributed except according to the terms contained in the LICENSE file.
  15. //-----------------------------------------------------------------------------
  16. #pragma once
  17. #include "pluginterfaces/base/funknown.h"
  18. #include "pluginterfaces/vst/vsttypes.h"
  19. //------------------------------------------------------------------------
  20. #include "pluginterfaces/base/falignpush.h"
  21. //------------------------------------------------------------------------
  22. //------------------------------------------------------------------------
  23. namespace Steinberg {
  24. namespace Vst {
  25. //------------------------------------------------------------------------
  26. /** Attribute list used in IMessage and IStreamAttributes.
  27. \ingroup vstIHost vst300
  28. - [host imp]
  29. - [released: 3.0.0]
  30. - [mandatory]
  31. An attribute list associates values with a key (id: some predefined keys could be found in \ref presetAttributes). */
  32. //------------------------------------------------------------------------
  33. class IAttributeList: public FUnknown
  34. {
  35. public:
  36. //------------------------------------------------------------------------
  37. typedef const char* AttrID;
  38. /** Sets integer value. */
  39. virtual tresult PLUGIN_API setInt (AttrID id, int64 value) = 0;
  40. /** Gets integer value. */
  41. virtual tresult PLUGIN_API getInt (AttrID id, int64& value) = 0;
  42. /** Sets float value. */
  43. virtual tresult PLUGIN_API setFloat (AttrID id, double value) = 0;
  44. /** Gets float value. */
  45. virtual tresult PLUGIN_API getFloat (AttrID id, double& value) = 0;
  46. /** Sets string value (UTF16). */
  47. virtual tresult PLUGIN_API setString (AttrID id, const TChar* string) = 0;
  48. /** Gets string value (UTF16). Note that Size is in Byte, not the string Length! (Do not forget to multiply the length by sizeof (TChar)!) */
  49. virtual tresult PLUGIN_API getString (AttrID id, TChar* string, uint32 size) = 0;
  50. /** Sets binary data. */
  51. virtual tresult PLUGIN_API setBinary (AttrID id, const void* data, uint32 size) = 0;
  52. /** Gets binary data. */
  53. virtual tresult PLUGIN_API getBinary (AttrID id, const void*& data, uint32& size) = 0;
  54. //------------------------------------------------------------------------
  55. static const FUID iid;
  56. };
  57. DECLARE_CLASS_IID (IAttributeList, 0x1E5F0AEB, 0xCC7F4533, 0xA2544011, 0x38AD5EE4)
  58. //------------------------------------------------------------------------
  59. /** Meta attributes of a stream.
  60. \ingroup vstIHost vst360
  61. - [host imp]
  62. - [extends IBStream]
  63. - [released: 3.6.0]
  64. - [optional]
  65. \code
  66. ...
  67. #include "pluginterfaces/base/ustring.h"
  68. #include "pluginterfaces/vst/vstpresetkeys.h"
  69. ...
  70. tresult PLUGIN_API MyPlugin::setState (IBStream* state)
  71. {
  72. FUnknownPtr<IStreamAttributes> stream (state);
  73. if (stream)
  74. {
  75. IAttributeList* list = stream->getAttributes ();
  76. if (list)
  77. {
  78. // get the current type (project/Default..) of this state
  79. String128 string;
  80. if (list->getString (PresetAttributes::kStateType, string, 128 * sizeof (TChar)) == kResultTrue)
  81. {
  82. UString128 tmp (string);
  83. char ascii[128];
  84. tmp.toAscii (ascii, 128);
  85. if (!strncmp (ascii, StateType::kProject, strlen (StateType::kProject)))
  86. {
  87. // we are in project loading context...
  88. }
  89. }
  90. // get the full file path of this state
  91. TChar fullPath[1024];
  92. if (list->getString (PresetAttributes::kFilePathStringType, fullPath, 1024 * sizeof (TChar)) == kResultTrue)
  93. {
  94. // here we have the full path ...
  95. }
  96. }
  97. }
  98. //...read the state here.....
  99. return kResultTrue;
  100. }
  101. \endcode
  102. Interface to access preset meta information from stream, used for example in setState in order to inform the plug-in about
  103. the current context in which this preset loading occurs (Project context or Preset load (see \ref StateType))
  104. or used to get the full file path of the loaded preset (if available). */
  105. //------------------------------------------------------------------------
  106. class IStreamAttributes: public FUnknown
  107. {
  108. public:
  109. //------------------------------------------------------------------------
  110. /** Gets filename (without file extension) of the stream. */
  111. virtual tresult PLUGIN_API getFileName (String128 name) = 0;
  112. /** Gets meta information list. */
  113. virtual IAttributeList* PLUGIN_API getAttributes () = 0;
  114. //------------------------------------------------------------------------
  115. static const FUID iid;
  116. };
  117. DECLARE_CLASS_IID (IStreamAttributes, 0xD6CE2FFC, 0xEFAF4B8C, 0x9E74F1BB, 0x12DA44B4)
  118. //------------------------------------------------------------------------
  119. } // namespace Vst
  120. } // namespace Steinberg
  121. //------------------------------------------------------------------------
  122. #include "pluginterfaces/base/falignpop.h"
  123. //------------------------------------------------------------------------