Skip to content

Commit 8191ed9

Browse files
committed
version 1.0.0
0 parents  commit 8191ed9

15 files changed

Lines changed: 1259 additions & 0 deletions

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "gcem"]
2+
path = gcem
3+
url = https://github.com/kthohr/gcem.git

CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
cmake_minimum_required(VERSION 3.14.0)
2+
3+
project(vst3utils VERSION 1.0.0)
4+
5+
add_library(vst3utils INTERFACE
6+
"include/vst3utils/enum_array.h"
7+
"include/vst3utils/event_iterator.h"
8+
"include/vst3utils/norm_plain_conversion.h"
9+
"include/vst3utils/parameter_description.h"
10+
"include/vst3utils/parameter_updater.h"
11+
"include/vst3utils/parameter.h"
12+
"include/vst3utils/smooth_value.h"
13+
"include/vst3utils/string_conversion.h"
14+
"ReadMe.md"
15+
)
16+
17+
target_include_directories(vst3utils INTERFACE "include")
18+
19+
target_compile_features(vst3utils
20+
INTERFACE
21+
cxx_std_17
22+
)
23+

License.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5+
6+
Everyone is permitted to copy and distribute verbatim or modified
7+
copies of this license document, and changing it is allowed as long
8+
as the name is changed.
9+
10+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12+
13+
0. You just DO WHAT THE FUCK YOU WANT TO.

ReadMe.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# vst3utils
2+
3+
a c++ header only library with little helper classes for writing vst3 plug-ins.
4+
5+
## Requirements
6+
7+
- c++17 compatible compiler
8+
- vst3 sdk
9+
10+
## Usage
11+
12+
Eiher add a header include directory pointing to the 'include' repository path or
13+
if you use cmake then just add this directoy in cmake with `add_subdirectory` and add a
14+
target dependency to your own target:
15+
16+
```cmake
17+
add_subdirectory("path/to/vst3utils" ${PROJECT_BINARY_DIR}/vst3utils)
18+
19+
add_target_dependency(myTarget
20+
PRIVATE
21+
vst3utils
22+
)
23+
```
24+
25+
## History
26+
27+
- **Version 1.0.0** [07/16/2023]
28+
- initial release
29+
30+
## Headers
31+
32+
### `#include "vst3utils/enum_array.h`
33+
34+
- `vst3utils::enum_array`
35+
- a std::array using an enum for accessing its elements
36+
37+
### `#include "vst3utils/event_iterator.h"`
38+
39+
- `vst3utils::event_iterator`
40+
- a c++ compatible forward iterator for `Steinberg::Vst::Event`
41+
42+
### `#include "vst3utils/norm_plain_conversion.h`
43+
44+
contains functions to convert from normalized to plain and back
45+
46+
- `vst3utils::normalized_to_plain`
47+
- `vst3utils::normalized_to_steps`
48+
- `vst3utils::normalized_to_exp`
49+
- `vst3utils::plain_to_normalized`
50+
- `vst3utils::steps_to_normalized`
51+
- `vst3utils::exp_to_normalized`
52+
53+
### `#include "vst3utils/parameter_description.h`
54+
55+
contains structs and functions to declare parameters at compile time
56+
57+
example:
58+
```c++
59+
static constexpr std::array<description, 4> param_desc = {{
60+
{range_description (u"volume", -12, linear_functions<-60, 0> (), 1, u"dB")},
61+
{range_description (u"cutoff", 2000, exponent_functions<80, 22050> (), 0, u"Hz")},
62+
{range_description (u"resonance", 50, linear_functions<0, 100> (), 0, u"%")},
63+
{list_description (u"filter type", 0, strings_filter_types)},
64+
}};
65+
```
66+
67+
### `#include "vst3utils/parameter_updater.h`
68+
69+
- `vst3utils::throttled_parameter_updater`
70+
- a throttling realtime parameter updater
71+
72+
### `#include "vst3utils/parameter.h`
73+
74+
- `vst3utils::parameter`
75+
- extension to the parameter class of the vst3 sdk which uses a parameter description
76+
77+
### `#include "vst3utils/smooth_value.h`
78+
79+
- `vst3utils::smooth_value`
80+
- a value object that smoothly changes from one value to another
81+
82+
### `#include "vst3utils/string_conversion.h`
83+
84+
- `vst3utils::copy_utf16_to_ascii`
85+
- `vst3utils::create_utf16_from_ascii`
86+
- `vst3utils::copy_ascii_to_utf16`
87+
88+
## License
89+
90+
```
91+
//------------------------------------------------------------------------
92+
/* This source code is free software. It comes without any warranty, to
93+
* the extent permitted by applicable law. You can redistribute it
94+
* and/or modify it under the terms of the Do What The Fuck You Want
95+
* To Public License, Version 2, as published by Sam Hocevar. See
96+
* http://sam.zoy.org/wtfpl/COPYING for more details. */
97+
//------------------------------------------------------------------------
98+
```

