Cleanup
[carla.git] / source / includes / vst3sdk / pluginterfaces / vst / ivstattributes.h
blobfb63b30c73f9281cb3ea1f7dd854bc4500287d28
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 //-----------------------------------------------------------------------------
17 #pragma once
19 #include "pluginterfaces/base/funknown.h"
20 #include "pluginterfaces/vst/vsttypes.h"
22 //------------------------------------------------------------------------
23 #include "pluginterfaces/base/falignpush.h"
24 //------------------------------------------------------------------------
26 //------------------------------------------------------------------------
27 namespace Steinberg {
28 namespace Vst {
30 //------------------------------------------------------------------------
31 /** Attribute list used in IMessage and IStreamAttributes: Vst::IAttributeList
32 \ingroup vstIHost vst300
33 - [host imp]
34 - [released: 3.0.0]
35 - [mandatory]
37 An attribute list associates values with a key (id: some predefined keys can be found in \ref
38 presetAttributes).
40 class IAttributeList : public FUnknown
42 public:
43 //------------------------------------------------------------------------
44 typedef const char* AttrID;
46 /** Sets integer value. */
47 virtual tresult PLUGIN_API setInt (AttrID id, int64 value) = 0;
49 /** Gets integer value. */
50 virtual tresult PLUGIN_API getInt (AttrID id, int64& value) = 0;
52 /** Sets float value. */
53 virtual tresult PLUGIN_API setFloat (AttrID id, double value) = 0;
55 /** Gets float value. */
56 virtual tresult PLUGIN_API getFloat (AttrID id, double& value) = 0;
58 /** Sets string value (UTF16) (should be null-terminated!). */
59 virtual tresult PLUGIN_API setString (AttrID id, const TChar* string) = 0;
61 /** Gets string value (UTF16). Note that Size is in Byte, not the string Length!
62 Do not forget to multiply the length by sizeof (TChar)! */
63 virtual tresult PLUGIN_API getString (AttrID id, TChar* string, uint32 sizeInBytes) = 0;
65 /** Sets binary data. */
66 virtual tresult PLUGIN_API setBinary (AttrID id, const void* data, uint32 sizeInBytes) = 0;
68 /** Gets binary data. */
69 virtual tresult PLUGIN_API getBinary (AttrID id, const void*& data, uint32& sizeInBytes) = 0;
70 //------------------------------------------------------------------------
71 static const FUID iid;
74 DECLARE_CLASS_IID (IAttributeList, 0x1E5F0AEB, 0xCC7F4533, 0xA2544011, 0x38AD5EE4)
76 //------------------------------------------------------------------------
77 /** Meta attributes of a stream: Vst::IStreamAttributes
78 \ingroup vstIHost vst360
79 - [host imp]
80 - [extends IBStream]
81 - [released: 3.6.0]
82 - [optional]
84 Interface to access preset meta information from stream, used, for example, in setState in order to inform the plug-in about
85 the current context in which the preset loading occurs (Project context or Preset load (see \ref StateType))
86 or used to get the full file path of the loaded preset (if available).
88 \code{.cpp}
89 //------------------------------------------------------------------------
90 #include "pluginterfaces/base/ustring.h"
91 #include "pluginterfaces/vst/vstpresetkeys.h"
92 ...
94 tresult PLUGIN_API MyPlugin::setState (IBStream* state)
96 FUnknownPtr<IStreamAttributes> stream (state);
97 if (stream)
99 IAttributeList* list = stream->getAttributes ();
100 if (list)
102 // get the current type (project/Default..) of this state
103 String128 string;
104 if (list->getString (PresetAttributes::kStateType, string, 128 * sizeof (TChar)) == kResultTrue)
106 UString128 tmp (string);
107 char ascii[128];
108 tmp.toAscii (ascii, 128);
109 if (!strncmp (ascii, StateType::kProject, strlen (StateType::kProject)))
111 // we are in project loading context...
115 // get the full file path of this state
116 TChar fullPath[1024];
117 if (list->getString (PresetAttributes::kFilePathStringType, fullPath, 1024 * sizeof (TChar)) == kResultTrue)
119 // here we have the full path ...
124 //...read the state here.....
125 return kResultTrue;
127 \endcode
129 class IStreamAttributes : public FUnknown
131 public:
132 //------------------------------------------------------------------------
133 /** Gets filename (without file extension) of the stream. */
134 virtual tresult PLUGIN_API getFileName (String128 name) = 0;
136 /** Gets meta information list. */
137 virtual IAttributeList* PLUGIN_API getAttributes () = 0;
138 //------------------------------------------------------------------------
139 static const FUID iid;
142 DECLARE_CLASS_IID (IStreamAttributes, 0xD6CE2FFC, 0xEFAF4B8C, 0x9E74F1BB, 0x12DA44B4)
144 //------------------------------------------------------------------------
145 } // namespace Vst
146 } // namespace Steinberg
148 //------------------------------------------------------------------------
149 #include "pluginterfaces/base/falignpop.h"
150 //------------------------------------------------------------------------