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.

ivstattributes.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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: Vst::IAttributeList
  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 can be found in \ref
  32. presetAttributes).
  33. */
  34. class IAttributeList : public FUnknown
  35. {
  36. public:
  37. //------------------------------------------------------------------------
  38. typedef const char* AttrID;
  39. /** Sets integer value. */
  40. virtual tresult PLUGIN_API setInt (AttrID id, int64 value) = 0;
  41. /** Gets integer value. */
  42. virtual tresult PLUGIN_API getInt (AttrID id, int64& value) = 0;
  43. /** Sets float value. */
  44. virtual tresult PLUGIN_API setFloat (AttrID id, double value) = 0;
  45. /** Gets float value. */
  46. virtual tresult PLUGIN_API getFloat (AttrID id, double& value) = 0;
  47. /** Sets string value (UTF16) (should be null-terminated!). */
  48. virtual tresult PLUGIN_API setString (AttrID id, const TChar* string) = 0;
  49. /** Gets string value (UTF16). Note that Size is in Byte, not the string Length!
  50. Do not forget to multiply the length by sizeof (TChar)! */
  51. virtual tresult PLUGIN_API getString (AttrID id, TChar* string, uint32 sizeInBytes) = 0;
  52. /** Sets binary data. */
  53. virtual tresult PLUGIN_API setBinary (AttrID id, const void* data, uint32 sizeInBytes) = 0;
  54. /** Gets binary data. */
  55. virtual tresult PLUGIN_API getBinary (AttrID id, const void*& data, uint32& sizeInBytes) = 0;
  56. //------------------------------------------------------------------------
  57. static const FUID iid;
  58. };
  59. DECLARE_CLASS_IID (IAttributeList, 0x1E5F0AEB, 0xCC7F4533, 0xA2544011, 0x38AD5EE4)
  60. //------------------------------------------------------------------------
  61. /** Meta attributes of a stream: Vst::IStreamAttributes
  62. \ingroup vstIHost vst360
  63. - [host imp]
  64. - [extends IBStream]
  65. - [released: 3.6.0]
  66. - [optional]
  67. Interface to access preset meta information from stream, used, for example, in setState in order to inform the plug-in about
  68. the current context in which the preset loading occurs (Project context or Preset load (see \ref StateType))
  69. or used to get the full file path of the loaded preset (if available).
  70. \code{.cpp}
  71. //------------------------------------------------------------------------
  72. #include "pluginterfaces/base/ustring.h"
  73. #include "pluginterfaces/vst/vstpresetkeys.h"
  74. ...
  75. tresult PLUGIN_API MyPlugin::setState (IBStream* state)
  76. {
  77. FUnknownPtr<IStreamAttributes> stream (state);
  78. if (stream)
  79. {
  80. IAttributeList* list = stream->getAttributes ();
  81. if (list)
  82. {
  83. // get the current type (project/Default..) of this state
  84. String128 string;
  85. if (list->getString (PresetAttributes::kStateType, string, 128 * sizeof (TChar)) == kResultTrue)
  86. {
  87. UString128 tmp (string);
  88. char ascii[128];
  89. tmp.toAscii (ascii, 128);
  90. if (!strncmp (ascii, StateType::kProject, strlen (StateType::kProject)))
  91. {
  92. // we are in project loading context...
  93. }
  94. }
  95. // get the full file path of this state
  96. TChar fullPath[1024];
  97. if (list->getString (PresetAttributes::kFilePathStringType, fullPath, 1024 * sizeof (TChar)) == kResultTrue)
  98. {
  99. // here we have the full path ...
  100. }
  101. }
  102. }
  103. //...read the state here.....
  104. return kResultTrue;
  105. }
  106. \endcode
  107. */
  108. class IStreamAttributes : public FUnknown
  109. {
  110. public:
  111. //------------------------------------------------------------------------
  112. /** Gets filename (without file extension) of the stream. */
  113. virtual tresult PLUGIN_API getFileName (String128 name) = 0;
  114. /** Gets meta information list. */
  115. virtual IAttributeList* PLUGIN_API getAttributes () = 0;
  116. //------------------------------------------------------------------------
  117. static const FUID iid;
  118. };
  119. DECLARE_CLASS_IID (IStreamAttributes, 0xD6CE2FFC, 0xEFAF4B8C, 0x9E74F1BB, 0x12DA44B4)
  120. //------------------------------------------------------------------------
  121. } // namespace Vst
  122. } // namespace Steinberg
  123. //------------------------------------------------------------------------
  124. #include "pluginterfaces/base/falignpop.h"
  125. //------------------------------------------------------------------------