gcem

Submodule gcem added at ff96a61

include/vst3utils/.clang-format

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#Language: Cpp
2+
AccessModifierOffset: -4
3+
AlignAfterOpenBracket: Align
4+
AlignConsecutiveAssignments: false
5+
AlignConsecutiveDeclarations: false
6+
AlignEscapedNewlines: Right
7+
AlignOperands: true
8+
AlignTrailingComments: true
9+
AllowAllParametersOfDeclarationOnNextLine: true
10+
AllowShortBlocksOnASingleLine: false
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: true
13+
AllowShortIfStatementsOnASingleLine: false
14+
AllowShortLambdasOnASingleLine: Inline
15+
AllowShortLoopsOnASingleLine: false
16+
AlwaysBreakAfterReturnType: None
17+
AlwaysBreakBeforeMultilineStrings: false
18+
AlwaysBreakTemplateDeclarations: true
19+
BinPackArguments: true
20+
BinPackParameters: true
21+
BreakBeforeBraces: Custom
22+
BraceWrapping:
23+
AfterCaseLabel: true
24+
AfterClass: true
25+
AfterControlStatement: true
26+
AfterEnum: true
27+
AfterFunction: true
28+
AfterNamespace: false
29+
AfterObjCDeclaration: true
30+
AfterStruct: true
31+
AfterUnion: true
32+
AfterExternBlock: true
33+
BeforeCatch: true
34+
BeforeElse: true
35+
# BeforeLambdaBody: false
36+
IndentBraces: false
37+
SplitEmptyFunction: true
38+
SplitEmptyRecord: true
39+
SplitEmptyNamespace: true
40+
BreakBeforeBinaryOperators: None
41+
BreakBeforeInheritanceComma: true
42+
BreakBeforeTernaryOperators: true
43+
BreakConstructorInitializers: BeforeComma
44+
BreakAfterJavaFieldAnnotations: false
45+
BreakInheritanceList: AfterComma
46+
BreakStringLiterals: true
47+
ColumnLimit: 100
48+
# CommentPragmas: '^ IWYU pragma:'
49+
CompactNamespaces: false
50+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
51+
ConstructorInitializerIndentWidth: 0
52+
ContinuationIndentWidth: 4
53+
Cpp11BracedListStyle: true
54+
DerivePointerAlignment: false
55+
DisableFormat: false
56+
ExperimentalAutoDetectBinPacking: false
57+
FixNamespaceComments: false
58+
# ForEachMacros:
59+
# - foreach
60+
# - Q_FOREACH
61+
# - BOOST_FOREACH
62+
IncludeBlocks: Preserve
63+
# IncludeCategories:
64+
# - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
65+
# Priority: 2
66+
# - Regex: '^(<|"(gtest|gmock|isl|json)/)'
67+
# Priority: 3
68+
# - Regex: '.*'
69+
# Priority: 1
70+
# IncludeIsMainRegex: '(Test)?$'
71+
IndentCaseLabels: true
72+
IndentPPDirectives: None
73+
IndentWidth: 4
74+
IndentWrappedFunctionNames: true
75+
JavaScriptQuotes: Leave
76+
JavaScriptWrapImports: true
77+
KeepEmptyLinesAtTheStartOfBlocks: true
78+
MacroBlockBegin: ''
79+
MacroBlockEnd: ''
80+
MaxEmptyLinesToKeep: 1
81+
NamespaceIndentation: None
82+
ObjCBlockIndentWidth: 4
83+
ObjCSpaceAfterProperty: false
84+
ObjCSpaceBeforeProtocolList: false
85+
PenaltyBreakAssignment: 2
86+
PenaltyBreakBeforeFirstCallParameter: 19
87+
PenaltyBreakComment: 300
88+
PenaltyBreakFirstLessLess: 120
89+
PenaltyBreakString: 1000
90+
PenaltyExcessCharacter: 1000000
91+
PenaltyReturnTypeOnItsOwnLine: 80
92+
PointerAlignment: Left
93+
ReflowComments: true
94+
SortIncludes: false
95+
SortUsingDeclarations: false
96+
SpaceAfterCStyleCast: false
97+
SpaceAfterTemplateKeyword: false
98+
SpaceBeforeAssignmentOperators: true
99+
SpaceBeforeCpp11BracedList: true
100+
SpaceBeforeInheritanceColon: true
101+
SpaceBeforeParens: Always
102+
SpaceBeforeRangeBasedForLoopColon: true
103+
SpaceInEmptyParentheses: false
104+
SpacesBeforeTrailingComments: 1
105+
SpacesInAngles: false
106+
SpacesInContainerLiterals: false
107+
SpacesInCStyleCastParentheses: false
108+
SpacesInParentheses: false
109+
SpacesInSquareBrackets: false
110+
Standard: Cpp11
111+
TabWidth: 4
112+
UseTab: Always

