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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //------------------------------------------------------------------------
  2. // Project : VST SDK
  3. // Version : 3.6.7
  4. //
  5. // Category : Interfaces
  6. // Filename : pluginterfaces/vst/ivstattributes.h
  7. // Created by : Steinberg, 05/2006
  8. // Description : VST Attribute Interfaces
  9. //
  10. //-----------------------------------------------------------------------------
  11. // This file is part of a Steinberg SDK. It is subject to the license terms
  12. // in the LICENSE file found in the top-level directory of this distribution
  13. // and at www.steinberg.net/sdklicenses.
  14. // No part of the SDK, including this file, may be copied, modified, propagated,
  15. // or distributed except according to the terms contained in the LICENSE file.
  16. //-----------------------------------------------------------------------------
  17. #pragma once
  18. #include "pluginterfaces/base/funknown.h"
  19. #include "pluginterfaces/vst/vsttypes.h"
  20. //------------------------------------------------------------------------
  21. #include "pluginterfaces/base/falignpush.h"
  22. //------------------------------------------------------------------------
  23. //------------------------------------------------------------------------
  24. namespace Steinberg {
  25. namespace Vst {
  26. //------------------------------------------------------------------------
  27. /** Attribute list used in IMessage and IStreamAttributes.
  28. \ingroup vstIHost vst300
  29. - [host imp]
  30. - [released: 3.0.0]
  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. \code
  65. ...
  66. #include "pluginterfaces/base/ustring.h"
  67. #include "pluginterfaces/vst/vstpresetkeys.h"
  68. ...
  69. tresult PLUGIN_API MyPlugin::setState (IBStream* state)
  70. {
  71. FUnknownPtr<IStreamAttributes> stream (state);
  72. if (stream)
  73. {
  74. IAttributeList* list = stream->getAttributes ();
  75. if (list)
  76. {
  77. // get the current type (project/Default..) of this state
  78. String128 string;
  79. if (list->getString (PresetAttributes::kStateType, string, 128 * sizeof (TChar)) == kResultTrue)
  80. {
  81. UString128 tmp (string);
  82. char ascii[128];
  83. tmp.toAscii (ascii, 128);
  84. if (!strncmp (ascii, StateType::kProject, strlen (StateType::kProject)))
  85. {
  86. // we are in project loading context...
  87. }
  88. }
  89. // get the full file path of this state
  90. TChar fullPath[1024];
  91. if (list->getString (PresetAttributes::kFilePathStringType, fullPath, 1024 * sizeof (TChar)) == kResultTrue)
  92. {
  93. // here we have the full path ...
  94. }
  95. }
  96. }
  97. //...read the state here.....
  98. return kResultTrue;
  99. }
  100. \endcode
  101. Interface to access preset meta information from stream, used for example in setState in order to inform the plug-in about
  102. the current context in which this preset loading occurs (Project context or Preset load (see \ref StateType))
  103. or used to get the full file path of the loaded preset (if available). */
  104. //------------------------------------------------------------------------
  105. class IStreamAttributes: public FUnknown
  106. {
  107. public:
  108. //------------------------------------------------------------------------
  109. /** Gets filename (without file extension) of the stream. */
  110. virtual tresult PLUGIN_API getFileName (String128 name) = 0;
  111. /** Gets meta information list. */
  112. virtual IAttributeList* PLUGIN_API getAttributes () = 0;
  113. //------------------------------------------------------------------------
  114. static const FUID iid;
  115. };
  116. DECLARE_CLASS_IID (IStreamAttributes, 0xD6CE2FFC, 0xEFAF4B8C, 0x9E74F1BB, 0x12DA44B4)
  117. //------------------------------------------------------------------------
  118. } // namespace Vst
  119. } // namespace Steinberg
  120. //------------------------------------------------------------------------
  121. #include "pluginterfaces/base/falignpop.h"
  122. //------------------------------------------------------------------------