include/vst3utils/enum_array.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//------------------------------------------------------------------------
2+
/* This source code is free software. It comes without any warranty, to
3+
* the extent permitted by applicable law. You can redistribute it
4+
* and/or modify it under the terms of the Do What The Fuck You Want
5+
* To Public License, Version 2, as published by Sam Hocevar. See
6+
* http://sam.zoy.org/wtfpl/COPYING for more details. */
7+
//------------------------------------------------------------------------
8+
9+
#pragma once
10+
11+
#include <array>
12+
13+
//------------------------------------------------------------------------
14+
namespace vst3utils {
15+
16+
//------------------------------------------------------------------------
17+
/** a std::array using an enum class for accessing the elements
18+
19+
Example:
20+
21+
enum class color_component {
22+
red,
23+
green,
24+
blue,
25+
alpha,
26+
27+
count
28+
};
29+
30+
using rgba_color = enum_array<uint8_t, color_component>;
31+
32+
rgba_color color;
33+
rgba_color[color_component::red] = 255;
34+
35+
*/
36+
template<typename T, typename enum_t, size_t array_size = static_cast<size_t> (enum_t::enum_end)>
37+
struct enum_array : std::array<T, array_size>
38+
{
39+
using base_t = std::array<T, array_size>;
40+
41+
static constexpr size_t count () noexcept { return array_size; }
42+
43+
T& operator[] (enum_t index) { return base_t::operator[] (static_cast<size_t> (index)); }
44+
const T& operator[] (enum_t index) const noexcept
45+
{
46+
return base_t::operator[] (static_cast<size_t> (index));
47+
}
48+
const T& operator[] (size_t index) const noexcept { return base_t::operator[] (index); }
49+
T& operator[] (size_t index) noexcept { return base_t::operator[] (index); }
50+
51+
void set (size_t index, const T& value) noexcept { base_t::operator[] (index) = value; }
52+
};
53+
54+
//------------------------------------------------------------------------
55+
} // vst3utils

0 commit comments

Comments
 (0)