├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── README.md
├── deps
├── VST2_SDK
│ ├── aeffect.h
│ ├── aeffectx.h
│ ├── aeffeditor.cpp
│ ├── aeffeditor.h
│ ├── aeffeditor.hpp
│ ├── audioeffect.cpp
│ ├── audioeffect.hpp
│ ├── audioeffectx.cpp
│ ├── audioeffectx.h
│ ├── audioeffectx.hpp
│ ├── vst.h
│ ├── vstevent.h
│ ├── vstkey.h
│ ├── vstmidi.h
│ ├── vstparameter.h
│ ├── vstpin.h
│ ├── vstspeaker.h
│ ├── vsttime.h
│ ├── vsttypes.h
│ └── vstversion.h
├── imgui-master
│ ├── imconfig.h
│ ├── imgui.cpp
│ ├── imgui.h
│ ├── imgui_demo.cpp
│ ├── imgui_draw.cpp
│ ├── imgui_internal.h
│ ├── imgui_tables.cpp
│ ├── imgui_widgets.cpp
│ ├── imstb_rectpack.h
│ ├── imstb_textedit.h
│ └── imstb_truetype.h
├── png
│ ├── LICENSE
│ ├── png.c
│ ├── png.h
│ ├── pngasmrd.h
│ ├── pngconf.h
│ ├── pngerror.c
│ ├── pnggccrd.c
│ ├── pngget.c
│ ├── pngmem.c
│ ├── pngpread.c
│ ├── pngread.c
│ ├── pngrio.c
│ ├── pngrtran.c
│ ├── pngrutil.c
│ ├── pngset.c
│ ├── pngtest.c
│ ├── pngtrans.c
│ ├── pngvcrd.c
│ ├── pngwio.c
│ ├── pngwrite.c
│ ├── pngwtran.c
│ └── pngwutil.c
└── zlib
│ ├── adler32.c
│ ├── compress.c
│ ├── crc32.c
│ ├── crc32.h
│ ├── deflate.c
│ ├── deflate.h
│ ├── gzclose.c
│ ├── gzguts.h
│ ├── gzlib.c
│ ├── gzread.c
│ ├── gzwrite.c
│ ├── infback.c
│ ├── inffast.c
│ ├── inffast.h
│ ├── inffixed.h
│ ├── inflate.c
│ ├── inflate.h
│ ├── inftrees.c
│ ├── inftrees.h
│ ├── trees.c
│ ├── trees.h
│ ├── uncompr.c
│ ├── zconf.h
│ ├── zlib.h
│ ├── zutil.c
│ └── zutil.h
├── dynation.png
└── src
├── Allocator.h
├── ImGui_Tools1.cpp
├── ImGui_Tools1.h
├── PopOutList.h
├── VST2_Base.cpp
├── VST2_Base.h
├── VST2_Base_UI.cpp
├── VST2_Base_UI_UVMetter_Imp.h
├── VST2_Base_Window_DX11.cpp
├── VST2_D3D11_Imp.h
├── VST2_Header.h
├── VST2_Types.h
├── VST2_WindowImGui_Imp.h
├── dynation
├── BaseEffect.h
├── BitCrusher.h
├── CompAlg.h
├── CompressorA.h
├── DiestressorPresetFormat.h
├── EnvelopeDetector.h
├── EnvelopeDetectorAlg.h
├── FoldBack.h
├── FuturaDemiC-Italic.cpp
├── HardClipping.h
├── HardDistortion.h
├── Header.h
├── ImGuiComboMod.h
├── Poppins-Medium.cpp
├── PresetLoader.cpp
├── Resources.aps
├── Resources.rc
├── SatAlg.cpp
├── SatAlg.h
├── Sincrusher.h
├── SoftClipping.h
├── SoftDistortion.h
├── SuirlessProDistortion.vcxproj
├── SuirlessProDistortion.vcxproj.filters
├── SuirlessProDistortion.vcxproj.user
├── TempBuffers.h
├── TiltEQAlg.h
├── TiltEq.h
├── Validator.h
├── compressor.cpp
├── compressor.hpp
├── main.cpp
├── main_PresetList.cpp
├── main_Process.cpp
├── main_UI.cpp
├── musor.h
├── r8brain
│ ├── CDSPBlockConvolver.h
│ ├── CDSPFIRFilter.h
│ ├── CDSPFracInterpolator.h
│ ├── CDSPHBDownsampler.h
│ ├── CDSPHBUpsampler.h
│ ├── CDSPProcessor.h
│ ├── CDSPRealFFT.h
│ ├── CDSPResampler.h
│ ├── CDSPSincFilterGen.h
│ ├── fft4g.h
│ ├── pffft.cpp
│ ├── pffft.h
│ ├── r8bbase.cpp
│ ├── r8bbase.h
│ ├── r8bconf.h
│ └── r8butil.h
└── vstplug.def
├── glext.h
├── khrplatform.h
└── musor.h
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | cmake-build-debug
3 | cmake-build-release
4 | cmake-build-relwithdebinfo
5 | # Prerequisites
6 | *.d
7 |
8 | # Compiled Object files
9 | *.slo
10 | *.lo
11 | *.o
12 | *.obj
13 |
14 | # Precompiled Headers
15 | *.gch
16 | *.pch
17 |
18 | # Compiled Dynamic libraries
19 | *.so
20 | *.dylib
21 | *.dll
22 |
23 | # Fortran module files
24 | *.mod
25 | *.smod
26 |
27 | # Compiled Static libraries
28 | *.lai
29 | *.la
30 | *.a
31 | *.lib
32 |
33 | # Executables
34 | *.exe
35 | *.out
36 | *.app
37 | *.db
38 | *.opendb
39 | *.ipch
40 | *.pdb
41 |
42 | /bins
43 | /bin-out
44 | /out
45 | /temp
46 | /build
47 | /bin
48 | /vsthost
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #*********************************************************************
2 | # Copyright (C) Anton Kovalev, 2018-2022. All rights reserved.
3 | # Dynation plugin
4 | # MIT License
5 | #****************************************************************/
6 | cmake_minimum_required(VERSION 3.16)
7 | project(Dynation C CXX)
8 |
9 | file(GLOB DYNATION_BASE_SOURCE_CODE
10 | "${CMAKE_CURRENT_SOURCE_DIR}/deps/VST2_SDK/public.sdk/source/vst2.x/*.cpp"
11 | "${CMAKE_CURRENT_SOURCE_DIR}/deps/VST2_SDK/public.sdk/source/vst2.x/*.h"
12 | "${CMAKE_CURRENT_SOURCE_DIR}/deps/imgui-master/*.cpp"
13 | "${CMAKE_CURRENT_SOURCE_DIR}/deps/imgui-master/*.h"
14 | "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
15 | "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h"
16 | )
17 |
18 | file(GLOB DYNATION_PLUGIN_SOURCE_CODE
19 | "${CMAKE_CURRENT_SOURCE_DIR}/src/dynation/*.cpp"
20 | "${CMAKE_CURRENT_SOURCE_DIR}/src/dynation/*.h"
21 | )
22 |
23 | add_library(dyn_base STATIC ${DYNATION_BASE_SOURCE_CODE})
24 |
25 | target_include_directories(dyn_base PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/deps")
26 | target_include_directories(dyn_base PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")
27 | target_include_directories(dyn_base PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/deps/VST2_SDK/pluginterfaces/vst2.x")
28 | target_include_directories(dyn_base PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/deps/VST2_SDK/public.sdk/source/vst2.x")
29 | target_include_directories(dyn_base PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/deps/imgui-master")
30 |
31 | add_library(dynation MODULE ${DYNATION_PLUGIN_SOURCE_CODE})
32 | target_link_libraries(dynation PUBLIC dyn_base)
33 |
34 | set_target_properties(dynation
35 | PROPERTIES
36 | LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/"
37 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/"
38 | )
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) Anton Kovalev. All rights reserved.
2 |
3 | MIT License
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
Dynation
2 |
3 | 
4 |
5 |
6 |
Version 1.3
7 |
8 |
9 |
10 |
11 |
12 | For now it's open-source, yeah.
13 |
14 |
15 |
16 | ---
17 |
18 | ## *TODO*
19 |
20 | * Code refactoring. It's too old and shit, so refactoring is required.
21 | * UI Code reimpl to NanoVG/Better framework
22 | * New UI Impl (design for new UI coming soon.)
23 | * Linux and macOS port
24 |
25 | ---
26 |
27 | ## *Why?*
28 |
29 | Because I can. Really.
30 |
31 | ---
32 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/aeffect.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "vsttypes.h"
18 | #include "vstversion.h"
19 |
20 | #pragma pack(push, 8)
21 |
22 | enum AEffectOpCodes {
23 | audioEffectOpen, // Create/Open Effect
24 | audioEffectClose, // Destroy/Close Effect
25 | audioEffectSetProgram, // Set Program
26 | audioEffectGetProgram, // Get Program
27 | audioEffectSetProgramName, // Set Program Name
28 | audioEffectGetProgramName, // Get Program Name
29 | audioEffectGetParameterLabel, // Get Parameter Label
30 | audioEffectGetParameterDisplay, // Get Parameter Display
31 | audioEffectGetParameterName, // Get Parameter Name
32 | AEffectOpCode_09,
33 | audioEffectSetSampleRate, // Set Sample Rate
34 | audioEffectSetBlockSize, // Set Block Size
35 | audioEffectSuspendResume, // Suspend/Resume
36 | audioEffectEditorGetSize, // Get Editor Size
37 | audioEffectEditorOpen, // Create/Open Editor
38 | audioEffectEditorClose, // Destroy/Close Editor
39 | AEffectOpCode_10,
40 | AEffectOpCode_11,
41 | AEffectOpCode_12,
42 | audioEffectEditorDoNothing,
43 | AEffectOpCode_14,
44 | AEffectOpCode_15,
45 | AEffectOpCode_16, // Always FOURCC('N', 'v', 'E', 'F')? Might be different for some VST 1.x and 2.x plug-ins. Doesn't seem to be used.
46 | audioEffectGetChunk, // Get Chunk
47 | audioEffectSetChunk, // Set Chunk
48 |
49 | // All OpCodes above this maximum are version 2.x
50 | AEffectOpCodeMax
51 | };
52 |
53 | enum AEffectMasterOpCodes {
54 | AEffectMasterOpCode_00,
55 | audioMasterAutomate = AEffectMasterOpCode_00,
56 | AEffectMasterOpCode_01,
57 | audioMasterVersion = AEffectMasterOpCode_01,
58 | AEffectMasterOpCode_02,
59 | AEffectMasterOpCode_03,
60 | AEffectMasterOpCode_04,
61 |
62 | // All OpCodes above this maximum are version 2.x
63 | AEffectMasterOpCodeMax,
64 | };
65 |
66 | enum AEffectFlags { // Guessed name based on struct+field combination.
67 | AEffectFlagHasEditor = 1 << 0,
68 | AEffectFlagCanReplacing = 1 << 4,
69 | AEffectFlagProgramsAreChunks = 1 << 5, // Not sure what this means.
70 | AEffectFlagIsSynthesizer = 1 << 8,
71 | AEffectFlagIsSilentOnSilence = 1 << 9, // Does not generate tail samples?
72 | };
73 |
74 | struct AEffect {
75 | VstInt32 magic; // Must be FOURCC('V', 's', 't', 'P')
76 |
77 | VstIntPtr(VstFunctionAPI* control)(AEffect* self, VstInt32 opcode, VstInt32 param1, VstIntPtr param2, void* ptr, float value);
78 |
79 | #if (!defined VST_VERSION_SUPPORT) || (VST_VERSION_SUPPORT >= kVstVersion_2400)
80 | // No 2.4 host ever calls this, processReplacing and processDoubleReplacing seem to be required.
81 | [[deprecated]]
82 | #endif
83 | void(VstFunctionAPI* process)(AEffect* self, float** inputs, float** outputs, VstInt32 sampleFrames);
84 |
85 | void(VstFunctionAPI* setParameter)(AEffect* self, VstInt32 index, float value);
86 |
87 | float(VstFunctionAPI* getParameter)(AEffect* self, VstInt32 index);
88 |
89 | VstInt32 numPrograms;
90 | VstInt32 numParams;
91 | VstInt32 numInputs; // Guessing names here based on the other ones. We already know what their type is anyway.
92 | VstInt32 numOutputs;
93 | VstInt32 flags; // AEffectFlags, see vst.h for more.
94 |
95 | VstIntPtr __unk04;
96 | VstIntPtr __unk05;
97 |
98 | VstInt32 delay;
99 |
100 | VstInt32 __unk06;
101 | VstInt32 __unk07;
102 | float __unk08;
103 |
104 | void* effect_data; // I think this is effect private data.
105 | void* host_data; // And this is host private data.
106 |
107 | VstInt32 uniqueID; // A very collidable unique id. 32 bit is not a lot.
108 | VstInt32 version; // VstVersion
109 |
110 | /** Process float data in-place.
111 | *
112 | * Must be present for 2.4 or later hosts. Make sure you set the proper flag.
113 | *
114 | * \param inputs Input buffers. Can have pointers used in outputs.
115 | * \param outputs Output buffers. Can have pointers used in inputs.
116 | * \param sampleFrames Number of samples in all buffers.
117 | */
118 | void(VstFunctionAPI* processReplacing)(AEffect* self, float** inputs, float** outputs, VstInt32 sampleFrames);
119 |
120 | #if (!defined VST_VERSION_SUPPORT) || (VST_VERSION_SUPPORT >= kVstVersion_2400)
121 | // These only appear in version >= 2.4
122 |
123 | /** Process double data in-place.
124 | *
125 | * \param inputs Input buffers. Can have pointers used in outputs.
126 | * \param outputs Output buffers. Can have pointers used in inputs.
127 | * \param sampleFrames Number of samples in all buffers.
128 | */
129 | void(VstFunctionAPI* processDoubleReplacing)(AEffect* self, double** inputs, double** outputs, VstInt32 sampleFrames);
130 |
131 | char __unk12[56];
132 | #else
133 | char __unk12[60];
134 | #endif
135 | };
136 |
137 | // Master callback.
138 | typedef VstIntPtr(VstFunctionAPI* audioMasterCallback)(AEffect*, VstInt32 opcode, VstInt32, VstInt32, void* ptr, float);
139 |
140 | #pragma pack(pop)
141 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/aeffectx.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | // File name based on "AudioEffectX" and "AudioEffect". Since we have a struct called "AEffect", logically there's a struct AEffectX right? Don't see any references to it though...
17 |
18 | #pragma once
19 | #include "aeffect.h"
20 | #include "vstpin.h"
21 | #include "vsttime.h"
22 | #include "vstversion.h"
23 |
24 | enum AEffectXFlags {
25 | AEffectFlagCanDoubleReplacing = 1 << 12, // Only available in 2.4 or later. Name based on AudioEffect::canDoubleReplacing
26 | };
27 |
28 | enum AEffectXOpCodes {
29 | __AEffectXOpCode_Lowest = 0x18, // Starts at highest OpCode from AEffect.
30 | AEffectXOpCode_19,
31 | audioEffectProcessEvents, // Process Events
32 | audioEffectIsParameterAutomatable, // Is Parameter Automatable?
33 | audioEffectConvertStringToParameter, // Convert String to Parameter index
34 | audioEffectGetProgramNameIndexed,
35 | AEffectXOpCode_1E,
36 | AEffectXOpCode_1F,
37 | AEffectXOpCode_20,
38 | audioEffectGetInputProperties, // Get Input Properties
39 | audioEffectGetOutputProperties, // Get Output Properties
40 | audioEffectGetPlugCategory, // Get "Plug" Category
41 | AEffectXOpCode_24,
42 | AEffectXOpCode_25,
43 | AEffectXOpCode_26,
44 | AEffectXOpCode_27,
45 | AEffectXOpCode_28,
46 | AEffectXOpCode_29,
47 | audioEffectSetSpeakerArrangement, // Set Speaker Arrangment
48 | AEffectXOpCode_2B,
49 | audioEffectBypass, // Bypass
50 | audioEffectGetEffectName, // Get Effect Name
51 | AEffectXOpCode_2E,
52 | audioEffectGetVendorString, // Get Vendor Name
53 | audioEffectGetProductString, // Get Product Name
54 | audioEffectGetVendorVersion, // Get Vendor Version
55 | audioEffectVendorSpecific, // Seems to be used rarely to implement host-specific custom behavior.
56 | audioEffectCanDo, // Test for Feature support
57 | audioEffectGetTailSize, // Get Tail Samples
58 | AEffectXOpCode_35,
59 | AEffectXOpCode_36,
60 | AEffectXOpCode_37,
61 | audioEffectGetParameterProperties,
62 | AEffectXOpCode_39,
63 | audioEffectGetVSTVersion, // Get VST Version
64 |
65 | #if (!defined VST_VERSION_SUPPORT) || (VST_VERSION_SUPPORT >= kVstVersion_2100)
66 | // Only seen in version 2.1 or later
67 | audioEffectEditorKeyDown, // Key Down in Editor.
68 | audioEffectEditorKeyUp, // Key Up in Editor
69 | audioEffectEditorKnobMode, // Editor Knob Mode, see CKnobMode in vstgui.
70 | audioEffectMidiGetProgramName,
71 | audioEffectMidiGetCurrentProgram,
72 | audioEffectMidiGetProgramCategory,
73 | audioEffectMidiHasProgramsChanged,
74 | audioEffectMidiGetKeyName,
75 | AEffectXOpCode_43,
76 | AEffectXOpCode_44,
77 | #endif
78 |
79 | #if (!defined VST_VERSION_SUPPORT) || (VST_VERSION_SUPPORT >= kVstVersion_2300)
80 | // Only seen in version 2.3 or later
81 | audioEffectGetSpeakerArrangement, // Get Speaker Arrangement
82 | AEffectXOpCode_46,
83 | audioEffectStartProcessing, // Start processing audio.
84 | audioEffectStopProcessing, // Stop processing audio.
85 | AEffectXOpCode_49,
86 | AEffectXOpCode_4A,
87 | AEffectXOpCode_4B,
88 | AEffectXOpCode_4C,
89 | #endif
90 |
91 | #if (!defined VST_VERSION_SUPPORT) || (VST_VERSION_SUPPORT >= kVstVersion_2400)
92 | // Only seen in version 2.4 or later.
93 | audioEffectSetProcessingPrecision, // Set Processing Precision, see VstProcessPrecision
94 | audioEffectMidiGetNumInputChannels,
95 | audioEffectMidiGetNumOutputChannels,
96 | #endif
97 |
98 | // Never seen any OpCodes at or above this maximum.
99 | AEffectXOpCodeMax
100 | };
101 |
102 | enum AEffectXMasterOpCodes {
103 | __AEffectXMasterOpCodeLowest = 0x04,
104 | AEffectXMasterOpCode_05, // Appears to be unused entirely.
105 | AEffectXMasterOpCode_06,
106 | audioMasterGetTimeInfo, // Get Time Info. Name guessed based on AudioEffectX::getTimeInfo
107 | audioMasterProcessEvents, // Name guessed based on AudioEffectX::sendVstEventsToHost. Name is likely a mirror of audioEffectsProcessEvents.
108 | AEffectXMasterOpCode_09,
109 | AEffectXMasterOpCode_0A,
110 | AEffectXMasterOpCode_0B,
111 | AEffectXMasterOpCode_0C,
112 | audioMasterIOChanged, // Notify Host that our Inputs/Outputs/etc have changed. Name guessed based on AudioEffectX::ioChanged
113 | AEffectXMasterOpCode_0E,
114 | audioMasterSizeWindow, // Request a resize of the editor window. Name guessed based on AudioEffectX::sizeWindow
115 | AEffectXMasterOpCode_10,
116 | AEffectXMasterOpCode_11,
117 | AEffectXMasterOpCode_12,
118 | AEffectXMasterOpCode_13,
119 | AEffectXMasterOpCode_14,
120 | AEffectXMasterOpCode_15,
121 | AEffectXMasterOpCode_16,
122 | audioMasterGetCurrentProcessLevel, // Name guessed based on AudioEffectX::getCurrentProcessLevel
123 | AEffectXMasterOpCode_18,
124 | AEffectXMasterOpCode_19,
125 | AEffectXMasterOpCode_1A,
126 | AEffectXMasterOpCode_1B,
127 | AEffectXMasterOpCode_1C,
128 | AEffectXMasterOpCode_1D,
129 | AEffectXMasterOpCode_1E,
130 | AEffectXMasterOpCode_1F,
131 | audioMasterGetVendorString, // Get Vendor Name
132 | audioMasterGetProductString, // Get Product Name
133 | audioMasterGetVendorVersion, // Get Vendor Version
134 | audioMasterVendorSpecific, // Counterpart to AEffectXOpCode_32
135 | audioMasterCanDo,
136 | AEffectXMasterOpCode_25,
137 | AEffectXMasterOpCode_26,
138 | AEffectXMasterOpCode_27,
139 | AEffectXMasterOpCode_28,
140 | AEffectXMasterOpCode_29, // When called, returns a pointer to a string.
141 | audioMasterUpdateDisplay, // Request an update for the editor display? Name guessed via AudioEffectX::updateDisplay
142 | audioMasterBeginEdit, // Parameter Gained Focus. Likely used to help the host ignore unwanted inputs. Name guessed via AudioEffectX::beginEdit
143 | audioMasterEndEdit, // Parameter Lost Focus. Likely used to help the host ignore unwanted inputs. Name guessed via AudioEffectX::endEdit
144 | AEffectXMasterOpCode_2D,
145 | AEffectXMasterOpCode_2E,
146 | AEffectXMasterOpCode_2F,
147 | AEffectXMasterOpCode_30,
148 | AEffectXMasterOpCode_31,
149 |
150 | AEffectXMasterOpCodeMax
151 | };
152 |
153 | enum VstPlugCategory { // Based on OpCode being here only.
154 | // Taken from VstPlugCategory Vst2Wrapper::getPlugCategory (), then shuffled around until it made sense in most VST hosts.
155 | kPlugCategUnknown = 0,
156 | kPlugCategEffect,
157 | kPlugCategSynth,
158 | kPlugCategAnalysis,
159 | kPlugCategMastering,
160 | kPlugCategSpacializer,
161 | kPlugCategRoomFx,
162 | kPlugCateg__unk00, // Unknown use.
163 | kPlugCategRestoration,
164 | kPlugCateg__unk01, // Unknown use.
165 | kPlugCategContainer, // AEffectX contains multiple plugins. Not clear how this works.
166 | kPlugCategGenerator,
167 | };
168 |
169 | enum VstProcessLevels {
170 | // No idea what the rest are.
171 | kVstProcessLevelRealtime = 2,
172 | kVstProcessLevelOffline = 4,
173 | };
174 |
175 | enum VstProcessPrecision {
176 | kVstProcessPrecision32, // Single
177 | kVstProcessPrecision64, // Double
178 | };
179 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/aeffeditor.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #include "aeffeditor.hpp"
17 |
18 | AEffEditor::AEffEditor(AudioEffect* effect) : effect(effect), _handle() {}
19 |
20 | AEffEditor::~AEffEditor() {}
21 |
22 | bool AEffEditor::open(void* ptr)
23 | {
24 | if (!_handle) {
25 | _handle = ptr;
26 | return ptr;
27 | }
28 | return false;
29 | }
30 |
31 | void AEffEditor::close()
32 | {
33 | _handle = nullptr;
34 | return;
35 | }
36 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/aeffeditor.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "aeffeditor.hpp"
18 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/aeffeditor.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "vstkey.h"
18 | #include "vsttypes.h"
19 |
20 | #pragma pack(push, 8)
21 |
22 | class AudioEffect;
23 |
24 | class AEffEditor {
25 | public:
26 | AEffEditor(AudioEffect* effect);
27 | virtual ~AEffEditor();
28 |
29 | virtual bool getRect(ERect** rect)
30 | {
31 | //*rect = nullptr;
32 | return false;
33 | }
34 | virtual bool open(void* ptr);
35 | virtual void close();
36 | virtual void do_nothing()
37 | {
38 | return;
39 | }
40 |
41 | #if (!defined VST_VERSION_SUPPORT) || (VST_VERSION_SUPPORT >= kVstVersion_2100)
42 | virtual bool setKnobMode(VstInt32 val)
43 | {
44 | return false;
45 | }
46 | virtual bool onKeyDown(VstKeyCode& keyCode)
47 | {
48 | return false;
49 | }
50 | virtual bool onKeyUp(VstKeyCode& keyCode)
51 | {
52 | return false;
53 | }
54 | virtual bool onWheel(float distance)
55 | {
56 | return false;
57 | }
58 | #endif
59 |
60 | protected:
61 | AudioEffect* effect; // Restricted to this name by vst2wrapper.
62 | void* _handle;
63 | };
64 |
65 | #pragma pack(pop)
66 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/audioeffect.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #include "audioeffect.hpp"
17 | #include
18 | #include "aeffect.h"
19 |
20 | #define FOURCC(a, b, c, d) ((a << 24) | (b << 16) | (c << 8) | d)
21 |
22 | AudioEffect::AudioEffect(audioMasterCallback p_audioMaster, VstInt32 __unk00, VstInt32 __unk01)
23 | {
24 | memset(&cEffect, 0, sizeof(AEffect));
25 | cEffect.magic = FOURCC('V', 's', 't', 'P');
26 | cEffect.effect_data = this;
27 | #if (!defined VST_VERSION_SUPPORT)
28 | cEffect.version = kVstVersion_2400;
29 | #else
30 | cEffect.version = VST_VERSION_SUPPORT;
31 | #endif
32 | cEffect.control = [](AEffect* self, VstInt32 opcode, VstInt32 param1, VstIntPtr param2, void* ptr, float value) { return reinterpret_cast(self->effect_data)->control(opcode, param1, param2, ptr, value); };
33 | cEffect.process = [](AEffect* self, float** inputs, float** outputs, VstInt32 sampleFrames) { return reinterpret_cast(self->effect_data)->process(inputs, outputs, sampleFrames); };
34 | cEffect.setParameter = [](AEffect* self, VstInt32 index, float value) { reinterpret_cast(self->effect_data)->setParameter(index, value); };
35 | cEffect.getParameter = [](AEffect* self, VstInt32 index) { return reinterpret_cast(self->effect_data)->getParameter(index); };
36 | cEffect.processReplacing = [](AEffect* self, float** inputs, float** outputs, VstInt32 sampleFrames) { return reinterpret_cast(self->effect_data)->processReplacing(inputs, outputs, sampleFrames); };
37 |
38 | audioMaster = p_audioMaster;
39 | numPrograms = cEffect.numPrograms;
40 | curProgram = 0;
41 | editor = nullptr;
42 | }
43 |
44 | AudioEffect::~AudioEffect() {}
45 |
46 | VstIntPtr AudioEffect::control(VstInt32 opcode, VstInt32 param1, VstIntPtr param2, void* ptr, float value)
47 | {
48 | switch (opcode) {
49 | case audioEffectOpen:
50 | open();
51 | break;
52 | case audioEffectClose:
53 | close();
54 | break;
55 | case audioEffectSetProgram:
56 | setProgram(param1);
57 | break;
58 | case audioEffectGetProgram:
59 | return getProgram();
60 | case audioEffectSetProgramName:
61 | setProgramName((char*)ptr);
62 | break;
63 | case audioEffectGetProgramName:
64 | getProgramName((char*)ptr);
65 | break;
66 | case audioEffectGetParameterLabel:
67 | getParameterLabel(param1, (char*)ptr);
68 | break;
69 | case audioEffectGetParameterDisplay:
70 | getParameterDisplay(param1, (char*)ptr);
71 | break;
72 | case audioEffectGetParameterName:
73 | getParameterName(param1, (char*)ptr);
74 | break;
75 | case audioEffectSetSampleRate:
76 | setSampleRate(value);
77 | break;
78 | case audioEffectSetBlockSize:
79 | setBlockSize(static_cast(value));
80 | break;
81 | case audioEffectSuspendResume:
82 | if (!param2) {
83 | suspend();
84 | } else {
85 | resume();
86 | }
87 | break;
88 | case audioEffectEditorGetSize:
89 | if (editor) {
90 | return editor->getRect((ERect**)ptr) ? 1 : 0;
91 | }
92 | break;
93 | case audioEffectEditorOpen:
94 | if (editor) {
95 | return editor->open(ptr);
96 | }
97 | break;
98 | case audioEffectEditorClose:
99 | if (editor) {
100 | editor->close();
101 | }
102 | break;
103 | case audioEffectEditorDoNothing: // Occasionally appears. Does nothing? Only called when editor is open.
104 | if (editor) {
105 | editor->do_nothing();
106 | }
107 | break;
108 | case audioEffectGetChunk:
109 | return getChunk((void**)ptr, !!param1);
110 | case audioEffectSetChunk:
111 | return setChunk(ptr, static_cast(value), !!param1);
112 | default:
113 | break;
114 | }
115 | return 0;
116 | }
117 |
118 | AEffect* AudioEffect::getAeffect()
119 | {
120 | return &cEffect;
121 | }
122 |
123 | void AudioEffect::setEditor(AEffEditor* p_editor)
124 | {
125 | editor = p_editor;
126 | }
127 |
128 | void AudioEffect::setUniqueID(VstInt32 uniqueID)
129 | {
130 | cEffect.uniqueID = uniqueID;
131 | }
132 |
133 | void AudioEffect::setNumInputs(VstInt32 numInputs)
134 | {
135 | cEffect.numInputs = numInputs;
136 | }
137 |
138 | void AudioEffect::setNumOutputs(VstInt32 numOutputs)
139 | {
140 | cEffect.numOutputs = numOutputs;
141 | }
142 |
143 | void AudioEffect::setInitialDelay(VstInt32 delay)
144 | {
145 | cEffect.delay = delay;
146 | }
147 |
148 | void AudioEffect::canProcessReplacing(bool value)
149 | {
150 | if (value)
151 | cEffect.flags |= AEffectFlagCanReplacing;
152 | else
153 | cEffect.flags &= ~AEffectFlagCanReplacing;
154 | }
155 |
156 | void AudioEffect::isSynth(bool value)
157 | {
158 | if (value)
159 | cEffect.flags |= AEffectFlagIsSynthesizer;
160 | else
161 | cEffect.flags &= ~AEffectFlagIsSynthesizer;
162 | }
163 |
164 | void AudioEffect::programsAreChunks(bool value)
165 | {
166 | if (value)
167 | cEffect.flags |= AEffectFlagProgramsAreChunks;
168 | else
169 | cEffect.flags &= ~AEffectFlagProgramsAreChunks;
170 | }
171 |
172 | void AudioEffect::setParameterAutomated(VstInt32 index, float value)
173 | {
174 | setParameter(index, value);
175 | if (audioMaster)
176 | audioMaster(getAeffect(), audioMasterAutomate, index, 0, 0, value);
177 | }
178 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/audioeffect.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "aeffect.h"
18 | #include "aeffeditor.h"
19 | #include "vstevent.h"
20 | #include "vstkey.h"
21 | #include "vstparameter.h"
22 | #include "vstpin.h"
23 | #include "vstspeaker.h"
24 | #include "vsttypes.h"
25 |
26 | // This may work. Or it may not. We don't guarantee compatibility with the original.
27 | class AudioEffect {
28 | public:
29 | AudioEffect(audioMasterCallback audioMaster, VstInt32 __unk00, VstInt32 __unk01);
30 | virtual ~AudioEffect();
31 |
32 | protected:
33 | // Internal
34 | virtual VstIntPtr control(VstInt32 opcode, VstInt32 param1, VstIntPtr param2, void* ptr, float value);
35 |
36 | public:
37 | // AudioEffect
38 | virtual AEffect* getAeffect();
39 | virtual void setEditor(AEffEditor* editor);
40 |
41 | virtual void process(float** inputs, float** outputs, VstInt32 sampleFrames){};
42 |
43 | virtual float getParameter(VstInt32 index)
44 | {
45 | return 0;
46 | }
47 | virtual void setParameter(VstInt32 index, float value){};
48 |
49 | virtual void processReplacing(float** inputs, float** outputs, VstInt32 sampleFrames){};
50 |
51 | // AEffect
52 | virtual void setUniqueID(VstInt32 uniqueID);
53 | virtual void setNumInputs(VstInt32 numInputs);
54 | virtual void setNumOutputs(VstInt32 numOutputs);
55 | virtual void setInitialDelay(VstInt32 delay);
56 | virtual void canProcessReplacing(bool value);
57 | virtual void isSynth(bool value);
58 | virtual void programsAreChunks(bool value);
59 |
60 | // Audio Master (sorted by AEffectMasterOpCodes)
61 | virtual void setParameterAutomated(VstInt32 index, float value);
62 |
63 | // Audio Plugin (sorted by AEffectOpCodes)
64 | virtual void open(){};
65 | virtual void close(){};
66 | virtual void setProgram(VstInt32 program){};
67 | virtual VstInt32 getProgram()
68 | {
69 | return 0;
70 | }
71 | virtual void setProgramName(char* name){};
72 | virtual void getProgramName(char* name)
73 | {
74 | *name = 0;
75 | }
76 | virtual void getParameterLabel(VstInt32 index, char* label){};
77 | virtual void getParameterDisplay(VstInt32 index, char* text){};
78 | virtual void getParameterName(VstInt32 index, char* text){};
79 | virtual void setSampleRate(float newSamplerate){};
80 | virtual void setBlockSize(VstInt32 newBlockSize){};
81 | virtual void suspend(){};
82 | virtual void resume(){};
83 | virtual VstInt32 getChunk(void** data, bool isPreset = false)
84 | {
85 | return 0;
86 | }
87 | virtual VstInt32 setChunk(void* data, VstInt32 byteSize, bool isPreset = false)
88 | {
89 | return 0;
90 | }
91 |
92 | // Defined by Implementation
93 |
94 | protected: // Needs to be accessible by AudioEffectX
95 | AEffect cEffect; // vst2wrapper requires this.
96 | audioMasterCallback audioMaster; // vst2wrapper requires this.
97 | VstInt32 numPrograms;
98 | VstInt32 curProgram;
99 | AEffEditor* editor;
100 | };
101 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/audioeffectx.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | /*
17 | * This is based on the publicly available VST 3.x SDK "vst2wrapper" files. All content is as such licensed under the BSD 3-Clause license provided in those files, and also shown above.
18 | *
19 | * Assume that everything here is guesswork. It seems to work, but is largely unconfirmed.
20 | */
21 |
22 | #pragma once
23 | #include "audioeffectx.hpp"
24 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/audioeffectx.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "aeffectx.h"
18 | #include "audioeffect.hpp"
19 | #include "vstmidi.h"
20 | #include "vstpin.h"
21 | #include "vstspeaker.h"
22 | #include "vsttypes.h"
23 |
24 | class AudioEffectX : public AudioEffect {
25 | public:
26 | AudioEffectX(audioMasterCallback audioMaster, VstInt32 __unk00, VstInt32 __unk01);
27 | virtual ~AudioEffectX();
28 |
29 | protected:
30 | // Internal
31 | virtual VstIntPtr control(VstInt32 opcode, VstInt32 param1, VstIntPtr param2, void* ptr, float value) override;
32 |
33 | public:
34 | // AEffect/AEffectX
35 | virtual void canDoubleReplacing(bool value);
36 | virtual void noTail(bool value);
37 |
38 | virtual void processDoubleReplacing(double** inputs, double** outputs, VstInt32 sampleFrames){};
39 |
40 | // Audio Master (sorted by AEffectMasterOpCodes)
41 | virtual VstTimeInfo* getTimeInfo(VstInt32 filter);
42 | virtual bool sendVstEventsToHost(VstEvents* events);
43 | virtual bool ioChanged();
44 | virtual bool sizeWindow(VstInt32 width, VstInt32 height);
45 | virtual VstInt32 getCurrentProcessLevel();
46 | virtual bool getHostVendorString(char* text);
47 | virtual bool getHostProductString(char* text);
48 | virtual VstInt32 getHostVendorVersion();
49 | virtual VstInt32 canHostDo(char* text);
50 | virtual bool beginEdit(VstInt32 paramIndex);
51 | virtual bool endEdit(VstInt32 paramIndex);
52 | virtual bool updateDisplay();
53 |
54 | // Audio Plugin (sorted by AEffectOpCodes)
55 | virtual VstInt32 processEvents(VstEvents* events)
56 | {
57 | return 0;
58 | }
59 | virtual bool canParameterBeAutomated(VstInt32 index)
60 | {
61 | return false;
62 | }
63 | virtual bool string2parameter(VstInt32 index, char* text)
64 | {
65 | return false;
66 | }
67 | virtual bool getProgramNameIndexed(VstInt32 category, VstInt32 index, char* text)
68 | {
69 | return false;
70 | }
71 | virtual bool getInputProperties(VstInt32 index, VstPinProperties* properties)
72 | {
73 | return false;
74 | }
75 | virtual bool getOutputProperties(VstInt32 index, VstPinProperties* properties)
76 | {
77 | return false;
78 | }
79 | virtual VstPlugCategory getPlugCategory()
80 | {
81 | return kPlugCategUnknown;
82 | }
83 | virtual bool setSpeakerArrangement(VstSpeakerArrangement* pluginInput, VstSpeakerArrangement* pluginOutput)
84 | {
85 | return false;
86 | }
87 | virtual bool setBypass(bool onOff)
88 | {
89 | return false;
90 | }
91 | virtual bool getEffectName(char* name)
92 | {
93 | return false;
94 | }
95 | virtual bool getVendorString(char* text)
96 | {
97 | return false;
98 | }
99 | virtual bool getProductString(char* text)
100 | {
101 | return false;
102 | }
103 | virtual VstInt32 getVendorVersion()
104 | {
105 | return 0;
106 | }
107 | virtual VstIntPtr vendorSpecific(VstInt32 lArg, VstIntPtr lArg2, void* ptrArg, float floatArg)
108 | {
109 | return 0;
110 | }
111 | virtual VstInt32 canDo(char* text)
112 | {
113 | return 0;
114 | }
115 | virtual VstInt32 getGetTailSize()
116 | {
117 | return 0;
118 | }
119 | virtual bool getParameterProperties(VstInt32 index, VstParameterProperties* p)
120 | {
121 | return false;
122 | }
123 | virtual VstInt32 getMidiProgramName(VstInt32 channel, MidiProgramName* midiProgramName)
124 | {
125 | return 0;
126 | }
127 | virtual VstInt32 getCurrentMidiProgram(VstInt32 channel, MidiProgramName* currentProgram)
128 | {
129 | return 0;
130 | }
131 | virtual VstInt32 getMidiProgramCategory(VstInt32 channel, MidiProgramCategory* category)
132 | {
133 | return 0;
134 | }
135 | virtual bool hasMidiProgramsChanged(VstInt32 channel)
136 | {
137 | return false;
138 | }
139 | virtual bool getMidiKeyName(VstInt32 channel, MidiKeyName* keyName)
140 | {
141 | return false;
142 | }
143 | virtual bool getSpeakerArrangement(VstSpeakerArrangement** pluginInput, VstSpeakerArrangement** pluginOutput)
144 | {
145 | return false;
146 | }
147 | virtual VstInt32 startProcess()
148 | {
149 | return 0;
150 | }
151 | virtual VstInt32 stopProcess()
152 | {
153 | return 0;
154 | }
155 | virtual bool setProcessPrecision(VstInt32 precision)
156 | {
157 | return false;
158 | }
159 | virtual VstInt32 getNumMidiInputChannels()
160 | {
161 | return 0;
162 | }
163 | virtual VstInt32 getNumMidiOutputChannels()
164 | {
165 | return 0;
166 | }
167 | };
168 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/vstevent.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "vsttypes.h"
18 |
19 | #pragma pack(push, 8)
20 |
21 | enum VstEventTypes {
22 | kVstMidiType = 1,
23 | kVstSysExType = 6,
24 | };
25 |
26 | struct VstEvent {
27 | VstInt32 type;
28 | VstInt32 byteSize;
29 | VstInt32 deltaFrames;
30 | VstInt32 flags;
31 | // ? bytes
32 | };
33 |
34 | struct VstEvents {
35 | VstInt32 numEvents;
36 | VstInt32 reserved;
37 | VstEvent* events[2];
38 | };
39 |
40 | #pragma pack(pop)
41 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/vstkey.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "vsttypes.h"
18 |
19 | // vstgui4 has a perfect implementation of this just lying around.
20 |
21 | #pragma pack(push, 8)
22 |
23 | enum VstModifierKey {
24 | MODIFIER_SHIFT = 1 << 0, // Shift
25 | MODIFIER_ALTERNATE = 1 << 1, // Alt
26 | MODIFIER_COMMAND = 1 << 2, // Control on Mac
27 | MODIFIER_CONTROL = 1 << 3 // Ctrl on PC, Apple on Mac
28 | };
29 |
30 | enum VstVirtualKey {
31 | VKEY_BACK = 1,
32 | VKEY_TAB,
33 | VKEY_CLEAR,
34 | VKEY_RETURN,
35 | VKEY_PAUSE,
36 | VKEY_ESCAPE,
37 | VKEY_SPACE,
38 | VKEY_NEXT,
39 | VKEY_END,
40 | VKEY_HOME,
41 |
42 | VKEY_LEFT,
43 | VKEY_UP,
44 | VKEY_RIGHT,
45 | VKEY_DOWN,
46 | VKEY_PAGEUP,
47 | VKEY_PAGEDOWN,
48 |
49 | VKEY_SELECT,
50 | VKEY_PRINT,
51 | VKEY_ENTER,
52 | VKEY_SNAPSHOT,
53 | VKEY_INSERT,
54 | VKEY_DELETE,
55 | VKEY_HELP,
56 | VKEY_NUMPAD0,
57 | VKEY_NUMPAD1,
58 | VKEY_NUMPAD2,
59 | VKEY_NUMPAD3,
60 | VKEY_NUMPAD4,
61 | VKEY_NUMPAD5,
62 | VKEY_NUMPAD6,
63 | VKEY_NUMPAD7,
64 | VKEY_NUMPAD8,
65 | VKEY_NUMPAD9,
66 | VKEY_MULTIPLY,
67 | VKEY_ADD,
68 | VKEY_SEPARATOR,
69 | VKEY_SUBTRACT,
70 | VKEY_DECIMAL,
71 | VKEY_DIVIDE,
72 | VKEY_F1,
73 | VKEY_F2,
74 | VKEY_F3,
75 | VKEY_F4,
76 | VKEY_F5,
77 | VKEY_F6,
78 | VKEY_F7,
79 | VKEY_F8,
80 | VKEY_F9,
81 | VKEY_F10,
82 | VKEY_F11,
83 | VKEY_F12,
84 | VKEY_NUMLOCK,
85 | VKEY_SCROLL,
86 |
87 | VKEY_SHIFT,
88 | VKEY_CONTROL,
89 | VKEY_ALT,
90 |
91 | VKEY_EQUALS
92 | };
93 |
94 | struct VstKeyCode {
95 | VstInt32 character;
96 | unsigned char virt; // see enum VstVirtualKey
97 | unsigned char modifier; // see enum VstModifierKey
98 | };
99 |
100 | #pragma pack(pop)
101 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/vstmidi.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "vsttypes.h"
18 | #include "vstversion.h"
19 |
20 | #pragma pack(push, 8)
21 |
22 | enum VstMidiEventFlags {
23 | kVstMidiEventIsRealtime,
24 | };
25 |
26 | struct VstMidiEvent : VstEvent {
27 | VstInt32 noteLength;
28 | VstInt32 noteOffset;
29 | char midiData[4];
30 | char detune;
31 | char noteOffVelocity;
32 | char __unk00;
33 | char __unk01;
34 | };
35 |
36 | struct VstMidiSysexEvent : VstEvent {
37 | VstInt32 dumpBytes;
38 | VstIntPtr __unk00;
39 | char* sysexDump;
40 | VstIntPtr __unk01;
41 | };
42 |
43 | struct MidiKeyName {
44 | VstInt32 thisProgramIndex;
45 | VstInt32 thisKeyNumber;
46 | char keyName[kVstMaxNameLen];
47 | VstInt32 __unk00;
48 | VstInt32 __unk01;
49 | };
50 |
51 | struct MidiProgramName {
52 | VstInt32 thisProgramIndex;
53 | char name[kVstMaxNameLen];
54 | VstInt32 midiProgram; // Could be swapped with thisProgramIndex?
55 | VstInt32 midiBankMsb;
56 | VstInt32 midiBankLsb;
57 | VstInt32 __unk01;
58 | VstInt32 parentCategoryIndex; // -1 appears to mean no category.
59 | VstInt32 flags;
60 | };
61 |
62 | struct MidiProgramCategory {
63 | VstInt32 thisCategoryIndex;
64 | char name[kVstMaxNameLen]; // Name guessed, but might be wrong. Doesn't seem to be used.
65 | VstInt32 parentCategoryIndex;
66 | VstInt32 flags;
67 | };
68 |
69 | #pragma pack(pop)
70 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/vstparameter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "vsttypes.h"
18 |
19 | #pragma pack(push, 8)
20 |
21 | enum VstParameterFlags {
22 | kVstParameterIsSwitch = 1,
23 | kVstParameterUsesIntegerMinMax = 2,
24 | kVstParameterCanRamp = 7,
25 | };
26 |
27 | struct VstParameterProperties {
28 | float __unk00;
29 | float __unk01;
30 | float __unk02;
31 | char label[64];
32 | VstInt32 flags;
33 | VstInt32 minInteger;
34 | VstInt32 maxInteger;
35 | VstInt32 __unk03;
36 | VstInt32 __unk04;
37 | char shortLabel[8];
38 | // There's more after this, but it's not used?
39 | // We know what they're for (see vst.h), but they don't appear anywhere.
40 | VstInt16 __unk05; // Order/Index for display. Starts at 0.
41 | VstInt16 __unk06; // Category Index, 0 for none, 1+ for category.
42 | VstInt16 __unk07; // Number of parameters in this category
43 | VstInt16 __unk08; // Know absolutely nothing about this one.
44 | char __unk09[24]; // Category Label. We know the size here, and what it is.
45 | char __unk10[16]; // Always exists, not sure why. May be padding.
46 | };
47 |
48 | #pragma pack(pop)
49 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/vstpin.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "vsttypes.h"
18 |
19 | #pragma pack(push, 8)
20 |
21 | enum VstPinFlags {
22 | kVstPinIsActive,
23 | kVstPinUseSpeaker,
24 | kVstPinIsStereo,
25 |
26 | };
27 |
28 | struct VstPinProperties {
29 | char label[kVstMaxLabelLen];
30 | VstInt32 flags;
31 | VstInt32 arrangementType;
32 | char shortLabel;
33 | // ? bytes
34 | };
35 |
36 | #pragma pack(pop)
37 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/vstspeaker.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "vsttypes.h"
18 |
19 | #pragma pack(push, 8)
20 |
21 | enum VstSpeakerArrangmentType { // Name adapted from vst.h
22 | kSpeakerArrUserDefined = -2,
23 | kSpeakerArr__unk01 = -1,
24 | // Taken from: VstInt32 Vst2Wrapper::vst3ToVst2SpeakerArr
25 | kSpeakerArrMono = 0,
26 | kSpeakerArrStereo,
27 | kSpeakerArrStereoSurround,
28 | kSpeakerArrStereoCenter,
29 | kSpeakerArrStereoSide,
30 | kSpeakerArrStereoCLfe,
31 | kSpeakerArr30Cine,
32 | kSpeakerArr30Music,
33 | kSpeakerArr31Cine,
34 | kSpeakerArr31Music,
35 | kSpeakerArr40Cine,
36 | kSpeakerArr40Music,
37 | kSpeakerArr41Cine,
38 | kSpeakerArr41Music,
39 | kSpeakerArr50,
40 | kSpeakerArr51,
41 | kSpeakerArr60Cine,
42 | kSpeakerArr60Music,
43 | kSpeakerArr61Cine,
44 | kSpeakerArr61Music,
45 | kSpeakerArr70Cine,
46 | kSpeakerArr70Music,
47 | kSpeakerArr71Cine,
48 | kSpeakerArr71Music,
49 | kSpeakerArr80Cine,
50 | kSpeakerArr80Music,
51 | kSpeakerArr81Cine,
52 | kSpeakerArr81Music,
53 | kSpeakerArr102,
54 | };
55 |
56 | enum VstSpeakerType { // Name adapted from vst.h
57 | // Taken from VstInt32 Vst2Wrapper::vst3ToVst2Speaker (Vst::Speaker vst3Speaker)
58 | kSpeakerUndefined = INT32_MAX, // Weirdest one to figure out. Why not -1?
59 | kSpeakerM = 0,
60 | kSpeakerL,
61 | kSpeakerR,
62 | kSpeakerC,
63 | kSpeakerLfe,
64 | kSpeakerLs,
65 | kSpeakerRs,
66 | kSpeakerLc,
67 | kSpeakerRc,
68 | kSpeakerS,
69 | kSpeakerSl,
70 | kSpeakerSr,
71 | kSpeakerTm,
72 | kSpeakerTfl,
73 | kSpeakerTfc,
74 | kSpeakerTfr,
75 | kSpeakerTrl,
76 | kSpeakerTrc,
77 | kSpeakerTrr,
78 | kSpeakerLfe2,
79 | };
80 |
81 | struct VstSpeakerProperties {
82 | float __unk00;
83 | float __unk01;
84 | float __unk02;
85 | float __unk03;
86 | char name[64];
87 | VstInt32 type; // VstSpeakerType, see vst.h
88 | char __unk04[28];
89 | };
90 |
91 | struct VstSpeakerArrangement {
92 | VstInt32 type; // VstSpeakerArrangmentType, see vst.h
93 | VstInt32 numChannels;
94 | VstSpeakerProperties speakers[32]; // See vst.h. I don't know if this size is correct.
95 | };
96 |
97 | #pragma pack(pop)
98 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/vsttime.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #include "vsttypes.h"
18 |
19 | #pragma pack(push, 8)
20 |
21 | enum VstSMPTEFrameRate {
22 | // Taken from: void Vst2Wrapper::setupProcessTimeInfo ()
23 | kVstSmpte24fps = 0,
24 | kVstSmpte25fps = 1,
25 | kVstSmpte2997fps = 2,
26 | kVstSmpte30fps = 3,
27 | kVstSmpte2997dfps = 4,
28 | kVstSmpte30dfps = 5,
29 | kVstSmpteFilm16mm = 6,
30 | kVstSmpteFilm35mm = 7,
31 | kVstSmpte239fps = 9,
32 | kVstSmpte249fps = 10,
33 | kVstSmpte599fps = 11,
34 | kVstSmpte60fps = 12,
35 | };
36 |
37 | struct VstTimeInfo {
38 | double samplePos;
39 | double sampleRate;
40 | double nanoSeconds;
41 | double ppqPos;
42 | double tempo;
43 | double barStartPos;
44 | double cycleStartPos;
45 | double cycleEndPos;
46 | VstInt32 timeSigNumerator;
47 | VstInt32 timeSigDenominator;
48 | VstInt32 smpteOffset;
49 | VstInt32 smpteFrameRate;
50 | VstInt32 samplesToNextClock;
51 | VstInt32 flags;
52 | };
53 |
54 | #pragma pack(pop)
55 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/vsttypes.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 | #ifdef __cplusplus
18 | #include
19 | #else
20 | #include
21 | #endif
22 |
23 | #define VstFunctionAPI __cdecl
24 |
25 | enum VstMaxLengths { // Anything with k is an enum?
26 | kVstMaxNameLen = 64,
27 | kVstMaxLabelLen = 64,
28 | kVstMaxShortLabelLen = 8,
29 | kVstExtMaxParamStrLen = 32, // Apparently incorrect, but actually in use by many hosts.
30 | kVstMaxParamStrLen = 8,
31 | kVstMaxProgNameLen = 24,
32 | kVstMaxVendorStrLen = 64,
33 | kVstMaxEffectNameLen = 32,
34 | };
35 |
36 | // 16-bit wide Integer
37 | typedef int16_t VstInt16;
38 |
39 | // 32-bit wide Integer
40 | typedef int32_t VstInt32;
41 |
42 | // Variable size Integer Pointer
43 | typedef intptr_t VstIntPtr;
44 |
45 | // Float and double are used as-is. No custom type name here.
46 |
47 | // Bus Direction. Appears to be int32_t
48 | typedef int32_t BusDirection;
49 |
50 | // Rectangle
51 | struct ERect {
52 | VstInt16 left, top, right, bottom;
53 | };
54 |
--------------------------------------------------------------------------------
/deps/VST2_SDK/vstversion.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Michael Fabian 'Xaymar' Dirks
3 | * Copyright 2024 Steinberg Media Technologies GmbH
4 | *
5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | *
9 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | *
11 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 |
16 | #pragma once
17 |
18 | enum VstVersion {
19 | kVstVersion_0 = 0, // Anything before 2.0, rarely used.
20 | kVstVersion_1000 = 1000, // 1.0
21 | kVstVersion_1100 = 1100, // 1.1
22 | kVstVersion_2 = 2, // 2.0, rarely used.
23 | kVstVersion_2000 = 2000, // 2.0
24 | kVstVersion_2100 = 2100, // 2.1
25 | kVstVersion_2200 = 2200, // 2.2
26 | kVstVersion_2300 = 2300, // 2.3
27 | kVstVersion_2400 = 2400, // 2.4
28 | };
29 |
--------------------------------------------------------------------------------
/deps/png/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | This copy of the libpng notices is provided for your convenience. In case of
3 | any discrepancy between this copy and the notices in the file png.h that is
4 | included in the libpng distribution, the latter shall prevail.
5 |
6 | COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
7 |
8 | If you modify libpng you may insert additional notices immediately following
9 | this sentence.
10 |
11 | libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
12 | Copyright (c) 2000-2002 Glenn Randers-Pehrson
13 | and are distributed according to the same disclaimer and license as libpng-1.0.6
14 | with the following individuals added to the list of Contributing Authors
15 |
16 | Simon-Pierre Cadieux
17 | Eric S. Raymond
18 | Gilles Vollant
19 |
20 | and with the following additions to the disclaimer:
21 |
22 | There is no warranty against interference with your enjoyment of the
23 | library or against infringement. There is no warranty that our
24 | efforts or the library will fulfill any of your particular purposes
25 | or needs. This library is provided with all faults, and the entire
26 | risk of satisfactory quality, performance, accuracy, and effort is with
27 | the user.
28 |
29 | libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
30 | Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
31 | distributed according to the same disclaimer and license as libpng-0.96,
32 | with the following individuals added to the list of Contributing Authors:
33 |
34 | Tom Lane
35 | Glenn Randers-Pehrson
36 | Willem van Schaik
37 |
38 | libpng versions 0.89, June 1996, through 0.96, May 1997, are
39 | Copyright (c) 1996, 1997 Andreas Dilger
40 | Distributed according to the same disclaimer and license as libpng-0.88,
41 | with the following individuals added to the list of Contributing Authors:
42 |
43 | John Bowler
44 | Kevin Bracey
45 | Sam Bushell
46 | Magnus Holmgren
47 | Greg Roelofs
48 | Tom Tanner
49 |
50 | libpng versions 0.5, May 1995, through 0.88, January 1996, are
51 | Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
52 |
53 | For the purposes of this copyright and license, "Contributing Authors"
54 | is defined as the following set of individuals:
55 |
56 | Andreas Dilger
57 | Dave Martindale
58 | Guy Eric Schalnat
59 | Paul Schmidt
60 | Tim Wegner
61 |
62 | The PNG Reference Library is supplied "AS IS". The Contributing Authors
63 | and Group 42, Inc. disclaim all warranties, expressed or implied,
64 | including, without limitation, the warranties of merchantability and of
65 | fitness for any purpose. The Contributing Authors and Group 42, Inc.
66 | assume no liability for direct, indirect, incidental, special, exemplary,
67 | or consequential damages, which may result from the use of the PNG
68 | Reference Library, even if advised of the possibility of such damage.
69 |
70 | Permission is hereby granted to use, copy, modify, and distribute this
71 | source code, or portions hereof, for any purpose, without fee, subject
72 | to the following restrictions:
73 |
74 | 1. The origin of this source code must not be misrepresented.
75 |
76 | 2. Altered versions must be plainly marked as such and must not
77 | be misrepresented as being the original source.
78 |
79 | 3. This Copyright notice may not be removed or altered from any
80 | source or altered source distribution.
81 |
82 | The Contributing Authors and Group 42, Inc. specifically permit, without
83 | fee, and encourage the use of this source code as a component to
84 | supporting the PNG file format in commercial products. If you use this
85 | source code in a product, acknowledgment is not required but would be
86 | appreciated.
87 |
88 |
89 | A "png_get_copyright" function is available, for convenient use in "about"
90 | boxes and the like:
91 |
92 | printf("%s",png_get_copyright(NULL));
93 |
94 | Also, the PNG logo (in PNG format, of course) is supplied in the
95 | files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
96 |
97 | Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
98 | certification mark of the Open Source Initiative.
99 |
100 | Glenn Randers-Pehrson
101 | randeg@alum.rpi.edu
102 | October 3, 2002
103 |
--------------------------------------------------------------------------------
/deps/png/pngasmrd.h:
--------------------------------------------------------------------------------
1 | /* pngasmrd.h - assembler version of utilities to read a PNG file
2 | *
3 | * libpng 1.2.5 - October 3, 2002
4 | * For conditions of distribution and use, see copyright notice in png.h
5 | * Copyright (c) 2002 Glenn Randers-Pehrson
6 | *
7 | */
8 |
9 | /* This file is obsolete in libpng-1.0.9 and later; its contents now appear
10 | * at the end of pngconf.h.
11 | */
12 |
--------------------------------------------------------------------------------
/deps/png/pngrio.c:
--------------------------------------------------------------------------------
1 |
2 | /* pngrio.c - functions for data input
3 | *
4 | * libpng 1.2.5 - October 3, 2002
5 | * For conditions of distribution and use, see copyright notice in png.h
6 | * Copyright (c) 1998-2002 Glenn Randers-Pehrson
7 | * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8 | * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
9 | *
10 | * This file provides a location for all input. Users who need
11 | * special handling are expected to write a function that has the same
12 | * arguments as this and performs a similar function, but that possibly
13 | * has a different input method. Note that you shouldn't change this
14 | * function, but rather write a replacement function and then make
15 | * libpng use it at run time with png_set_read_fn(...).
16 | */
17 |
18 | #define PNG_INTERNAL
19 | #include "png.h"
20 |
21 | /* Read the data from whatever input you are using. The default routine
22 | reads from a file pointer. Note that this routine sometimes gets called
23 | with very small lengths, so you should implement some kind of simple
24 | buffering if you are using unbuffered reads. This should never be asked
25 | to read more then 64K on a 16 bit machine. */
26 | void /* PRIVATE */
27 | png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
28 | {
29 | png_debug1(4,"reading %d bytes\n", (int)length);
30 | if (png_ptr->read_data_fn != NULL)
31 | (*(png_ptr->read_data_fn))(png_ptr, data, length);
32 | else
33 | png_error(png_ptr, "Call to NULL read function");
34 | }
35 |
36 | #if !defined(PNG_NO_STDIO)
37 | /* This is the function that does the actual reading of data. If you are
38 | not reading from a standard C stream, you should create a replacement
39 | read_data function and use it at run time with png_set_read_fn(), rather
40 | than changing the library. */
41 | #ifndef USE_FAR_KEYWORD
42 | void PNGAPI
43 | png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
44 | {
45 | png_size_t check;
46 |
47 | /* fread() returns 0 on error, so it is OK to store this in a png_size_t
48 | * instead of an int, which is what fread() actually returns.
49 | */
50 | #if defined(_WIN32_WCE)
51 | if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
52 | check = 0;
53 | #else
54 | check = (png_size_t)fread(data, (png_size_t)1, length,
55 | (png_FILE_p)png_ptr->io_ptr);
56 | #endif
57 |
58 | if (check != length)
59 | png_error(png_ptr, "Read Error");
60 | }
61 | #else
62 | /* this is the model-independent version. Since the standard I/O library
63 | can't handle far buffers in the medium and small models, we have to copy
64 | the data.
65 | */
66 |
67 | #define NEAR_BUF_SIZE 1024
68 | #define MIN(a,b) (a <= b ? a : b)
69 |
70 | static void /* PRIVATE */
71 | png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
72 | {
73 | int check;
74 | png_byte *n_data;
75 | png_FILE_p io_ptr;
76 |
77 | /* Check if data really is near. If so, use usual code. */
78 | n_data = (png_byte *)CVT_PTR_NOCHECK(data);
79 | io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
80 | if ((png_bytep)n_data == data)
81 | {
82 | #if defined(_WIN32_WCE)
83 | if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
84 | check = 0;
85 | #else
86 | check = fread(n_data, 1, length, io_ptr);
87 | #endif
88 | }
89 | else
90 | {
91 | png_byte buf[NEAR_BUF_SIZE];
92 | png_size_t read, remaining, err;
93 | check = 0;
94 | remaining = length;
95 | do
96 | {
97 | read = MIN(NEAR_BUF_SIZE, remaining);
98 | #if defined(_WIN32_WCE)
99 | if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
100 | err = 0;
101 | #else
102 | err = fread(buf, (png_size_t)1, read, io_ptr);
103 | #endif
104 | png_memcpy(data, buf, read); /* copy far buffer to near buffer */
105 | if(err != read)
106 | break;
107 | else
108 | check += err;
109 | data += read;
110 | remaining -= read;
111 | }
112 | while (remaining != 0);
113 | }
114 | if ((png_uint_32)check != (png_uint_32)length)
115 | png_error(png_ptr, "read Error");
116 | }
117 | #endif
118 | #endif
119 |
120 | /* This function allows the application to supply a new input function
121 | for libpng if standard C streams aren't being used.
122 |
123 | This function takes as its arguments:
124 | png_ptr - pointer to a png input data structure
125 | io_ptr - pointer to user supplied structure containing info about
126 | the input functions. May be NULL.
127 | read_data_fn - pointer to a new input function that takes as its
128 | arguments a pointer to a png_struct, a pointer to
129 | a location where input data can be stored, and a 32-bit
130 | unsigned int that is the number of bytes to be read.
131 | To exit and output any fatal error messages the new write
132 | function should call png_error(png_ptr, "Error msg"). */
133 | void PNGAPI
134 | png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
135 | png_rw_ptr read_data_fn)
136 | {
137 | png_ptr->io_ptr = io_ptr;
138 |
139 | #if !defined(PNG_NO_STDIO)
140 | if (read_data_fn != NULL)
141 | png_ptr->read_data_fn = read_data_fn;
142 | else
143 | png_ptr->read_data_fn = png_default_read_data;
144 | #else
145 | png_ptr->read_data_fn = read_data_fn;
146 | #endif
147 |
148 | /* It is an error to write to a read device */
149 | if (png_ptr->write_data_fn != NULL)
150 | {
151 | png_ptr->write_data_fn = NULL;
152 | png_warning(png_ptr,
153 | "It's an error to set both read_data_fn and write_data_fn in the ");
154 | png_warning(png_ptr,
155 | "same structure. Resetting write_data_fn to NULL.");
156 | }
157 |
158 | #if defined(PNG_WRITE_FLUSH_SUPPORTED)
159 | png_ptr->output_flush_fn = NULL;
160 | #endif
161 | }
162 |
--------------------------------------------------------------------------------
/deps/zlib/adler32.c:
--------------------------------------------------------------------------------
1 | /* adler32.c -- compute the Adler-32 checksum of a data stream
2 | * Copyright (C) 1995-2011, 2016 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* @(#) $Id$ */
7 |
8 | #include "zutil.h"
9 |
10 | local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
11 |
12 | #define BASE 65521U /* largest prime smaller than 65536 */
13 | #define NMAX 5552
14 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
15 |
16 | #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
17 | #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
18 | #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
19 | #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
20 | #define DO16(buf) DO8(buf,0); DO8(buf,8);
21 |
22 | /* use NO_DIVIDE if your processor does not do division in hardware --
23 | try it both ways to see which is faster */
24 | #ifdef NO_DIVIDE
25 | /* note that this assumes BASE is 65521, where 65536 % 65521 == 15
26 | (thank you to John Reiser for pointing this out) */
27 | # define CHOP(a) \
28 | do { \
29 | unsigned long tmp = a >> 16; \
30 | a &= 0xffffUL; \
31 | a += (tmp << 4) - tmp; \
32 | } while (0)
33 | # define MOD28(a) \
34 | do { \
35 | CHOP(a); \
36 | if (a >= BASE) a -= BASE; \
37 | } while (0)
38 | # define MOD(a) \
39 | do { \
40 | CHOP(a); \
41 | MOD28(a); \
42 | } while (0)
43 | # define MOD63(a) \
44 | do { /* this assumes a is not negative */ \
45 | z_off64_t tmp = a >> 32; \
46 | a &= 0xffffffffL; \
47 | a += (tmp << 8) - (tmp << 5) + tmp; \
48 | tmp = a >> 16; \
49 | a &= 0xffffL; \
50 | a += (tmp << 4) - tmp; \
51 | tmp = a >> 16; \
52 | a &= 0xffffL; \
53 | a += (tmp << 4) - tmp; \
54 | if (a >= BASE) a -= BASE; \
55 | } while (0)
56 | #else
57 | # define MOD(a) a %= BASE
58 | # define MOD28(a) a %= BASE
59 | # define MOD63(a) a %= BASE
60 | #endif
61 |
62 | /* ========================================================================= */
63 | uLong ZEXPORT adler32_z(adler, buf, len)
64 | uLong adler;
65 | const Bytef *buf;
66 | z_size_t len;
67 | {
68 | unsigned long sum2;
69 | unsigned n;
70 |
71 | /* split Adler-32 into component sums */
72 | sum2 = (adler >> 16) & 0xffff;
73 | adler &= 0xffff;
74 |
75 | /* in case user likes doing a byte at a time, keep it fast */
76 | if (len == 1) {
77 | adler += buf[0];
78 | if (adler >= BASE)
79 | adler -= BASE;
80 | sum2 += adler;
81 | if (sum2 >= BASE)
82 | sum2 -= BASE;
83 | return adler | (sum2 << 16);
84 | }
85 |
86 | /* initial Adler-32 value (deferred check for len == 1 speed) */
87 | if (buf == Z_NULL)
88 | return 1L;
89 |
90 | /* in case short lengths are provided, keep it somewhat fast */
91 | if (len < 16) {
92 | while (len--) {
93 | adler += *buf++;
94 | sum2 += adler;
95 | }
96 | if (adler >= BASE)
97 | adler -= BASE;
98 | MOD28(sum2); /* only added so many BASE's */
99 | return adler | (sum2 << 16);
100 | }
101 |
102 | /* do length NMAX blocks -- requires just one modulo operation */
103 | while (len >= NMAX) {
104 | len -= NMAX;
105 | n = NMAX / 16; /* NMAX is divisible by 16 */
106 | do {
107 | DO16(buf); /* 16 sums unrolled */
108 | buf += 16;
109 | } while (--n);
110 | MOD(adler);
111 | MOD(sum2);
112 | }
113 |
114 | /* do remaining bytes (less than NMAX, still just one modulo) */
115 | if (len) { /* avoid modulos if none remaining */
116 | while (len >= 16) {
117 | len -= 16;
118 | DO16(buf);
119 | buf += 16;
120 | }
121 | while (len--) {
122 | adler += *buf++;
123 | sum2 += adler;
124 | }
125 | MOD(adler);
126 | MOD(sum2);
127 | }
128 |
129 | /* return recombined sums */
130 | return adler | (sum2 << 16);
131 | }
132 |
133 | /* ========================================================================= */
134 | uLong ZEXPORT adler32(adler, buf, len)
135 | uLong adler;
136 | const Bytef *buf;
137 | uInt len;
138 | {
139 | return adler32_z(adler, buf, len);
140 | }
141 |
142 | /* ========================================================================= */
143 | local uLong adler32_combine_(adler1, adler2, len2)
144 | uLong adler1;
145 | uLong adler2;
146 | z_off64_t len2;
147 | {
148 | unsigned long sum1;
149 | unsigned long sum2;
150 | unsigned rem;
151 |
152 | /* for negative len, return invalid adler32 as a clue for debugging */
153 | if (len2 < 0)
154 | return 0xffffffffUL;
155 |
156 | /* the derivation of this formula is left as an exercise for the reader */
157 | MOD63(len2); /* assumes len2 >= 0 */
158 | rem = (unsigned)len2;
159 | sum1 = adler1 & 0xffff;
160 | sum2 = rem * sum1;
161 | MOD(sum2);
162 | sum1 += (adler2 & 0xffff) + BASE - 1;
163 | sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
164 | if (sum1 >= BASE) sum1 -= BASE;
165 | if (sum1 >= BASE) sum1 -= BASE;
166 | if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1);
167 | if (sum2 >= BASE) sum2 -= BASE;
168 | return sum1 | (sum2 << 16);
169 | }
170 |
171 | /* ========================================================================= */
172 | uLong ZEXPORT adler32_combine(adler1, adler2, len2)
173 | uLong adler1;
174 | uLong adler2;
175 | z_off_t len2;
176 | {
177 | return adler32_combine_(adler1, adler2, len2);
178 | }
179 |
180 | uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
181 | uLong adler1;
182 | uLong adler2;
183 | z_off64_t len2;
184 | {
185 | return adler32_combine_(adler1, adler2, len2);
186 | }
187 |
--------------------------------------------------------------------------------
/deps/zlib/compress.c:
--------------------------------------------------------------------------------
1 | /* compress.c -- compress a memory buffer
2 | * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* @(#) $Id$ */
7 |
8 | #define ZLIB_INTERNAL
9 | #include "zlib.h"
10 |
11 | /* ===========================================================================
12 | Compresses the source buffer into the destination buffer. The level
13 | parameter has the same meaning as in deflateInit. sourceLen is the byte
14 | length of the source buffer. Upon entry, destLen is the total size of the
15 | destination buffer, which must be at least 0.1% larger than sourceLen plus
16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
17 |
18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer,
20 | Z_STREAM_ERROR if the level parameter is invalid.
21 | */
22 | int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
23 | Bytef *dest;
24 | uLongf *destLen;
25 | const Bytef *source;
26 | uLong sourceLen;
27 | int level;
28 | {
29 | z_stream stream;
30 | int err;
31 | const uInt max = (uInt)-1;
32 | uLong left;
33 |
34 | left = *destLen;
35 | *destLen = 0;
36 |
37 | stream.zalloc = (alloc_func)0;
38 | stream.zfree = (free_func)0;
39 | stream.opaque = (voidpf)0;
40 |
41 | err = deflateInit(&stream, level);
42 | if (err != Z_OK) return err;
43 |
44 | stream.next_out = dest;
45 | stream.avail_out = 0;
46 | stream.next_in = (z_const Bytef *)source;
47 | stream.avail_in = 0;
48 |
49 | do {
50 | if (stream.avail_out == 0) {
51 | stream.avail_out = left > (uLong)max ? max : (uInt)left;
52 | left -= stream.avail_out;
53 | }
54 | if (stream.avail_in == 0) {
55 | stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
56 | sourceLen -= stream.avail_in;
57 | }
58 | err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
59 | } while (err == Z_OK);
60 |
61 | *destLen = stream.total_out;
62 | deflateEnd(&stream);
63 | return err == Z_STREAM_END ? Z_OK : err;
64 | }
65 |
66 | /* ===========================================================================
67 | */
68 | int ZEXPORT compress (dest, destLen, source, sourceLen)
69 | Bytef *dest;
70 | uLongf *destLen;
71 | const Bytef *source;
72 | uLong sourceLen;
73 | {
74 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
75 | }
76 |
77 | /* ===========================================================================
78 | If the default memLevel or windowBits for deflateInit() is changed, then
79 | this function needs to be updated.
80 | */
81 | uLong ZEXPORT compressBound (sourceLen)
82 | uLong sourceLen;
83 | {
84 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
85 | (sourceLen >> 25) + 13;
86 | }
87 |
--------------------------------------------------------------------------------
/deps/zlib/gzclose.c:
--------------------------------------------------------------------------------
1 | /* gzclose.c -- zlib gzclose() function
2 | * Copyright (C) 2004, 2010 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | #include "gzguts.h"
7 |
8 | /* gzclose() is in a separate file so that it is linked in only if it is used.
9 | That way the other gzclose functions can be used instead to avoid linking in
10 | unneeded compression or decompression routines. */
11 | int ZEXPORT gzclose(file)
12 | gzFile file;
13 | {
14 | #ifndef NO_GZCOMPRESS
15 | gz_statep state;
16 |
17 | if (file == NULL)
18 | return Z_STREAM_ERROR;
19 | state = (gz_statep)file;
20 |
21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
22 | #else
23 | return gzclose_r(file);
24 | #endif
25 | }
26 |
--------------------------------------------------------------------------------
/deps/zlib/gzguts.h:
--------------------------------------------------------------------------------
1 | /* gzguts.h -- zlib internal header definitions for gz* operations
2 | * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | #ifdef _LARGEFILE64_SOURCE
7 | # ifndef _LARGEFILE_SOURCE
8 | # define _LARGEFILE_SOURCE 1
9 | # endif
10 | # ifdef _FILE_OFFSET_BITS
11 | # undef _FILE_OFFSET_BITS
12 | # endif
13 | #endif
14 |
15 | #ifdef HAVE_HIDDEN
16 | # define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
17 | #else
18 | # define ZLIB_INTERNAL
19 | #endif
20 |
21 | #include
22 | #include "zlib.h"
23 | #ifdef STDC
24 | # include
25 | # include
26 | # include
27 | #endif
28 |
29 | #ifndef _POSIX_SOURCE
30 | # define _POSIX_SOURCE
31 | #endif
32 | #include
33 |
34 | #ifdef _WIN32
35 | # include
36 | #endif
37 |
38 | #if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
39 | # include
40 | #endif
41 |
42 | #if defined(_WIN32) || defined(__CYGWIN__)
43 | # define WIDECHAR
44 | #endif
45 |
46 | #ifdef WINAPI_FAMILY
47 | # define open _open
48 | # define read _read
49 | # define write _write
50 | # define close _close
51 | #endif
52 |
53 | #ifdef NO_DEFLATE /* for compatibility with old definition */
54 | # define NO_GZCOMPRESS
55 | #endif
56 |
57 | #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
58 | # ifndef HAVE_VSNPRINTF
59 | # define HAVE_VSNPRINTF
60 | # endif
61 | #endif
62 |
63 | #if defined(__CYGWIN__)
64 | # ifndef HAVE_VSNPRINTF
65 | # define HAVE_VSNPRINTF
66 | # endif
67 | #endif
68 |
69 | #if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
70 | # ifndef HAVE_VSNPRINTF
71 | # define HAVE_VSNPRINTF
72 | # endif
73 | #endif
74 |
75 | #ifndef HAVE_VSNPRINTF
76 | # ifdef MSDOS
77 | /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
78 | but for now we just assume it doesn't. */
79 | # define NO_vsnprintf
80 | # endif
81 | # ifdef __TURBOC__
82 | # define NO_vsnprintf
83 | # endif
84 | # ifdef WIN32
85 | /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
86 | # if !defined(vsnprintf) && !defined(NO_vsnprintf)
87 | # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
88 | # define vsnprintf _vsnprintf
89 | # endif
90 | # endif
91 | # endif
92 | # ifdef __SASC
93 | # define NO_vsnprintf
94 | # endif
95 | # ifdef VMS
96 | # define NO_vsnprintf
97 | # endif
98 | # ifdef __OS400__
99 | # define NO_vsnprintf
100 | # endif
101 | # ifdef __MVS__
102 | # define NO_vsnprintf
103 | # endif
104 | #endif
105 |
106 | /* unlike snprintf (which is required in C99), _snprintf does not guarantee
107 | null termination of the result -- however this is only used in gzlib.c where
108 | the result is assured to fit in the space provided */
109 | #if defined(_MSC_VER) && _MSC_VER < 1900
110 | # define snprintf _snprintf
111 | #endif
112 |
113 | #ifndef local
114 | # define local static
115 | #endif
116 | /* since "static" is used to mean two completely different things in C, we
117 | define "local" for the non-static meaning of "static", for readability
118 | (compile with -Dlocal if your debugger can't find static symbols) */
119 |
120 | /* gz* functions always use library allocation functions */
121 | #ifndef STDC
122 | extern voidp malloc OF((uInt size));
123 | extern void free OF((voidpf ptr));
124 | #endif
125 |
126 | /* get errno and strerror definition */
127 | #if defined UNDER_CE
128 | # include
129 | # define zstrerror() gz_strwinerror((DWORD)GetLastError())
130 | #else
131 | # ifndef NO_STRERROR
132 | # include
133 | # define zstrerror() strerror(errno)
134 | # else
135 | # define zstrerror() "stdio error (consult errno)"
136 | # endif
137 | #endif
138 |
139 | /* provide prototypes for these when building zlib without LFS */
140 | #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
141 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
142 | ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
143 | ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
144 | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
145 | #endif
146 |
147 | /* default memLevel */
148 | #if MAX_MEM_LEVEL >= 8
149 | # define DEF_MEM_LEVEL 8
150 | #else
151 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL
152 | #endif
153 |
154 | /* default i/o buffer size -- double this for output when reading (this and
155 | twice this must be able to fit in an unsigned type) */
156 | #define GZBUFSIZE 8192
157 |
158 | /* gzip modes, also provide a little integrity check on the passed structure */
159 | #define GZ_NONE 0
160 | #define GZ_READ 7247
161 | #define GZ_WRITE 31153
162 | #define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
163 |
164 | /* values for gz_state how */
165 | #define LOOK 0 /* look for a gzip header */
166 | #define COPY 1 /* copy input directly */
167 | #define GZIP 2 /* decompress a gzip stream */
168 |
169 | /* internal gzip file state data structure */
170 | typedef struct {
171 | /* exposed contents for gzgetc() macro */
172 | struct gzFile_s x; /* "x" for exposed */
173 | /* x.have: number of bytes available at x.next */
174 | /* x.next: next output data to deliver or write */
175 | /* x.pos: current position in uncompressed data */
176 | /* used for both reading and writing */
177 | int mode; /* see gzip modes above */
178 | int fd; /* file descriptor */
179 | char *path; /* path or fd for error messages */
180 | unsigned size; /* buffer size, zero if not allocated yet */
181 | unsigned want; /* requested buffer size, default is GZBUFSIZE */
182 | unsigned char *in; /* input buffer (double-sized when writing) */
183 | unsigned char *out; /* output buffer (double-sized when reading) */
184 | int direct; /* 0 if processing gzip, 1 if transparent */
185 | /* just for reading */
186 | int how; /* 0: get header, 1: copy, 2: decompress */
187 | z_off64_t start; /* where the gzip data started, for rewinding */
188 | int eof; /* true if end of input file reached */
189 | int past; /* true if read requested past end */
190 | /* just for writing */
191 | int level; /* compression level */
192 | int strategy; /* compression strategy */
193 | /* seek request */
194 | z_off64_t skip; /* amount to skip (already rewound if backwards) */
195 | int seek; /* true if seek request pending */
196 | /* error information */
197 | int err; /* error code */
198 | char *msg; /* error message */
199 | /* zlib inflate or deflate stream */
200 | z_stream strm; /* stream structure in-place (not a pointer) */
201 | } gz_state;
202 | typedef gz_state FAR *gz_statep;
203 |
204 | /* shared functions */
205 | void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
206 | #if defined UNDER_CE
207 | char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
208 | #endif
209 |
210 | /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
211 | value -- needed when comparing unsigned to z_off64_t, which is signed
212 | (possible z_off64_t types off_t, off64_t, and long are all signed) */
213 | #ifdef INT_MAX
214 | # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
215 | #else
216 | unsigned ZLIB_INTERNAL gz_intmax OF((void));
217 | # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
218 | #endif
219 |
--------------------------------------------------------------------------------
/deps/zlib/inffast.h:
--------------------------------------------------------------------------------
1 | /* inffast.h -- header to use inffast.c
2 | * Copyright (C) 1995-2003, 2010 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* WARNING: this file should *not* be used by applications. It is
7 | part of the implementation of the compression library and is
8 | subject to change. Applications should only use zlib.h.
9 | */
10 |
11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
12 |
--------------------------------------------------------------------------------
/deps/zlib/inffixed.h:
--------------------------------------------------------------------------------
1 | /* inffixed.h -- table for decoding fixed codes
2 | * Generated automatically by makefixed().
3 | */
4 |
5 | /* WARNING: this file should *not* be used by applications.
6 | It is part of the implementation of this library and is
7 | subject to change. Applications should only use zlib.h.
8 | */
9 |
10 | static const code lenfix[512] = {
11 | {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
12 | {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
13 | {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
14 | {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
15 | {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
16 | {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
17 | {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
18 | {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
19 | {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
20 | {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
21 | {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
22 | {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
23 | {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
24 | {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
25 | {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
26 | {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
27 | {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
28 | {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
29 | {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
30 | {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
31 | {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
32 | {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
33 | {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
34 | {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
35 | {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
36 | {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
37 | {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
38 | {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
39 | {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
40 | {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
41 | {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
42 | {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
43 | {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
44 | {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
45 | {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
46 | {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
47 | {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
48 | {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
49 | {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
50 | {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
51 | {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
52 | {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
53 | {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
54 | {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
55 | {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
56 | {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
57 | {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
58 | {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
59 | {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
60 | {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
61 | {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
62 | {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
63 | {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
64 | {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
65 | {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
66 | {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
67 | {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
68 | {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
69 | {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
70 | {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
71 | {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
72 | {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
73 | {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
74 | {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
75 | {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
76 | {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
77 | {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
78 | {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
79 | {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
80 | {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
81 | {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
82 | {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
83 | {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
84 | {0,9,255}
85 | };
86 |
87 | static const code distfix[32] = {
88 | {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
89 | {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
90 | {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
91 | {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
92 | {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
93 | {22,5,193},{64,5,0}
94 | };
95 |
--------------------------------------------------------------------------------
/deps/zlib/inflate.h:
--------------------------------------------------------------------------------
1 | /* inflate.h -- internal inflate state definition
2 | * Copyright (C) 1995-2016 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* WARNING: this file should *not* be used by applications. It is
7 | part of the implementation of the compression library and is
8 | subject to change. Applications should only use zlib.h.
9 | */
10 |
11 | /* define NO_GZIP when compiling if you want to disable gzip header and
12 | trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
13 | the crc code when it is not needed. For shared libraries, gzip decoding
14 | should be left enabled. */
15 | #ifndef NO_GZIP
16 | # define GUNZIP
17 | #endif
18 |
19 | /* Possible inflate modes between inflate() calls */
20 | typedef enum {
21 | HEAD = 16180, /* i: waiting for magic header */
22 | FLAGS, /* i: waiting for method and flags (gzip) */
23 | TIME, /* i: waiting for modification time (gzip) */
24 | OS, /* i: waiting for extra flags and operating system (gzip) */
25 | EXLEN, /* i: waiting for extra length (gzip) */
26 | EXTRA, /* i: waiting for extra bytes (gzip) */
27 | NAME, /* i: waiting for end of file name (gzip) */
28 | COMMENT, /* i: waiting for end of comment (gzip) */
29 | HCRC, /* i: waiting for header crc (gzip) */
30 | DICTID, /* i: waiting for dictionary check value */
31 | DICT, /* waiting for inflateSetDictionary() call */
32 | TYPE, /* i: waiting for type bits, including last-flag bit */
33 | TYPEDO, /* i: same, but skip check to exit inflate on new block */
34 | STORED, /* i: waiting for stored size (length and complement) */
35 | COPY_, /* i/o: same as COPY below, but only first time in */
36 | COPY, /* i/o: waiting for input or output to copy stored block */
37 | TABLE, /* i: waiting for dynamic block table lengths */
38 | LENLENS, /* i: waiting for code length code lengths */
39 | CODELENS, /* i: waiting for length/lit and distance code lengths */
40 | LEN_, /* i: same as LEN below, but only first time in */
41 | LEN, /* i: waiting for length/lit/eob code */
42 | LENEXT, /* i: waiting for length extra bits */
43 | DIST, /* i: waiting for distance code */
44 | DISTEXT, /* i: waiting for distance extra bits */
45 | MATCH, /* o: waiting for output space to copy string */
46 | LIT, /* o: waiting for output space to write literal */
47 | CHECK, /* i: waiting for 32-bit check value */
48 | LENGTH, /* i: waiting for 32-bit length (gzip) */
49 | DONE, /* finished check, done -- remain here until reset */
50 | BAD, /* got a data error -- remain here until reset */
51 | MEM, /* got an inflate() memory error -- remain here until reset */
52 | SYNC /* looking for synchronization bytes to restart inflate() */
53 | } inflate_mode;
54 |
55 | /*
56 | State transitions between above modes -
57 |
58 | (most modes can go to BAD or MEM on error -- not shown for clarity)
59 |
60 | Process header:
61 | HEAD -> (gzip) or (zlib) or (raw)
62 | (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->
63 | HCRC -> TYPE
64 | (zlib) -> DICTID or TYPE
65 | DICTID -> DICT -> TYPE
66 | (raw) -> TYPEDO
67 | Read deflate blocks:
68 | TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
69 | STORED -> COPY_ -> COPY -> TYPE
70 | TABLE -> LENLENS -> CODELENS -> LEN_
71 | LEN_ -> LEN
72 | Read deflate codes in fixed or dynamic block:
73 | LEN -> LENEXT or LIT or TYPE
74 | LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
75 | LIT -> LEN
76 | Process trailer:
77 | CHECK -> LENGTH -> DONE
78 | */
79 |
80 | /* State maintained between inflate() calls -- approximately 7K bytes, not
81 | including the allocated sliding window, which is up to 32K bytes. */
82 | struct inflate_state {
83 | z_streamp strm; /* pointer back to this zlib stream */
84 | inflate_mode mode; /* current inflate mode */
85 | int last; /* true if processing last block */
86 | int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
87 | bit 2 true to validate check value */
88 | int havedict; /* true if dictionary provided */
89 | int flags; /* gzip header method and flags (0 if zlib) */
90 | unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
91 | unsigned long check; /* protected copy of check value */
92 | unsigned long total; /* protected copy of output count */
93 | gz_headerp head; /* where to save gzip header information */
94 | /* sliding window */
95 | unsigned wbits; /* log base 2 of requested window size */
96 | unsigned wsize; /* window size or zero if not using window */
97 | unsigned whave; /* valid bytes in the window */
98 | unsigned wnext; /* window write index */
99 | unsigned char FAR *window; /* allocated sliding window, if needed */
100 | /* bit accumulator */
101 | unsigned long hold; /* input bit accumulator */
102 | unsigned bits; /* number of bits in "in" */
103 | /* for string and stored block copying */
104 | unsigned length; /* literal or length of data to copy */
105 | unsigned offset; /* distance back to copy string from */
106 | /* for table and code decoding */
107 | unsigned extra; /* extra bits needed */
108 | /* fixed and dynamic code tables */
109 | code const FAR *lencode; /* starting table for length/literal codes */
110 | code const FAR *distcode; /* starting table for distance codes */
111 | unsigned lenbits; /* index bits for lencode */
112 | unsigned distbits; /* index bits for distcode */
113 | /* dynamic table building */
114 | unsigned ncode; /* number of code length code lengths */
115 | unsigned nlen; /* number of length code lengths */
116 | unsigned ndist; /* number of distance code lengths */
117 | unsigned have; /* number of code lengths in lens[] */
118 | code FAR *next; /* next available space in codes[] */
119 | unsigned short lens[320]; /* temporary storage for code lengths */
120 | unsigned short work[288]; /* work area for code table building */
121 | code codes[ENOUGH]; /* space for code tables */
122 | int sane; /* if false, allow invalid distance too far */
123 | int back; /* bits back of last unprocessed length/lit */
124 | unsigned was; /* initial length of match */
125 | };
126 |
--------------------------------------------------------------------------------
/deps/zlib/inftrees.h:
--------------------------------------------------------------------------------
1 | /* inftrees.h -- header to use inftrees.c
2 | * Copyright (C) 1995-2005, 2010 Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* WARNING: this file should *not* be used by applications. It is
7 | part of the implementation of the compression library and is
8 | subject to change. Applications should only use zlib.h.
9 | */
10 |
11 | /* Structure for decoding tables. Each entry provides either the
12 | information needed to do the operation requested by the code that
13 | indexed that table entry, or it provides a pointer to another
14 | table that indexes more bits of the code. op indicates whether
15 | the entry is a pointer to another table, a literal, a length or
16 | distance, an end-of-block, or an invalid code. For a table
17 | pointer, the low four bits of op is the number of index bits of
18 | that table. For a length or distance, the low four bits of op
19 | is the number of extra bits to get after the code. bits is
20 | the number of bits in this code or part of the code to drop off
21 | of the bit buffer. val is the actual byte to output in the case
22 | of a literal, the base length or distance, or the offset from
23 | the current table to the next table. Each entry is four bytes. */
24 | typedef struct {
25 | unsigned char op; /* operation, extra bits, table bits */
26 | unsigned char bits; /* bits in this part of the code */
27 | unsigned short val; /* offset in table or code value */
28 | } code;
29 |
30 | /* op values as set by inflate_table():
31 | 00000000 - literal
32 | 0000tttt - table link, tttt != 0 is the number of table index bits
33 | 0001eeee - length or distance, eeee is the number of extra bits
34 | 01100000 - end of block
35 | 01000000 - invalid code
36 | */
37 |
38 | /* Maximum size of the dynamic table. The maximum number of code structures is
39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance
40 | codes. These values were found by exhaustive searches using the program
41 | examples/enough.c found in the zlib distribtution. The arguments to that
42 | program are the number of symbols, the initial root table size, and the
43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes
44 | returns returns 852, and "enough 30 6 15" for distance codes returns 592.
45 | The initial root table size (9 or 6) is found in the fifth argument of the
46 | inflate_table() calls in inflate.c and infback.c. If the root table size is
47 | changed, then these maximum sizes would be need to be recalculated and
48 | updated. */
49 | #define ENOUGH_LENS 852
50 | #define ENOUGH_DISTS 592
51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
52 |
53 | /* Type of code to build for inflate_table() */
54 | typedef enum {
55 | CODES,
56 | LENS,
57 | DISTS
58 | } codetype;
59 |
60 | int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
61 | unsigned codes, code FAR * FAR *table,
62 | unsigned FAR *bits, unsigned short FAR *work));
63 |
--------------------------------------------------------------------------------
/deps/zlib/uncompr.c:
--------------------------------------------------------------------------------
1 | /* uncompr.c -- decompress a memory buffer
2 | * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* @(#) $Id$ */
7 |
8 | #define ZLIB_INTERNAL
9 | #include "zlib.h"
10 |
11 | /* ===========================================================================
12 | Decompresses the source buffer into the destination buffer. *sourceLen is
13 | the byte length of the source buffer. Upon entry, *destLen is the total size
14 | of the destination buffer, which must be large enough to hold the entire
15 | uncompressed data. (The size of the uncompressed data must have been saved
16 | previously by the compressor and transmitted to the decompressor by some
17 | mechanism outside the scope of this compression library.) Upon exit,
18 | *destLen is the size of the decompressed data and *sourceLen is the number
19 | of source bytes consumed. Upon return, source + *sourceLen points to the
20 | first unused input byte.
21 |
22 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough
23 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, or
24 | Z_DATA_ERROR if the input data was corrupted, including if the input data is
25 | an incomplete zlib stream.
26 | */
27 | int ZEXPORT uncompress2 (dest, destLen, source, sourceLen)
28 | Bytef *dest;
29 | uLongf *destLen;
30 | const Bytef *source;
31 | uLong *sourceLen;
32 | {
33 | z_stream stream;
34 | int err;
35 | const uInt max = (uInt)-1;
36 | uLong len, left;
37 | Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */
38 |
39 | len = *sourceLen;
40 | if (*destLen) {
41 | left = *destLen;
42 | *destLen = 0;
43 | }
44 | else {
45 | left = 1;
46 | dest = buf;
47 | }
48 |
49 | stream.next_in = (z_const Bytef *)source;
50 | stream.avail_in = 0;
51 | stream.zalloc = (alloc_func)0;
52 | stream.zfree = (free_func)0;
53 | stream.opaque = (voidpf)0;
54 |
55 | err = inflateInit(&stream);
56 | if (err != Z_OK) return err;
57 |
58 | stream.next_out = dest;
59 | stream.avail_out = 0;
60 |
61 | do {
62 | if (stream.avail_out == 0) {
63 | stream.avail_out = left > (uLong)max ? max : (uInt)left;
64 | left -= stream.avail_out;
65 | }
66 | if (stream.avail_in == 0) {
67 | stream.avail_in = len > (uLong)max ? max : (uInt)len;
68 | len -= stream.avail_in;
69 | }
70 | err = inflate(&stream, Z_NO_FLUSH);
71 | } while (err == Z_OK);
72 |
73 | *sourceLen -= len + stream.avail_in;
74 | if (dest != buf)
75 | *destLen = stream.total_out;
76 | else if (stream.total_out && err == Z_BUF_ERROR)
77 | left = 1;
78 |
79 | inflateEnd(&stream);
80 | return err == Z_STREAM_END ? Z_OK :
81 | err == Z_NEED_DICT ? Z_DATA_ERROR :
82 | err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR :
83 | err;
84 | }
85 |
86 | int ZEXPORT uncompress (dest, destLen, source, sourceLen)
87 | Bytef *dest;
88 | uLongf *destLen;
89 | const Bytef *source;
90 | uLong sourceLen;
91 | {
92 | return uncompress2(dest, destLen, source, &sourceLen);
93 | }
94 |
--------------------------------------------------------------------------------
/deps/zlib/zutil.h:
--------------------------------------------------------------------------------
1 | /* zutil.h -- internal interface and configuration of the compression library
2 | * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* WARNING: this file should *not* be used by applications. It is
7 | part of the implementation of the compression library and is
8 | subject to change. Applications should only use zlib.h.
9 | */
10 |
11 | /* @(#) $Id$ */
12 |
13 | #ifndef ZUTIL_H
14 | #define ZUTIL_H
15 |
16 | #ifdef HAVE_HIDDEN
17 | # define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
18 | #else
19 | # define ZLIB_INTERNAL
20 | #endif
21 |
22 | #include "zlib.h"
23 |
24 | #if defined(STDC) && !defined(Z_SOLO)
25 | # if !(defined(_WIN32_WCE) && defined(_MSC_VER))
26 | # include
27 | # endif
28 | # include
29 | # include
30 | #endif
31 |
32 | #ifdef Z_SOLO
33 | typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
34 | #endif
35 |
36 | #ifndef local
37 | # define local static
38 | #endif
39 | /* since "static" is used to mean two completely different things in C, we
40 | define "local" for the non-static meaning of "static", for readability
41 | (compile with -Dlocal if your debugger can't find static symbols) */
42 |
43 | typedef unsigned char uch;
44 | typedef uch FAR uchf;
45 | typedef unsigned short ush;
46 | typedef ush FAR ushf;
47 | typedef unsigned long ulg;
48 |
49 | extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
50 | /* (size given to avoid silly warnings with Visual C++) */
51 |
52 | #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
53 |
54 | #define ERR_RETURN(strm,err) \
55 | return (strm->msg = ERR_MSG(err), (err))
56 | /* To be used only when the state is known to be valid */
57 |
58 | /* common constants */
59 |
60 | #ifndef DEF_WBITS
61 | # define DEF_WBITS MAX_WBITS
62 | #endif
63 | /* default windowBits for decompression. MAX_WBITS is for compression only */
64 |
65 | #if MAX_MEM_LEVEL >= 8
66 | # define DEF_MEM_LEVEL 8
67 | #else
68 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL
69 | #endif
70 | /* default memLevel */
71 |
72 | #define STORED_BLOCK 0
73 | #define STATIC_TREES 1
74 | #define DYN_TREES 2
75 | /* The three kinds of block type */
76 |
77 | #define MIN_MATCH 3
78 | #define MAX_MATCH 258
79 | /* The minimum and maximum match lengths */
80 |
81 | #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
82 |
83 | /* target dependencies */
84 |
85 | #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
86 | # define OS_CODE 0x00
87 | # ifndef Z_SOLO
88 | # if defined(__TURBOC__) || defined(__BORLANDC__)
89 | # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
90 | /* Allow compilation with ANSI keywords only enabled */
91 | void _Cdecl farfree( void *block );
92 | void *_Cdecl farmalloc( unsigned long nbytes );
93 | # else
94 | # include
95 | # endif
96 | # else /* MSC or DJGPP */
97 | # include
98 | # endif
99 | # endif
100 | #endif
101 |
102 | #ifdef AMIGA
103 | # define OS_CODE 1
104 | #endif
105 |
106 | #if defined(VAXC) || defined(VMS)
107 | # define OS_CODE 2
108 | # define F_OPEN(name, mode) \
109 | fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
110 | #endif
111 |
112 | #ifdef __370__
113 | # if __TARGET_LIB__ < 0x20000000
114 | # define OS_CODE 4
115 | # elif __TARGET_LIB__ < 0x40000000
116 | # define OS_CODE 11
117 | # else
118 | # define OS_CODE 8
119 | # endif
120 | #endif
121 |
122 | #if defined(ATARI) || defined(atarist)
123 | # define OS_CODE 5
124 | #endif
125 |
126 | #ifdef OS2
127 | # define OS_CODE 6
128 | # if defined(M_I86) && !defined(Z_SOLO)
129 | # include
130 | # endif
131 | #endif
132 |
133 | #if defined(MACOS) || defined(TARGET_OS_MAC)
134 | # define OS_CODE 7
135 | # ifndef Z_SOLO
136 | # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
137 | # include /* for fdopen */
138 | # else
139 | # ifndef fdopen
140 | # define fdopen(fd,mode) NULL /* No fdopen() */
141 | # endif
142 | # endif
143 | # endif
144 | #endif
145 |
146 | #ifdef __acorn
147 | # define OS_CODE 13
148 | #endif
149 |
150 | #if defined(WIN32) && !defined(__CYGWIN__)
151 | # define OS_CODE 10
152 | #endif
153 |
154 | #ifdef _BEOS_
155 | # define OS_CODE 16
156 | #endif
157 |
158 | #ifdef __TOS_OS400__
159 | # define OS_CODE 18
160 | #endif
161 |
162 | #ifdef __APPLE__
163 | # define OS_CODE 19
164 | #endif
165 |
166 | #if defined(_BEOS_) || defined(RISCOS)
167 | # define fdopen(fd,mode) NULL /* No fdopen() */
168 | #endif
169 |
170 | #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
171 | # if defined(_WIN32_WCE)
172 | # define fdopen(fd,mode) NULL /* No fdopen() */
173 | # ifndef _PTRDIFF_T_DEFINED
174 | typedef int ptrdiff_t;
175 | # define _PTRDIFF_T_DEFINED
176 | # endif
177 | # else
178 | # define fdopen(fd,type) _fdopen(fd,type)
179 | # endif
180 | #endif
181 |
182 | #if defined(__BORLANDC__) && !defined(MSDOS)
183 | #pragma warn -8004
184 | #pragma warn -8008
185 | #pragma warn -8066
186 | #endif
187 |
188 | /* provide prototypes for these when building zlib without LFS */
189 | #if !defined(_WIN32) && \
190 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
191 | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
192 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
193 | #endif
194 |
195 | /* common defaults */
196 |
197 | #ifndef OS_CODE
198 | # define OS_CODE 3 /* assume Unix */
199 | #endif
200 |
201 | #ifndef F_OPEN
202 | # define F_OPEN(name, mode) fopen((name), (mode))
203 | #endif
204 |
205 | /* functions */
206 |
207 | #if defined(pyr) || defined(Z_SOLO)
208 | # define NO_MEMCPY
209 | #endif
210 | #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
211 | /* Use our own functions for small and medium model with MSC <= 5.0.
212 | * You may have to use the same strategy for Borland C (untested).
213 | * The __SC__ check is for Symantec.
214 | */
215 | # define NO_MEMCPY
216 | #endif
217 | #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
218 | # define HAVE_MEMCPY
219 | #endif
220 | #ifdef HAVE_MEMCPY
221 | # ifdef SMALL_MEDIUM /* MSDOS small or medium model */
222 | # define zmemcpy _fmemcpy
223 | # define zmemcmp _fmemcmp
224 | # define zmemzero(dest, len) _fmemset(dest, 0, len)
225 | # else
226 | # define zmemcpy memcpy
227 | # define zmemcmp memcmp
228 | # define zmemzero(dest, len) memset(dest, 0, len)
229 | # endif
230 | #else
231 | void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
232 | int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
233 | void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
234 | #endif
235 |
236 | /* Diagnostic functions */
237 | #ifdef ZLIB_DEBUG
238 | # include
239 | extern int ZLIB_INTERNAL z_verbose;
240 | extern void ZLIB_INTERNAL z_error OF((char *m));
241 | # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
242 | # define Trace(x) {if (z_verbose>=0) fprintf x ;}
243 | # define Tracev(x) {if (z_verbose>0) fprintf x ;}
244 | # define Tracevv(x) {if (z_verbose>1) fprintf x ;}
245 | # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
246 | # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
247 | #else
248 | # define Assert(cond,msg)
249 | # define Trace(x)
250 | # define Tracev(x)
251 | # define Tracevv(x)
252 | # define Tracec(c,x)
253 | # define Tracecv(c,x)
254 | #endif
255 |
256 | #ifndef Z_SOLO
257 | voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
258 | unsigned size));
259 | void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
260 | #endif
261 |
262 | #define ZALLOC(strm, items, size) \
263 | (*((strm)->zalloc))((strm)->opaque, (items), (size))
264 | #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
265 | #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
266 |
267 | /* Reverse the bytes in a 32-bit value */
268 | #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
269 | (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
270 |
271 | #endif /* ZUTIL_H */
272 |
--------------------------------------------------------------------------------
/dynation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vertver/Dynation/ac4a2f7b53fb204fae1a5f94125111e2fd2b0506/dynation.png
--------------------------------------------------------------------------------
/src/Allocator.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "VST2_Header.h"
3 |
4 | class CHeapAllocator
5 | {
6 | public:
7 | void* Alloc(size_t SizeOfPointer)
8 | {
9 | void* pRet = nullptr;
10 | #ifdef WIN32
11 | pRet = HeapAlloc(GetProcessHeap(), 0, SizeOfPointer);
12 | #else
13 | pRet = malloc(SizeOfPointer);
14 | #endif
15 | memset(pRet, 0, SizeOfPointer);
16 | return pRet;
17 | }
18 |
19 | bool Delete(void* pPointer)
20 | {
21 | if (pPointer)
22 | {
23 | try
24 | {
25 | #ifdef WIN32
26 | return !!HeapFree(GetProcessHeap(), 0, pPointer);
27 | #else
28 | free(pPointer);
29 | return true;
30 | #endif
31 | }
32 | catch (...)
33 | {
34 | return false;
35 | }
36 | }
37 |
38 | return false;
39 | }
40 | };
41 |
--------------------------------------------------------------------------------
/src/ImGui_Tools1.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace ImGui {
4 | bool KnobFloat(const char* label, float* p_value, float v_min, float v_max,float v_step, float radius_outer = 20.0f);
5 |
6 | }
7 |
8 | #define SynthUI_Width (100)
9 | #define SynthUI_Width2 (70)
10 |
11 | #define SynthUI_ID_AUTO -1
12 | #define SynthUI_blockpadding 2
13 |
14 |
15 | #define SynthUI_ADSR_LOG_MIN -4.605170 // log (0.01);
16 | #define SynthUI_ADSR_LOG_MAX 9.21034 // log (10000);
17 | #define SynthUI_ADSR_LOG_RAGE ((SynthUI_ADSR_LOG_MAX - SynthUI_ADSR_LOG_MIN)/(1.0 - 0.0))
18 | // сделал не экспонентой такк она слишком быстрая а просто 3 степенью
19 | #define SynthUI_ADSR_LOG_TO_LINE(POS_0_1) (f32)(POS_0_1*POS_0_1*POS_0_1*0.99*10000) // (exp(SynthUI_ADSR_LOG_MIN + SynthUI_ADSR_LOG_RAGE*POS_0_1) )
20 | #define SynthUI_ADSR_LINE_TO_LOG_(inval) (f32)(pow(inval/10000.0/0.99, 1.0/3.0)) // ((log(inval) - SynthUI_ADSR_LOG_MIN) / SynthUI_ADSR_LOG_RAGE)
21 | #define SynthUI_ADSR_SLIDER_H 130
22 | #define SynthUI_ADSR_SLIDER_W 18
23 |
24 |
25 | i32 SynthUI_ID(PConstStr Name, u32 Adduid);
26 |
27 | // блоки с разными содержимым
28 | void SynthUI_Block_Begin();
29 | void SynthUI_Block_End(bool border=true);
30 | void SynthUI_Block_Column();//следущий блок в строку
31 | void SynthUI_Block_Line();//следущий блок с новой линни
32 |
33 | bool SynthUI_ButtonCheck(PConstStr Name, i32 ID, bool* State);
34 | bool SynthUI_VSlider(PConstStr Name, i32 ID, f32* State, f32 min=0.0, f32 max=1.0);
35 |
36 |
37 | bool SynthUI_ADSR_Logarithmic(PConstStr Name, i32 ID, f32* A, f32* D, f32* S, f32* R);
38 |
39 | bool SynthUI_FILTER(PConstStr Name, i32 ID, u32* typewave, f32* cutoff, f32* reson, bool* srez24db);
40 |
41 |
42 | bool SynthUI_OptionsUp(PConstStr Name, i32 ID, u32* Polyphone, u32* Voices_); //todooooos
43 |
44 | bool SynthUI_OSC(PConstStr Name, i32 ID,
45 | i32* Main_Voices,
46 | i32* Main_NoteNumberAdd,
47 | i32* Main_NoteOctaveAdd,
48 | i32* Main_WaveForm,
49 | f32* Main_Volume,
50 | f32* Main_Pan,
51 | f32* Main_SideScale,
52 | f32* Main_Phase,
53 | f32* Main_Detune,
54 | f32* Main_FinePitch,
55 | bool* Main_Inverse,
56 | bool* Main_Retring
57 | );
58 |
59 |
--------------------------------------------------------------------------------
/src/PopOutList.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "VST2_Header.h"
3 | #include "Allocator.h"
4 |
5 | class CPopOutList
6 | {
7 | public:
8 | CPopOutList()
9 | {
10 | for (size_t i = 0; i < sizeof(StringsArray) / sizeof(void*); i++)
11 | {
12 | StringsArray[i] = nullptr;
13 | }
14 | }
15 |
16 | void AddMember(const char* String)
17 | {
18 | if (StringCount >= sizeof(StringsArray) / sizeof(void*)) return;
19 |
20 | // load string to string array
21 | size_t stringSize = strlen(String);
22 | StringsArray[StringCount] = (char*)heap.Alloc(stringSize + 1);
23 | memcpy(StringsArray[StringCount], String, stringSize);
24 | }
25 |
26 | #ifdef WIN32
27 | void DrawList(void* pHandle, int x, int y)
28 | {
29 | HWND hwnd = (HWND)pHandle;
30 | HMENU hMenu = CreatePopupMenu();
31 |
32 | // load all items to menu
33 | for (size_t i = 0; i < StringCount; i++)
34 | {
35 | AppendMenuA(hMenu, MF_STRING, 0xF500 + i, StringsArray[i]);
36 | }
37 |
38 | // process by proc menu
39 | TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, hwnd, nullptr);
40 |
41 | // destroy menu
42 | DestroyMenu(hMenu);
43 | }
44 | #else
45 |
46 | #endif
47 |
48 | ~CPopOutList()
49 | {
50 | // free all stuff
51 | for (size_t i = 0; i < StringCount; i++)
52 | {
53 | heap.Delete(StringsArray[i]);
54 | }
55 | }
56 |
57 | private:
58 | CHeapAllocator heap;
59 | char* StringsArray[96];
60 | size_t StringCount;
61 | };
--------------------------------------------------------------------------------
/src/VST2_Base_UI_UVMetter_Imp.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define IMGUI_LEVELS_PART1_PERCENT 0.50f
4 | #define IMGUI_LEVELS_PART2_PERCENT 0.90f
5 |
6 | ImU32 InterpColor( ImU32 A, ImU32 B, f32 ff ) {
7 | u8 RA = A & 0xFF;
8 | u8 GA = (A >> 8) & 0xFF;
9 | u8 BA = (A >> 16) & 0xFF;
10 |
11 | u8 AA = (A >> 24) & 0xFF;
12 |
13 | u8 RB = B & 0xFF;
14 | u8 GB = (B >> 8) & 0xFF;
15 | u8 BB = (B >> 16) & 0xFF;
16 |
17 | u8 RC = RA + (RB - RA)*ff;
18 | u8 GC = GA + (GB - GA)*ff;
19 | u8 BC = BA + (BB - BA)*ff;
20 | return (AA << 24) | (BC << 16) | (GC << 8) | RC;
21 | }
22 |
23 |
24 | void ImGui_Levels_(
25 | ImVec2 PosStart, ImVec2 PosEnd,
26 | f32 LinearLevel, f32 PeakLevel, bool PeakL,
27 | ImU32 Color1, ImU32 Color2,
28 | ImU32 Color3, ImU32 Color4,
29 | ImU32 Color5, ImU32 Color6
30 | )
31 | {
32 | ImDrawList* DrawList = ImGui::GetWindowDrawList();
33 | f32 W = PosEnd.x - PosStart.x;
34 | f32 H = PosEnd.y - PosStart.y;
35 | f32 PeakInvHeight = H * 0.5 * 0.01;
36 | f32 LevelsX = PosStart.x;
37 | f32 LevelsY = PosStart.y + PeakInvHeight;
38 | f32 LevelsX2 = PosEnd.x;
39 | f32 LevelsY2 = PosEnd.y;
40 |
41 | // draw level L R
42 | ImU32 ColorMin, ColorMax;
43 | ImVec2 LevelLStart, LevelLEnd, LevelRStart, LevelREnd;
44 |
45 | f32 Part0Scale = min(1.0f, max(0.0f, LinearLevel)*(1.0f / IMGUI_LEVELS_PART1_PERCENT));
46 | f32 Part1Scale = min(1.0f, max(0.0f, LinearLevel - IMGUI_LEVELS_PART1_PERCENT)*(1.0f / (IMGUI_LEVELS_PART2_PERCENT - IMGUI_LEVELS_PART1_PERCENT)));
47 | f32 Part2Scale = min(1.0f, max(0.0f, LinearLevel - IMGUI_LEVELS_PART2_PERCENT)*(1.0f / (1.00f - IMGUI_LEVELS_PART2_PERCENT)));
48 |
49 | f32 Part0SizeScale = 1.0 - min(IMGUI_LEVELS_PART1_PERCENT, LinearLevel);
50 | f32 Part1SizeScale = 1.0 - min(IMGUI_LEVELS_PART2_PERCENT, LinearLevel);
51 | f32 Part2SizeScale = 1.0 - LinearLevel;
52 |
53 | ColorMin = Color1;
54 | ColorMax = InterpColor(Color1, Color2, Part0Scale);
55 |
56 | LevelLStart = ImVec2(LevelsX, LevelsY2);
57 | LevelLEnd = ImVec2(LevelsX2, LevelsY + (LevelsY2 - LevelsY)*Part0SizeScale);
58 |
59 | DrawList->AddRectFilledMultiColor(LevelLStart, LevelLEnd, ColorMin, ColorMin, ColorMax, ColorMax);
60 |
61 | // 2
62 | if (LinearLevel > IMGUI_LEVELS_PART1_PERCENT) {
63 | ColorMin = Color3;
64 | ColorMax = InterpColor(Color3, Color4, Part1Scale);
65 |
66 | LevelLStart = ImVec2(LevelsX, LevelsY + (LevelsY2 - LevelsY)*Part0SizeScale);
67 | LevelLEnd = ImVec2(LevelsX2, LevelsY + (LevelsY2 - LevelsY)*Part1SizeScale);
68 |
69 | DrawList->AddRectFilledMultiColor(LevelLStart, LevelLEnd, ColorMin, ColorMin, ColorMax, ColorMax);
70 | }
71 |
72 | // 3
73 | if (LinearLevel > IMGUI_LEVELS_PART2_PERCENT) {
74 | ColorMin = Color5;
75 | ColorMax = InterpColor(Color5, Color6, Part2Scale);
76 |
77 | LevelLStart = ImVec2(LevelsX, LevelsY + (LevelsY2 - LevelsY)*Part1SizeScale);
78 | LevelLEnd = ImVec2(LevelsX2, LevelsY + (LevelsY2 - LevelsY)*Part2SizeScale);
79 |
80 | DrawList->AddRectFilledMultiColor(LevelLStart, LevelLEnd, ColorMin, ColorMin, ColorMax, ColorMax);
81 | }
82 |
83 | // draw peeak level
84 | DrawList->AddLine(
85 | ImVec2(LevelsX-1, LevelsY + (LevelsY2 - LevelsY)*(1.0 - PeakLevel)),
86 | ImVec2(LevelsX2-1, LevelsY + (LevelsY2 - LevelsY)*(1.0 - PeakLevel)),
87 | ImColor(220, 220, 220),
88 | H * 0.5 * 0.01
89 | );
90 |
91 | // draw peek
92 | if (PeakL) DrawList->AddRectFilled(
93 | ImVec2(LevelsX, LevelsY - PeakInvHeight),
94 | ImVec2(LevelsX2, LevelsY),
95 | ImColor(245, 70, 70)
96 | );
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/src/VST2_Header.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #ifdef WIN32
3 | #pragma warning (disable : 4244)
4 | #pragma warning (disable : 4305)
5 | #endif
6 |
7 | #include "audioeffectx.h"
8 | #include "aeffeditor.h"
9 |
10 | #ifdef WIN32
11 | #include
12 | #else
13 |
14 | #endif
15 | #include
16 | #include
17 | #include "VST2_Types.h"
18 |
19 | inline bool ErrorMessage( PConstStr Str ) {
20 | const char* HeaderString = "Critical error";
21 |
22 | #ifdef WIN32
23 | DebugBreak();
24 | return (MessageBoxA(NULL, Str, HeaderString, MB_OKCANCEL | MB_ICONHAND) == IDCANCEL);
25 | #else
26 | CFOptionFlags result;
27 |
28 | // Create string reference
29 | CFStringRef HeaderRef = CFStringCreateWithCString(NULL, HeaderString, strlen(HeaderString));
30 | CFStringRef MessageRef = CFStringCreateWithCString(NULL, Str, strlen(Str));
31 |
32 | // Message box
33 | CFUserNotificationDisplayAlert(0, kCFUserNotificationNoteAlertLevel, NULL, NULL, NULL, HeaderRef, MessageRef, NULL, CFSTR("Cancel"), NULL, &result);
34 |
35 | if (HeaderRef) CFRelease(HeaderRef);
36 | if (MessageRef) CFRelease(MessageRef);
37 |
38 | return (result != kCFUserNotificationDefaultResponse);
39 | #endif
40 | }
41 |
42 | #if 0
43 | #include
44 | #include "glext.h"
45 | #pragma comment(lib, "opengl32.lib")
46 | typedef void (APIENTRY *PFNWGLEXTSWAPCONTROLPROC) (int);
47 | typedef int(*PFNWGLEXTGETSWAPINTERVALPROC) (void);
48 | typedef void (APIENTRY *__MYGLEXTFP_GLGENERATEMIPMAPS)(GLenum);
49 | #endif
50 |
51 | #ifdef WIN32
52 | #include
53 | #include
54 | #pragma comment(lib, "d3d11.lib")
55 | #pragma comment(lib, "d3dcompiler.lib")
56 | #endif
57 |
58 | #include "imgui.h"
59 | #define IMGUI_DEFINE_MATH_OPERATORS
60 | #define USE_INTRINSICS
61 | #include "imgui_internal.h"
62 |
63 | #define ImVec4ColorA(r, g, b, a) ImVec4((f32)r/256.0f, (f32)g/256.0f, (f32)b/256.0f, (f32)a/256.0f);
64 | #define ImVec4Color(r, g, b) ImVec4ColorA(r, g, b, 255)
65 |
66 | #include "ImGui_Tools1.h"
67 |
68 | #include "VST2_Base.h"
69 | #ifdef USE_INTRINSICS
70 | #include
71 | #endif
72 |
73 | class StaticCS {
74 | public:
75 | #ifdef WIN32
76 | CRITICAL_SECTION CS;
77 |
78 | StaticCS( ) {
79 | InitializeCriticalSection (&CS);
80 | }
81 | ~StaticCS(){
82 | DeleteCriticalSection( &CS);
83 | }
84 |
85 | bool Try( ) {
86 | if ( TryEnterCriticalSection( &CS ) == 0 ) return false;
87 | return true;
88 | };
89 |
90 | void Lock( ) {
91 | //if ( TryEnterCriticalSection( &CS ) == 0 )
92 | EnterCriticalSection( &CS );
93 | };
94 |
95 | void Unlock( ) {
96 | LeaveCriticalSection( &CS );
97 | };
98 | #else
99 | pthread_mutex_t Mutex;
100 |
101 | StaticCS() {
102 | pthread_mutex_init(&Mutex, NULL);
103 | }
104 | ~StaticCS() {
105 | pthread_mutex_destroy(&Mutex);
106 | }
107 |
108 | bool Try() {
109 | pthread_mutex_trylock(&Mutex);
110 | };
111 |
112 | void Lock() {
113 | pthread_mutex_lock(&Mutex);
114 | };
115 |
116 | void Unlock() {
117 | pthread_mutex_unlock(&Mutex);
118 | };
119 | #endif
120 | };
121 |
122 | #ifndef DBL_EPSILON
123 | #define DBL_EPSILON 2.2204460492503131e-16
124 | #endif
125 | #ifndef FLT_EPSILON
126 | #define FLT_EPSILON 1.19209290e-7f
127 | #endif
128 |
129 | #ifndef M_PI
130 | #define M_PI 3.1415926535897932384626433832795
131 | #endif
132 |
133 | #ifndef M_SQRT2
134 | #define M_SQRT2 1.4142135623730950488016887
135 | #endif
136 |
137 | #ifndef M_2PI
138 | #define M_2PI 6.283185307179586476925286766559005
139 | #endif
140 |
141 | #ifndef M_SQRT1_2
142 | #define M_SQRT1_2 0.7071067811865475244008443621048490
143 | #endif
144 |
145 | #ifndef M_LOG_2PI
146 | #define M_LOG_2PI 1.8378770664093454835606594728112
147 | #endif
148 |
149 | #ifndef M_LN2
150 | #define M_LN2 0.693147180559945309417232121458
151 | #endif
152 |
153 | #ifndef M_LN10
154 | #define M_LN10 2.302585092994045684017991454684
155 | #endif
--------------------------------------------------------------------------------
/src/VST2_Types.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | typedef signed char i8;
4 | typedef unsigned char u8;
5 | typedef signed short i16;
6 | typedef unsigned short u16;
7 | typedef signed int i32;
8 | typedef unsigned int u32;
9 | typedef signed long long i64;
10 | typedef unsigned long long u64;
11 | typedef float f32;
12 | typedef double f64;
13 |
14 | typedef signed char s8;
15 | typedef signed short s16;
16 | typedef signed int s32;
17 | typedef signed long long s64;
18 |
19 | typedef u64 uint64;
20 | typedef i8 int8;
21 | typedef i16 int16;
22 | typedef i64 int64;
23 | typedef f32 r32;
24 | typedef f64 r64;
25 | typedef i32 b32;
26 | typedef f64 real64;
27 |
28 | typedef char utf8;
29 | typedef utf8* PStr;
30 | typedef utf8 const* PConstStr;
31 |
32 | //#ifdef OS_WINDOW
33 | // #define MAX_PATH 260
34 | // typedef wchar_t utf16;
35 | // typedef utf8 stringPath[MAX_PATH];
36 | // typedef utf8 stringName[MAX_PATH];
37 | // typedef utf16 wstringPath[MAX_PATH];
38 | //#else
39 | // #define PATH_MAX 4096
40 | // #define NAME_MAX 256
41 | // typedef u16 utf16;
42 | // typedef utf8 stringPath[PATH_MAX];
43 | // typedef utf8 stringName[NAME_MAX];
44 | //#endif
45 | //
46 | //typedef utf16* PWStr;
47 | //typedef utf16 const* PConstWStr;
48 |
49 | typedef utf8 string16[16];
50 | typedef utf8 string32[32];
51 | typedef utf8 string64[64];
52 | typedef utf8 string128[128];
53 | typedef utf8 string256[256];
54 | typedef utf8 string512[512];
55 | typedef utf8 string1k[1024];
56 | typedef utf8 string2k[2048];
57 | typedef utf8 string4k[4096];
58 | typedef utf8 string8k[8192];
59 | typedef utf8 string16k[16384];
60 | typedef utf8 string32k[32768];
61 | typedef utf8 string64k[65536];
62 |
63 | //typedef utf16 wstring16[16];
64 | //typedef utf16 wstring32[32];
65 | //typedef utf16 wstring64[64];
66 | //typedef utf16 wstring128[128];
67 | //typedef utf16 wstring256[256];
68 | //typedef utf16 wstring512[512];
69 | //typedef utf16 wstring1k[1024];
70 | //typedef utf16 wstring2k[2048];
71 | //typedef utf16 wstring4k[4096];
72 | //typedef utf16 wstring8k[8192];
73 | //typedef utf16 wstring16k[16384];
74 | //typedef utf16 wstring32k[32768];
75 | //typedef utf16 wstring64k[65536];
76 |
--------------------------------------------------------------------------------
/src/dynation/BaseEffect.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Header.h"
3 |
4 | class CEffect
5 | {
6 | public:
7 | virtual void Process(PROCESS_DATA* processData) = 0;
8 | virtual void ProcessDouble(PROCESS_DATA_DOUBLE* processData) = 0;
9 | virtual void SetEffectParameter(void* pParam) = 0;
10 | };
11 |
--------------------------------------------------------------------------------
/src/dynation/BitCrusher.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "VST2_Header.h"
3 |
4 | #define ROUND(f) ((f32)((f > 0.0) ? floor(f + 0.5) : ceil(f - 0.5)))
5 | #define ROUNDD(f) ((f64)((f > 0.0) ? floor(f + 0.5) : ceil(f - 0.5)))
6 |
7 | struct BITCRUSHER_PARAMETER
8 | {
9 | f32* fSampleRate;
10 | f32* fGlobalRate;
11 | f32* fCurve;
12 | f32* fBits;
13 | f32* fDriveLevel;
14 | };
15 |
16 | class CBitcrusher
17 | {
18 | public:
19 | BITCRUSHER_PARAMETER* CurrentParams;
20 | i32 SamplesAdd[8];
21 |
22 | void Process(PROCESS_DATA* processData)
23 | {
24 | f32& BitLevel = *CurrentParams->fBits;
25 | f32& CurrentSampleRate = *CurrentParams->fGlobalRate;
26 | f32& SampleRateLevel = *CurrentParams->fSampleRate;
27 | f32& DriveLevel = *CurrentParams->fDriveLevel;
28 | f32& CurveLevel = *CurrentParams->fCurve;
29 | f32 TempX = 0.;
30 | f32* OutCh = nullptr;
31 |
32 | for (u32 o = 0; o < processData->ChannelsCount; o++)
33 | {
34 | // bit shift
35 | OutCh = processData->Out[o];
36 | int max = int(BitLevel * BitLevel) - 1;
37 | int step = CurrentSampleRate / SampleRateLevel;
38 | if (!step) step = 1;
39 | f32 FirstSample = 0;
40 | f32 expX = 0;
41 | f32 temp = 0;
42 | for (u32 i = 0; i < processData->SamplesCount; i++)
43 | {
44 | f32 boostValue = (DriveLevel * 3.14159265358979323846f + 1);
45 | TempX = OutCh[i];
46 |
47 | TempX *= boostValue;
48 |
49 | f32 expX = expf(TempX);
50 | f32 temp = 1 + expf(sqrtf(fabsf(TempX)) * CurveLevel);
51 |
52 | OutCh[i] = (expX - expf(-TempX * temp)) / (expX + expf(-TempX));
53 |
54 | float DestructorValue = CurveLevel * (powf(2, logf(temp)));
55 | OutCh[i] /= boostValue;
56 | //OutCh[i] = sign(OutCh[i]) * (fabsf(OutCh[i]) - DestructorValue);
57 | OutCh[i] = sinf(sinf(OutCh[i])); // +1dB limiting
58 | }
59 | }
60 | }
61 |
62 | void ProcessDouble(PROCESS_DATA_DOUBLE* processData)
63 | {
64 | f32& BitLevel = *CurrentParams->fBits;
65 | f32& CurrentSampleRate = *CurrentParams->fGlobalRate;
66 | f32& SampleRateLevel = *CurrentParams->fSampleRate;
67 | f32& DriveLevel = *CurrentParams->fDriveLevel;
68 | f32& CurveLevel = *CurrentParams->fCurve;
69 | f32 TempX = 0.;
70 | f64* OutCh = nullptr;
71 |
72 | for (u32 o = 0; o < processData->ChannelsCount; o++)
73 | {
74 | // bit shift
75 | OutCh = processData->Out[o];
76 | int max = pow(2, BitLevel) - 1;
77 | int step = CurrentSampleRate / SampleRateLevel;
78 | if (!step) step = 1;
79 | f64 FirstSample = 0;
80 | f64 expX = 0;
81 | f64 temp = 0;
82 |
83 | FirstSample = ROUNDD((OutCh[0] + 1.0) * max) / max - 1.0;
84 |
85 | for (u32 i = 0; i < processData->SamplesCount; i++)
86 | {
87 | TempX = OutCh[i] * (DriveLevel * 3.14159265358979323846 + 1);
88 |
89 | expX = exp(TempX);
90 | temp = 1 + exp(sqrt(fabs(TempX)) * CurveLevel);
91 | OutCh[i] = sin((expX - exp(-TempX * temp)) / (expX + exp(-TempX)));
92 |
93 | if (SamplesAdd[o] == 0)
94 | {
95 | FirstSample = ROUNDD((OutCh[i] + 1.0) * max) / max - 1.0;
96 | }
97 |
98 | // Каждый раз перед процессом не забыть занулять это хуету, а то пиздой биткрашер пойдет
99 | SamplesAdd[o] = (SamplesAdd[o] + 1) % step;
100 | OutCh[i] = FirstSample;
101 | }
102 | }
103 | }
104 |
105 | void SetEffectParameter(void* pParam)
106 | {
107 | CurrentParams = (BITCRUSHER_PARAMETER*)pParam;
108 | }
109 | };
110 |
--------------------------------------------------------------------------------
/src/dynation/CompressorA.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define COMPRESSORDC FLT_EPSILON
4 |
5 | class CompressorA {
6 | public:
7 | void Update( f32 Samplerate, f32 At, f32 Rel, f32 Threshold_, f32 Ratio_) {
8 | KAttack = At == 0.0f ? 0.0 : (f32) exp(-1.0/(Samplerate*At));
9 | KRelease = Rel == 0.0f ? 0.0 : (f32) exp(-1.0/(Samplerate*Rel));
10 | Threshold = Threshold_;
11 | ThresholdDB = lin2dB(Threshold) - 3; // fix th
12 | Ratio = (1.0f - 1.0f/(Ratio_));
13 | }
14 |
15 | void Reset( f32 Samplerate, f32 At, f32 Rel, f32 Threshold_, f32 Ratio_ ) {
16 | Update( Samplerate, At, Rel, Threshold_, Ratio_);
17 | Envelope = COMPRESSORDC;
18 | }
19 |
20 | f64 NextSampleRMS( f64 InRms ) { // return output scale
21 | f64 InRmsDB = lin2dB(InRms + COMPRESSORDC);
22 |
23 | f64 OverDB = InRmsDB - ThresholdDB;
24 | if (OverDB < 0.0) OverDB = 0.0;
25 | OverDB += COMPRESSORDC;
26 |
27 | f64 Theta = (OverDB > Envelope) ? KAttack : KRelease;
28 | Envelope = OverDB + Theta * (Envelope - OverDB);
29 |
30 | f32 Pvart = Envelope - COMPRESSORDC;
31 | if (Pvart > 0.0f) Pvart -= Envelope * Envelope * 0.001f; // opto pseudo curve
32 | f64 Gain = 0.0f - Pvart * Ratio;
33 |
34 | return dB2lin(Gain);
35 |
36 | /*f64 InRmsDB = log10(InRms);
37 | f64 Gain = 0.0;
38 | if ( InRmsDB >= ThresholdDB) Gain = -(InRmsDB - ThresholdDB) * Ratio;
39 |
40 |
41 | f64 Theta = (Gain < Envelope) ? KAttack : KRelease;
42 |
43 | Envelope += Theta * (Gain - Envelope);
44 |
45 | Gain = pow(10, Envelope);
46 |
47 | return Gain;*/
48 | }
49 |
50 | private:
51 | f64 Envelope;
52 | f32 Threshold;
53 | f64 ThresholdDB;
54 | f32 Ratio;
55 | f64 KAttack;
56 | f64 KRelease;
57 | };
58 |
--------------------------------------------------------------------------------
/src/dynation/DiestressorPresetFormat.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (C) Anton Kovalev (vertver), 2018 - 2022. All rights reserved.
3 | * Copyright (C) Vladimir Shatrov (frowrik), 2018 - 2022. All rights reserved.
4 | * Dynation plugin
5 | * MIT License
6 | ***************************************************************************/
7 | #pragma once
8 | #include "Header.h"
9 |
10 | // все структуры с выравниваем в 1 байт!!!
11 | #pragma pack(push, 1)
12 | struct BASE_OPTIONS
13 | {
14 | f32 InVolume;
15 | f32 OutVolume;
16 | f32 EQLevel; // -1 - Full lowpass filter, +1 - Full highpass filter, 0 - without any filter
17 | f32 DryWetLevel; // dry/wet для дисторшена
18 | f32 CompressorDryWet; // dry/wet для компрессора
19 | f32 DitheringMix = 1.f;
20 | u32 DitheringType = 0; // 0 - выключен, 1 - 16 бит, 2 - 20 бит, 3 - 24 бита
21 | };
22 |
23 | struct DISTORTION_OPTIONS
24 | {
25 | f32 ClippingRatio; // 0 - нету, 1 - заметный клиппинг, 100 - сильный клиппинг
26 | f32 DriveLevel;
27 | f32 BitLevel;
28 | f32 SampleRateLevel;
29 | f32 CurveLevel;
30 | i32 TypeDistortion;
31 | };
32 |
33 | struct COMPRESSOR_OPTIONS
34 | {
35 | i32 CompressorRatio;
36 | f32 CompressorThreshold;
37 | f32 CompressorSlope;
38 | f32 CompressorLookAhead;
39 | f32 CompressorWindowTime;
40 | f32 CompressorAttackTime;
41 | f32 CompressorReleaseTime;
42 | i32 CompressorType;
43 | };
44 |
45 | struct DIESTRESSOR_PRESET
46 | {
47 | u32 PresetNumber;
48 | string128 UTF8PresetName;
49 | BASE_OPTIONS BaseOptions;
50 | DISTORTION_OPTIONS DistortionOptions;
51 | COMPRESSOR_OPTIONS CompressorOptions;
52 | };
53 |
54 | struct DIESTRESSOR_PRESET_NODE;
55 | struct DIESTRESSOR_PRESET_NODE
56 | {
57 | DIESTRESSOR_PRESET* pThis;
58 | DIESTRESSOR_PRESET_NODE* pPrev;
59 | DIESTRESSOR_PRESET_NODE* pNext;
60 | };
61 |
62 | struct DIESTRESSOR_PRESETGROUP
63 | {
64 | u32 GroupNumber;
65 | u32 CountOfPresets;
66 | string128 UTF8GroupName;
67 | DIESTRESSOR_PRESET_NODE* pPresetNode;
68 | };
69 |
70 | struct DIESTRESSOR_PRESETSLIST
71 | {
72 | u32 MagicWord; // 'DIES' - Dynation
73 | u32 PresetVersion; // 1.0
74 | u32 CountOfGroups;
75 | void* pData;
76 | };
77 | #pragma pack(pop)
78 |
79 | class DiestressorPresetLoader
80 | {
81 | public:
82 | void LoadPreset(char* PathToPreset);
83 | void SetPreset(i32 PresetNumber, PluginDistortion* pDistortion);
84 |
85 | private:
86 | void* BaseOptions;
87 | };
88 |
--------------------------------------------------------------------------------
/src/dynation/EnvelopeDetector.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define ENVELOPEATTACK 1.0 // 1ms
4 | #define ENVELOPERELEASE 1000.0 // 1000 ms
5 |
6 |
7 | // стаитческий рмс с окном на 1024 семпла независимо от фремретейм рейта 22050=46ms 44100=23ms 88200=11ms
8 | #define RMSWINDOWSIZE (16)
9 |
10 | class RMSDetector {
11 | public:
12 | void Reset( ) {
13 | Index = 0;
14 | RMSSumm = 0.0;
15 | for ( u32 i = 0; i < RMSWINDOWSIZE; i++ ) Buffer[i] = 0.0;
16 | }
17 |
18 | void NextSample( f64 In ) {
19 | if (Index >= BufferSize - 1) Index = 0;
20 |
21 | f64 In2 = In * In;
22 |
23 | f64 PrevSample = Buffer[Index];
24 | Buffer[Index] = In2;
25 | Index++;
26 |
27 | RMSSumm += In2;
28 | RMSSumm -= PrevSample;
29 | }
30 |
31 | f64 GetRMS( ) {
32 | if (RMSSumm <= 0.000001) return 0.0;
33 | f64 RMS = sqrt(RMSSumm/(f64)BufferSize);
34 | return RMS;
35 | }
36 | private:
37 | f64 Buffer[RMSWINDOWSIZE];
38 | u32 BufferSize = RMSWINDOWSIZE;
39 | u32 Index = 0;
40 | f64 RMSSumm = 0.0;
41 | };
42 |
43 |
44 | #define RMSWINDOWSIZEB (256)
45 |
46 | class RMSDetectorB {
47 | public:
48 | void Reset( ) {
49 | Index = 0;
50 | RMSSumm = 0.0;
51 | for ( u32 i = 0; i < RMSWINDOWSIZEB; i++ ) Buffer[i] = 0.0;
52 | }
53 |
54 | void NextSample( f64 In ) {
55 | if (Index >= BufferSize - 1) Index = 0;
56 |
57 | f64 In2 = In * In;
58 |
59 | f64 PrevSample = Buffer[Index];
60 | Buffer[Index] = In2;
61 | Index++;
62 |
63 | RMSSumm += In2;
64 | RMSSumm -= PrevSample;
65 | }
66 |
67 | f64 GetRMS( ) {
68 | if (RMSSumm <= 0.000001) return 0.0;
69 | f64 RMS = sqrt(RMSSumm/(f64)BufferSize);
70 | return RMS;
71 | }
72 | private:
73 | f64 Buffer[RMSWINDOWSIZEB];
74 | u32 BufferSize = RMSWINDOWSIZEB; // RMSWINDOWSIZE????????????????
75 | u32 Index = 0;
76 | f64 RMSSumm = 0.0;
77 | };
78 |
79 |
80 | #define RMSWINDOWSIZEC (1024*8)
81 |
82 | class RMSDetectorC {
83 | public:
84 | void Reset() {
85 | Index = 0;
86 | RMSSumm = 0.0;
87 | for (u32 i = 0; i < RMSWINDOWSIZEC; i++) Buffer[i] = 0.0;
88 | }
89 |
90 | void NextSample(f64 In) {
91 | if (Index >= BufferSize - 1) Index = 0;
92 |
93 | f64 In2 = In * In;
94 |
95 | f64 PrevSample = Buffer[Index];
96 | Buffer[Index] = In2;
97 | Index++;
98 |
99 | RMSSumm += In2;
100 | RMSSumm -= PrevSample;
101 | }
102 |
103 | f64 GetRMS() {
104 | if (RMSSumm <= 0.000001) return 0.0;
105 | f64 RMS = sqrt(RMSSumm / (f64)BufferSize);
106 | return RMS;
107 | }
108 | private:
109 | f64 Buffer[RMSWINDOWSIZEC];
110 | u32 BufferSize = RMSWINDOWSIZEC;
111 | u32 Index = 0;
112 | f64 RMSSumm = 0.0;
113 | };
114 |
--------------------------------------------------------------------------------
/src/dynation/EnvelopeDetectorAlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class EnvelopeDetector {
4 | public:
5 | void Reset( f32 Samplerate , f32 SpecAt = 0.0f, f32 SpecRel = 0.0f) {
6 | KAttack = SpecAt == 0.0f ? 0.0f : (float)exp(-1/(Samplerate* SpecAt * 0.001));
7 | KRelease = SpecRel == 0.0f ? 0.0f : (float)exp(-1/(Samplerate* SpecRel * 0.001));
8 | Envelope = 0.0;
9 | EnvelopeMax = 0.0;
10 | }
11 |
12 | void NextSample( f64 In ) {
13 | In = fabs(In);
14 |
15 | if( EnvelopeMax < In ) EnvelopeMax = In;
16 | else EnvelopeMax = In + KRelease * (EnvelopeMax - In);
17 |
18 | if( Envelope < In ) Envelope = In + KAttack * (Envelope - In);
19 | else Envelope = In + KRelease * (Envelope - In);
20 | }
21 |
22 | f64 GetEnvelop() {
23 | return Envelope;
24 | }
25 |
26 | f64 GetEnvelopMax( ) {
27 | return EnvelopeMax;
28 | }
29 | private:
30 | f64 Envelope;
31 | f64 EnvelopeMax;
32 | f64 KAttack;
33 | f64 KRelease;
34 | };
35 |
36 |
--------------------------------------------------------------------------------
/src/dynation/FoldBack.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "VST2_Header.h"
3 |
4 | struct FOLDBACK_PARAMETER
5 | {
6 | f32* fDriveLevel;
7 | };
8 |
9 | namespace dummy
10 | {
11 | template
12 | inline bool isnormal(_Ty _X)
13 | {
14 | return fpclassify(_X) == FP_NORMAL;
15 | }
16 | }
17 |
18 | class CFoldBack
19 | {
20 | public:
21 | void Process(PROCESS_DATA* processData)
22 | {
23 | f32& DriveLevel = *CurrentParams->fDriveLevel;
24 | f32* OutCh = nullptr;
25 |
26 | for (size_t o = 0; o < processData->ChannelsCount; o++)
27 | {
28 | OutCh = processData->Out[o];
29 |
30 | for (u32 i = 0; i < processData->SamplesCount; i++) {
31 | f32 In = processData->Out[o][i];
32 | f32 drv = fabs(OutCh[i]);
33 |
34 | f32 DriveLevel2 = DriveLevel * 0.25f;
35 |
36 | //if (drv > 1.f - DriveLevel)
37 | {
38 | drv = (drv - DriveLevel2) * sign(OutCh[i]);
39 | OutCh[i] = fabs(fabs(fmod(OutCh[i] - drv, drv * 4)) - drv * 2) - drv;
40 | }
41 |
42 | OutCh[i] = sin(OutCh[i]);
43 | if (!dummy::isnormal(OutCh[i])) {
44 | OutCh[i] = In;
45 | }
46 |
47 | OutCh[i] = In * (1.0f - DriveLevel) + OutCh[i] * DriveLevel;
48 | }
49 | }
50 | }
51 |
52 | void ProcessDouble(PROCESS_DATA_DOUBLE* processData)
53 | {
54 | f32& DriveLevel = *CurrentParams->fDriveLevel;
55 | f64* OutCh = nullptr;
56 |
57 | for (size_t o = 0; o < processData->ChannelsCount; o++)
58 | {
59 | OutCh = processData->Out[o];
60 |
61 | for (u32 i = 0; i < processData->SamplesCount; i++) {
62 | f32 drv = fabs(OutCh[i]);
63 |
64 | if (drv > 1.f - DriveLevel)
65 | {
66 | drv = (drv - DriveLevel) * sign(OutCh[i]);
67 | OutCh[i] = fabs(fabs(fmod(OutCh[i] - drv, drv * 4)) - drv * 2) - drv;
68 | }
69 |
70 | OutCh[i] = sin(OutCh[i]);
71 | }
72 | }
73 | }
74 |
75 | void SetEffectParameter(void* pParam)
76 | {
77 | CurrentParams = (FOLDBACK_PARAMETER*)pParam;
78 | }
79 |
80 | FOLDBACK_PARAMETER* CurrentParams;
81 | };
82 |
--------------------------------------------------------------------------------
/src/dynation/HardClipping.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "VST2_Header.h"
3 | #define sign(x) (signbit(x) ? -1 : 1)
4 |
5 | struct HARDCLIPPING_PARAMETER
6 | {
7 | f32* fClippingRatio;
8 | f32* fDriveLevel;
9 | };
10 |
11 | class CHardClipper
12 | {
13 | public:
14 | void Process(PROCESS_DATA* processData)
15 | {
16 | f32& DriveLevel = *CurrentParams->fDriveLevel;
17 | f32& ClippingRatio = *CurrentParams->fClippingRatio;
18 | f32* OutCh = nullptr;
19 |
20 | for (size_t o = 0; o < processData->ChannelsCount; o++)
21 | {
22 | OutCh = processData->Out[o];
23 |
24 | f32 LocalClipping = ClippingRatio / 10;
25 | for (u32 i = 0; i < processData->SamplesCount; i++) {
26 | OutCh[i] += OutCh[i] * DriveLevel * 3.14159265358979323846f;
27 | OutCh[i] = ((1 / LocalClipping) * fastatan(OutCh[i] * LocalClipping)) * LocalClipping;
28 | }
29 | }
30 | }
31 |
32 | void ProcessDouble(PROCESS_DATA_DOUBLE* processData)
33 | {
34 | f32& DriveLevel = *CurrentParams->fDriveLevel;
35 | f32& ClippingRatio = *CurrentParams->fClippingRatio;
36 | f64* OutCh = nullptr;
37 |
38 | for (size_t o = 0; o < processData->ChannelsCount; o++)
39 | {
40 | OutCh = processData->Out[o];
41 |
42 | f64 LocalClipping = ClippingRatio / 10;
43 | for (u32 i = 0; i < processData->SamplesCount; i++) {
44 | float boostValue = (DriveLevel * 3.14159265358979323846 * 2.f) + 1.f;
45 | OutCh[i] *= boostValue;
46 | OutCh[i] = ((1 / LocalClipping) * fastatan(OutCh[i] * LocalClipping)) * LocalClipping;
47 | OutCh[i] /= boostValue;
48 | OutCh[i] /= LocalClipping * LocalClipping;
49 | OutCh[i] /= (1 / LocalClipping);
50 | }
51 | }
52 | }
53 |
54 | void SetEffectParameter(void* pParam)
55 | {
56 | CurrentParams = (HARDCLIPPING_PARAMETER*)pParam;
57 | }
58 |
59 | HARDCLIPPING_PARAMETER* CurrentParams;
60 | i32 SamplesAdd;
61 | };
62 |
--------------------------------------------------------------------------------
/src/dynation/HardDistortion.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "VST2_Header.h"
3 |
4 | struct HARDDISTORTION_PARAMETER
5 | {
6 | f32* fDriveLevel;
7 | };
8 |
9 | class CHardDist
10 | {
11 | public:
12 | void Process(PROCESS_DATA* processData)
13 | {
14 | f32& DriveLevel = *CurrentParams->fDriveLevel;
15 | f32* OutCh = nullptr;
16 |
17 | for (size_t o = 0; o < processData->ChannelsCount; o++)
18 | {
19 | OutCh = processData->Out[o];
20 |
21 | for (u32 i = 0; i < processData->SamplesCount; i++) {
22 | f32 In = processData->Out[o][i];
23 | f32 boostLevel =( 3.14159265358979323846f + 4) * DriveLevel;
24 | if (boostLevel < 1) {
25 | boostLevel = 1;
26 | }
27 |
28 | OutCh[i] *= boostLevel;
29 | //OutCh[i] = OutCh[i] * (fabs(OutCh[i]) + DriveLevel) / ((OutCh[i] * OutCh[i]) + (DriveLevel - 1) * fabs(OutCh[i]) + 1);
30 | if (OutCh[i] > 0.9999999) {
31 | OutCh[i] = 0.9999999;
32 | }
33 |
34 | if (OutCh[i] < -0.9999999) {
35 | OutCh[i] = -0.9999999;
36 | }
37 |
38 |
39 | //OutCh[i] /= boostLevel;
40 | OutCh[i] = sin(OutCh[i]); // +1dB limiting
41 | OutCh[i] = In * (1.0f - DriveLevel) + OutCh[i] * DriveLevel;
42 | }
43 | }
44 | }
45 |
46 | void ProcessDouble(PROCESS_DATA_DOUBLE* processData)
47 | {
48 | f32& DriveLevel = *CurrentParams->fDriveLevel;
49 | f64* OutCh = nullptr;
50 |
51 | for (size_t o = 0; o < processData->ChannelsCount; o++)
52 | {
53 | OutCh = processData->Out[o];
54 |
55 | for (u32 i = 0; i < processData->SamplesCount; i++) {
56 | f32 boostValue = DriveLevel * 3.14159265358979323846 + 1 ;
57 | OutCh[i] *= boostValue;
58 | OutCh[i] = OutCh[i] * (fabs(OutCh[i]) + DriveLevel) / ((OutCh[i] * OutCh[i]) + (DriveLevel - 1) * (fabs(OutCh[i]) + 1));
59 | OutCh[i] /= boostValue;
60 | OutCh[i] = sin(OutCh[i]); // +1dB limiting
61 | }
62 | }
63 | }
64 |
65 | void SetEffectParameter(void* pParam)
66 | {
67 | CurrentParams = (HARDDISTORTION_PARAMETER*)pParam;
68 | }
69 |
70 | HARDDISTORTION_PARAMETER* CurrentParams;
71 | i32 SamplesAdd;
72 | };
73 |
--------------------------------------------------------------------------------
/src/dynation/ImGuiComboMod.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace ImGui
4 | {
5 |
6 | bool BeginComboMod(const char* label, bool pressed, ImVec2 XY, ImVec2 WH)
7 | {
8 | ImGuiComboFlags flags = ImGuiComboFlags_None | ImGuiComboFlags_NoArrowButton;
9 |
10 | // Always consume the SetNextWindowSizeConstraint() call in our early return paths
11 | ImGuiContext& g = *GImGui;
12 | bool has_window_size_constraint = (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint) != 0;
13 | g.NextWindowData.Flags &= ~ImGuiNextWindowDataFlags_HasSizeConstraint;
14 |
15 | ImGuiWindow* window = GetCurrentWindow();
16 | if (window->SkipItems)
17 | return false;
18 |
19 | IM_ASSERT((flags & (ImGuiComboFlags_NoArrowButton | ImGuiComboFlags_NoPreview)) != (ImGuiComboFlags_NoArrowButton | ImGuiComboFlags_NoPreview)); // Can't use both flags together
20 |
21 | const ImGuiStyle& style = g.Style;
22 | const ImGuiID id = window->GetID(label);
23 |
24 | // fix draw
25 | ImGui::SetCursorPos(XY);
26 |
27 | // fix font sizes
28 | ImGui::SetWindowFontScale(1.0f);
29 | ImVec2 TextSize2 = ImGui::CalcTextSize(label);
30 | f32 Scalebase = min((WH.x / TextSize2.x), (WH.y / TextSize2.y)) * 0.7; // какого хуя коэфицент ??????/
31 | ImGui::SetWindowFontScale(Scalebase);
32 |
33 | const float w = WH.x;
34 | const ImRect frame_bb(
35 | XY,
36 | XY + ImVec2(w, WH.y)
37 | );
38 |
39 | //
40 | bool popup_open = IsPopupOpen(id, ImGuiPopupFlags_None);
41 |
42 | if ((pressed || g.NavActivateId == id) && !popup_open)
43 | {
44 | if (window->DC.NavLayerCurrent == 0)
45 | window->NavLastIds[0] = id;
46 | OpenPopupEx(id, ImGuiPopupFlags_None);
47 | popup_open = true;
48 | }
49 |
50 | if (!popup_open) return false;
51 |
52 | if (has_window_size_constraint)
53 | {
54 | g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasSizeConstraint;
55 | g.NextWindowData.SizeConstraintRect.Min.x = ImMax(g.NextWindowData.SizeConstraintRect.Min.x, w);
56 | }
57 | else
58 | {
59 | if ((flags & ImGuiComboFlags_HeightMask_) == 0)
60 | flags |= ImGuiComboFlags_HeightRegular;
61 | IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiComboFlags_HeightMask_)); // Only one
62 | int popup_max_height_in_items = -1;
63 | if (flags & ImGuiComboFlags_HeightRegular) popup_max_height_in_items = 8;
64 | else if (flags & ImGuiComboFlags_HeightSmall) popup_max_height_in_items = 4;
65 | else if (flags & ImGuiComboFlags_HeightLarge) popup_max_height_in_items = 20;
66 |
67 | f32 MaxPopupHeightFromItemCount = FLT_MAX;
68 | if (popup_max_height_in_items > 0) MaxPopupHeightFromItemCount = (g.FontSize + g.Style.ItemSpacing.y) * popup_max_height_in_items - g.Style.ItemSpacing.y + (g.Style.WindowPadding.y * 2);
69 |
70 | SetNextWindowSizeConstraints(ImVec2(w, 0.0f), ImVec2(FLT_MAX, MaxPopupHeightFromItemCount));
71 | }
72 |
73 | char name[16];
74 | ImFormatString(name, IM_ARRAYSIZE(name), "##Combo_%02d", g.BeginPopupStack.Size); // Recycle windows based on depth
75 |
76 | // Position the window given a custom constraint (peak into expected window size so we can position it)
77 | // This might be easier to express with an hypothetical SetNextWindowPosConstraints() function.
78 | if (ImGuiWindow* popup_window = FindWindowByName(name))
79 | if (popup_window->WasActive)
80 | {
81 | // Always override 'AutoPosLastDirection' to not leave a chance for a past value to affect us.
82 | ImVec2 size_expected = CalcWindowExpectedSize(popup_window);
83 | if (flags & ImGuiComboFlags_PopupAlignLeft)
84 | popup_window->AutoPosLastDirection = ImGuiDir_Left; // "Below, Toward Left"
85 | else
86 | popup_window->AutoPosLastDirection = ImGuiDir_Down; // "Below, Toward Right (default)"
87 | ImRect r_outer = GetWindowAllowedExtentRect(popup_window);
88 | ImVec2 pos = FindBestWindowPosForPopupEx(frame_bb.GetBL(), size_expected, &popup_window->AutoPosLastDirection, r_outer, frame_bb, ImGuiPopupPositionPolicy_ComboBox);
89 | SetNextWindowPos(pos);
90 | }
91 |
92 | // We don't use BeginPopupEx() solely because we have a custom name string, which we could make an argument to BeginPopupEx()
93 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMove;
94 |
95 | // Horizontally align ourselves with the framed text
96 | PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.FramePadding.x, style.WindowPadding.y));
97 | bool ret = Begin(name, NULL, window_flags);
98 | PopStyleVar();
99 | if (!ret)
100 | {
101 | EndPopup();
102 | IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above
103 | return false;
104 | }
105 | return true;
106 | }
107 |
108 | }
--------------------------------------------------------------------------------
/src/dynation/PresetLoader.cpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (C) Anton Kovalev (vertver), 2018 - 2022. All rights reserved.
3 | * Copyright (C) Vladimir Shatrov (frowrik), 2018 - 2022. All rights reserved.
4 | * Dynation plugin
5 | * MIT License
6 | ***************************************************************************/
7 | #include "DiestressorPresetFormat.h"
8 |
9 | void
10 | DiestressorPresetLoader::LoadPreset(char* PathToPreset)
11 | {
12 |
13 | }
14 |
15 | void
16 | DiestressorPresetLoader::SetPreset(i32 PresetNumber, PluginDistortion* pDistortion)
17 | {
18 |
19 | }
--------------------------------------------------------------------------------
/src/dynation/Resources.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vertver/Dynation/ac4a2f7b53fb204fae1a5f94125111e2fd2b0506/src/dynation/Resources.aps
--------------------------------------------------------------------------------
/src/dynation/Resources.rc:
--------------------------------------------------------------------------------
1 | 1800 RCDATA "fonts/FuturaDemiC-Italic.ttf"
2 | 1805 RCDATA "fonts/icomoon.ttf"
--------------------------------------------------------------------------------
/src/dynation/SatAlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | f32 SatAlg_HardClip(f32 In, f32 Threshold);
4 | f64 SatAlg_HardClipD(f64 In, f64 Threshold);
5 |
6 | f32 SatAlg_HardClipDrive(f32 In, f32 Drive); // Drive = 1..N
7 | f64 SatAlg_HardClipDriveD(f64 In, f64 Drive); // Drive = 1..N
8 |
9 | f32 SatAlg_HardClipDriveCurve(f32 In, f32 Drive, f32 Curve); // Drive = 1..N Curve = 0..1
10 | f64 SatAlg_HardClipDriveCurveD(f64 In, f64 Drive, f32 Curve); // Drive = 1..N Curve = 0..1
11 |
12 | f32 SatAlg_FoldbackDrive(f32 In, f32 Drive); // Drive = 1..N
13 | f64 SatAlg_FoldbackDriveD(f64 In, f64 Drive); // Drive = 1..N
14 |
15 | f32 SatAlg_SoftClip2Drive(f32 In, f32 Drive, f32 A); // Drive = 1..N A = 0..1
16 | f64 SatAlg_SoftClip2DriveD(f64 In, f64 Drive, f64 A); // Drive = 1..N
17 |
18 | f64 SatAlg_fasttanh2(const f64 x);
19 |
20 | f32 SatAlg_SoftClip(f32 In);
21 | f64 SatAlg_SoftClipD(f64 In);
22 |
23 | f32 SatAlg_SoftClipDrive(f32 In, f32 Drive); // Drive = 1..N
24 | f64 SatAlg_SoftClipDriveD(f64 In, f64 Drive); // Drive = 1..N
25 |
26 | void SatAlg_BitCrushingInit(u32 DepthBits, u32& ValuePow);
27 | f32 SatAlg_BitCrushing(f32 In, u32& ValuePow);
28 | f64 SatAlg_BitCrushingD(f64 In, u32& ValuePow);
29 |
30 | f32 SatAlg_RateReducer(f32 In, f32& SaveLoadValue, u32& SaveLoadValue2, u32 SampleRateDivNeadRate);
31 | f64 SatAlg_RateReducerD(f64 In, f64& SaveLoadValue, u32& SaveLoadValue2, u32 SampleRateDivNeadRate);
32 |
33 | // Эффект ошибки ацп типа белый шум но прикольней (заедание семпла)
34 | f32 SatAlg_ADCFailure(f32 In, f32& SaveLoadValue, f32 Error); // Error = 0..1
35 | f64 SatAlg_ADCFailureD(f64 In, f64& SaveLoadValue, f64 Error); // Error = 0..1
36 |
37 | // tube double-triode and failure triode
38 | void SatAlg_TubeTriodeInit(f32 Drive, f32& SaveLoada, f32& SaveLoadk); // Drive = 0..N
39 | f32 SatAlg_FailureTubeTriode(f32 In, f32& SaveLoada, f32& SaveLoadk);
40 | f64 SatAlg_FailureTubeTriodeD(f64 In, f32& SaveLoada, f32& SaveLoadk);
41 | f32 SatAlg_TubeTriode(f32 In);
42 | f64 SatAlg_TubeTriodeD(f64 In);
43 |
44 | f32 SatAlg_Sincrusher(f32 In, f32 Drive); // Drive = 1..N
45 | f64 SatAlg_SincrusherD(f64 In, f64 Drive); // Drive = 1..N
46 |
--------------------------------------------------------------------------------
/src/dynation/Sincrusher.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "VST2_Header.h"
3 | #define sign(x) (signbit(x) ? -1 : 1)
4 |
5 | #define ROUND(f) ((f32)((f > 0.0) ? floor(f + 0.5) : ceil(f - 0.5)))
6 | #define ROUNDD(f) ((f64)((f > 0.0) ? floor(f + 0.5) : ceil(f - 0.5)))
7 |
8 | struct SINCRUSHER_PARAMETER
9 | {
10 | f32* fClippingRatio;
11 | f32* fSampleRate;
12 | f32* fGlobalRate;
13 | f32* fBits;
14 | f32* fDriveLevel;
15 | };
16 |
17 | class CSincrusher
18 | {
19 | public:
20 | void Process(PROCESS_DATA* processData)
21 | {
22 | f32& BitLevel = *CurrentParams->fBits;
23 | f32& ClippingRatio = *CurrentParams->fClippingRatio;
24 | f32& CurrentSampleRate = *CurrentParams->fGlobalRate;
25 | f32& SampleRateLevel = *CurrentParams->fSampleRate;
26 | f32& DriveLevel = *CurrentParams->fDriveLevel;
27 | f32* OutCh = nullptr;
28 |
29 | for (size_t o = 0; o < processData->ChannelsCount; o++)
30 | {
31 | OutCh = processData->Out[o];
32 |
33 | for (u32 i = 0; i < processData->SamplesCount; i++) {
34 | f32 In = processData->Out[o][i];
35 | f32 boostVolume = 1.0f + (DriveLevel * 3.14159265358979323846f * 2);
36 | OutCh[i] *= boostVolume;
37 | OutCh[i] = sin(OutCh[i]);
38 | OutCh[i] /= boostVolume;
39 | OutCh[i] = In * (1.0f - DriveLevel) + OutCh[i] * DriveLevel;
40 | }
41 |
42 | }
43 | }
44 |
45 | void ProcessDouble(PROCESS_DATA_DOUBLE* processData)
46 | {
47 | f32& BitLevel = *CurrentParams->fBits;
48 | f32& CurrentSampleRate = *CurrentParams->fGlobalRate;
49 | f32& SampleRateLevel = *CurrentParams->fSampleRate;
50 | f32& DriveLevel = *CurrentParams->fDriveLevel;
51 | f64* OutCh = nullptr;
52 |
53 | for (size_t o = 0; o < processData->ChannelsCount; o++)
54 | {
55 | OutCh = processData->Out[o];
56 |
57 | // bit shift
58 | int max = pow(2, BitLevel) - 1;
59 | int step = CurrentSampleRate / SampleRateLevel;
60 | if (!step) step = 1;
61 | f64 FirstSample = 0;
62 |
63 | FirstSample = ROUNDD((OutCh[0] + 1.0) * max) / max - 1.0;
64 |
65 | for (u32 i = 0; i < processData->SamplesCount; i++) {
66 | // sin distortion
67 | OutCh[i] = (sin(OutCh[i] * ((DriveLevel * 3.14159265358979323846) + 1))); // если привысить число пи - сигнал будет уходить в противофазу
68 |
69 | if (SamplesAdd[o] == 0)
70 | {
71 | FirstSample = ROUNDD((OutCh[i] + 1.0) * max) / max - 1.0;
72 | }
73 |
74 | SamplesAdd[o] = (SamplesAdd[o] + 1) % step;
75 | OutCh[i] = FirstSample;
76 | }
77 | }
78 | }
79 |
80 | void SetEffectParameter(void* pParam)
81 | {
82 | CurrentParams = (SINCRUSHER_PARAMETER*)pParam;
83 | }
84 |
85 | SINCRUSHER_PARAMETER* CurrentParams;
86 | i32 SamplesAdd[8];
87 | };
88 |
--------------------------------------------------------------------------------
/src/dynation/SoftClipping.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "VST2_Header.h"
3 | #define sign(x) (signbit(x) ? -1 : 1)
4 |
5 | struct SOFTCLIPPING_PARAMETER
6 | {
7 | f32* fClippingRatio;
8 | f32* fDriveLevel;
9 | };
10 |
11 | class CSoftClipper
12 | {
13 | public:
14 | void ProcessNew(PROCESS_DATA* processData)
15 | {
16 | f32& DriveLevel = *CurrentParams->fDriveLevel;
17 | f32& ClippingRatio = *CurrentParams->fClippingRatio;
18 | f32* OutCh = nullptr;
19 | f32 TempX = 0.;
20 |
21 | for (size_t o = 0; o < processData->ChannelsCount; o++)
22 | {
23 | OutCh = processData->Out[o];
24 |
25 | for (u32 i = 0; i < processData->SamplesCount; i++) {
26 | f32 In = processData->Out[o][i];
27 | f32 boostVolume = (FLT_EPSILON + OutCh[i] + (DriveLevel * 3.14159265358979323846f * 2));
28 | OutCh[i] *= boostVolume;
29 | f32 range = max(ClippingRatio * 100.f, 1.f);
30 | f32 temp = pow(fabs(OutCh[i]), range);
31 | temp = fastatan(temp);
32 | OutCh[i] = sign(OutCh[i]) * pow(temp, (1 / range));
33 | //OutCh[i] /= boostVolume;
34 | OutCh[i] = In * (1.0f - DriveLevel) + OutCh[i] * DriveLevel;
35 | }
36 | }
37 | }
38 |
39 | void Process(PROCESS_DATA* processData)
40 | {
41 | f32& DriveLevel = *CurrentParams->fDriveLevel;
42 | f32& ClippingRatio = *CurrentParams->fClippingRatio;
43 | f32* OutCh = nullptr;
44 | f32 TempX = 0.;
45 |
46 | for (size_t o = 0; o < processData->ChannelsCount; o++)
47 | {
48 | OutCh = processData->Out[o];
49 |
50 | for (u32 i = 0; i < processData->SamplesCount; i++) {
51 | f32 In = processData->Out[o][i];
52 | f32 boostVolume = (FLT_EPSILON + OutCh[i] + (DriveLevel * 3.14159265358979323846f * 2));
53 | OutCh[i] *= boostVolume;
54 | f32 range = max(ClippingRatio * 100.f, 1.f);
55 | f32 temp = pow(fabs(OutCh[i]), range);
56 | temp = atan(temp);
57 | OutCh[i] = sign(OutCh[i]) * pow(temp, (1 / range));
58 | //OutCh[i] /= boostVolume;
59 | OutCh[i] = In * (1.0f - DriveLevel) + OutCh[i] * DriveLevel;
60 | }
61 | }
62 | }
63 |
64 | void ProcessDouble(PROCESS_DATA_DOUBLE* processData)
65 | {
66 | f32& DriveLevel = *CurrentParams->fDriveLevel;
67 | f32& ClippingRatio = *CurrentParams->fClippingRatio;
68 | f64* OutCh = nullptr;
69 | f64 TempX = 0.;
70 |
71 | for (size_t o = 0; o < processData->ChannelsCount; o++)
72 | {
73 | OutCh = processData->Out[o];
74 |
75 | for (u32 i = 0; i < processData->SamplesCount; i++) {
76 | OutCh[i] += OutCh[i] * DriveLevel * 3.14159265358979323846;
77 | OutCh[i] = sign(OutCh[i]) * pow(fastatan(pow(fabs(OutCh[i]), ClippingRatio)), (1 / ClippingRatio));
78 | }
79 | }
80 | }
81 |
82 | void SetEffectParameter(void* pParam)
83 | {
84 | CurrentParams = (SOFTCLIPPING_PARAMETER*)pParam;
85 | }
86 |
87 | SOFTCLIPPING_PARAMETER* CurrentParams;
88 | i32 SamplesAdd;
89 | };
90 |
--------------------------------------------------------------------------------
/src/dynation/SoftDistortion.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "VST2_Header.h"
3 |
4 | struct SOFTDISTORTION_PARAMETER
5 | {
6 | f32* fCurve;
7 | f32* fDriveLevel;
8 | };
9 |
10 | class CSoftDist
11 | {
12 | public:
13 | void Process(PROCESS_DATA* processData)
14 | {
15 | f32& DriveLevel = *CurrentParams->fDriveLevel;
16 | f32& CurveLevel = *CurrentParams->fCurve;
17 | f32* OutCh = nullptr;
18 |
19 | f32 a = sin(((DriveLevel * 70.0f) / 101.0f) * (3.14159265358979323846f / 2.0f));
20 | f32 k = 2.0f * a / (1.0f - a);
21 |
22 | for (size_t o = 0; o < processData->ChannelsCount; o++) {
23 | OutCh = processData->Out[o];
24 |
25 | for (u32 i = 0; i < processData->SamplesCount; i++) {
26 |
27 | auto stfun = [](f32 In, f32 k, f32 CurveLevel, f32 DriveLevel) -> f32 {
28 | // dist 1
29 | f32 Temp2 = (1.0f + k) * (In) / (1.0f + k * fabsf(In)) ;
30 |
31 | // dist 2
32 | auto sttubefun = [](f64 x) -> f64 {
33 | x = sign(x) * ((2.0 - fabsf(x)) * fabsf(x));
34 |
35 | if (x < -1.0f) {
36 | return -1.0f;
37 | } else if (x < -0.08905) { // -0.399 -0.379
38 | //In -= 0.003f;
39 | f32 Temp6 = (fabs(x) - 0.032847);
40 | f32 Temp6_pow12 = pow((1.0 - Temp6), 12.0);
41 | f32 Temp7 = 1.0 - Temp6_pow12 + Temp6 * (1.0 / 3.0);
42 | return -(0.01 + (3.0 / 4.0) * Temp7);
43 | } else if (x < 0.320018) {
44 | return -6.152* x * x + x * 3.9375;
45 | } else {
46 | return 0.630035;
47 | }
48 | };
49 |
50 | f32 Temp4 = (sttubefun(In) * (1.0f - CurveLevel) + Temp2 * CurveLevel)*0.9f;
51 |
52 | return In * (1.0f - DriveLevel) + Temp4 * DriveLevel;
53 | };
54 |
55 | f32 Temp1 = OutCh[i];
56 | OutCh[i] = stfun(Temp1, k, CurveLevel, DriveLevel) ;
57 |
58 | if (OutCh[i] > 0.9999999) OutCh[i] = 0.9999999;
59 | if (OutCh[i] < -0.9999999) OutCh[i] = -0.9999999;
60 | }
61 | }
62 | }
63 |
64 | void ProcessDouble(PROCESS_DATA_DOUBLE* processData)
65 | {
66 | f32& DriveLevel = *CurrentParams->fDriveLevel;
67 | f32& CurveLevel = *CurrentParams->fCurve;
68 | f64* OutCh = nullptr;
69 | f64 TempX = 0.;
70 |
71 | for (size_t o = 0; o < processData->ChannelsCount; o++)
72 | {
73 | OutCh = processData->Out[o];
74 |
75 | for (u32 i = 0; i < processData->SamplesCount; i++)
76 | {
77 | TempX = OutCh[i] * (DriveLevel * 3.14159265358979323846 + 1);
78 |
79 | f64 expX = exp(TempX);
80 | f64 temp = 1 + exp(sqrt(fabs(TempX)) * CurveLevel);
81 |
82 | OutCh[i] = (expX - exp(-TempX * temp)) / (expX + exp(-TempX));
83 |
84 | OutCh[i] /= (3.14159265358979323846 / 1.5f);
85 | OutCh[i] = sin(sin(OutCh[i]) * 1.4f); // +1dB limiting
86 | }
87 | }
88 | }
89 |
90 | void SetEffectParameter(void* pParam)
91 | {
92 | CurrentParams = (SOFTDISTORTION_PARAMETER*)pParam;
93 | }
94 |
95 | SOFTDISTORTION_PARAMETER* CurrentParams;
96 | i32 SamplesAdd;
97 | };
98 |
--------------------------------------------------------------------------------
/src/dynation/SuirlessProDistortion.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {80ff4ab8-6ec9-44df-a7fb-c30ee0586e94}
6 |
7 |
8 | {2a275838-bea0-4522-b2bb-80e5057773d8}
9 |
10 |
11 | {f3ab6683-0e47-48c5-89d8-ee77f3170ef7}
12 |
13 |
14 | {c3872840-6b58-4dab-81a6-91bcb447431a}
15 |
16 |
17 | {0c9d56eb-2a3a-4f1b-963e-5d9612bea6fb}
18 |
19 |
20 | {1fa04161-31f2-4388-91a4-e0ec20a97eb7}
21 |
22 |
23 | {49052ac5-97f8-4f3e-951c-3a35fff87880}
24 |
25 |
26 |
27 |
28 |
29 | Sources
30 |
31 |
32 | Sources
33 |
34 |
35 | Sources\musor
36 |
37 |
38 | Sources\presets
39 |
40 |
41 | Sources
42 |
43 |
44 | Sources\Algoritm2
45 |
46 |
47 | Sources
48 |
49 |
50 |
51 |
52 | Sources
53 |
54 |
55 |
56 | Sources\Algoritm
57 |
58 |
59 | Sources\Algoritm
60 |
61 |
62 | Sources\Algoritm
63 |
64 |
65 | Sources\Algoritm
66 |
67 |
68 | Sources\Algoritm
69 |
70 |
71 | Sources\Algoritm
72 |
73 |
74 | Sources\musor
75 |
76 |
77 | Sources\presets
78 |
79 |
80 | Sources\Algoritm
81 |
82 |
83 | Sources\Algoritm
84 |
85 |
86 | Sources\Algoritm
87 |
88 |
89 |
90 | Sources\validiaton check
91 |
92 |
93 | Sources\Algoritm
94 |
95 |
96 | Sources\Algoritm2
97 |
98 |
99 | Sources\Algoritm2
100 |
101 |
102 | Sources\Algoritm2
103 |
104 |
105 | Sources\Algoritm2
106 |
107 |
108 | Sources\Algoritm2
109 |
110 |
111 | Sources
112 |
113 |
114 |
115 |
116 | Resources
117 |
118 |
119 |
--------------------------------------------------------------------------------
/src/dynation/SuirlessProDistortion.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | C:\Program Files\Image-Line\FL Studio 20\FL64
5 | WindowsLocalDebugger
6 | Z:\GitHub\SuirlessPro\Build\test.flp
7 | $(ProjectDir)
8 |
9 |
10 | C:\Program Files\Adobe\Adobe Audition CC 2019\Adobe Audition CC.exe
11 | WindowsLocalDebugger
12 |
13 | $(ProjectDir)
14 |
15 |
16 | C:\Program Files\REAPER %28x64%29\reaper.exe
17 | WindowsLocalDebugger
18 |
19 |
20 | $(ProjectDir)
21 |
22 |
23 | C:\ProgramData\Ableton\Live 10 Suite\Program\Ableton Live 10 Suite.exe
24 | WindowsLocalDebugger
25 |
26 | $(ProjectDir)
27 |
28 |
29 | C:\Program Files\REAPER %28x64%29\reaper.exe
30 | WindowsLocalDebugger
31 |
32 | $(ProjectDir)
33 |
34 |
35 | C:\ProgramData\Ableton\Live 10 Suite\Program\Ableton Live 10 Suite.exe
36 | WindowsLocalDebugger
37 |
38 | $(ProjectDir)
39 |
40 |
41 | C:\ProgramData\Ableton\Live 10 Suite\Program\Ableton Live 10 Suite.exe
42 | WindowsLocalDebugger
43 |
44 | $(ProjectDir)
45 |
46 |
47 | C:\ProgramData\Ableton\Live 10 Suite\Program\Ableton Live 10 Suite.exe
48 | WindowsLocalDebugger
49 |
50 | $(ProjectDir)
51 |
52 |
--------------------------------------------------------------------------------
/src/dynation/TempBuffers.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | struct PROCESS_DATA_VIRTUAL : public PROCESS_DATA {
4 | PROCESS_DATA_VIRTUAL() {
5 | InChannelsCount = 0;
6 | OutChannelsCount = 0;
7 | SamplesCount = 0;
8 | for (u32 i = 0; i < DATAMAXCHANNELS; i++) {
9 | In[i] = nullptr;
10 | Out[i] = nullptr;
11 | }
12 | }
13 |
14 | PROCESS_DATA_VIRTUAL(PROCESS_DATA_VIRTUAL& Base, u32 Offset, u32 Samples) {
15 | assert(Base.SamplesCount >= Samples + Offset); // чекаем границу
16 | InChannelsCount = Base.InChannelsCount;
17 | OutChannelsCount = Base.OutChannelsCount;
18 | SamplesCount = Samples;
19 | for (u32 i = 0; i < DATAMAXCHANNELS; i++) {
20 | In[i] = &Base.In[i][Offset];
21 | Out[i] = &Base.Out[i][Offset];
22 | }
23 | }
24 | };
25 |
26 | struct PROCESS_DATA_BUFFER: public PROCESS_DATA {
27 | std::vector InData[DATAMAXCHANNELS];
28 | std::vector OutData[DATAMAXCHANNELS];
29 |
30 | PROCESS_DATA_BUFFER() {
31 | InChannelsCount = 0;
32 | OutChannelsCount = 0;
33 | for (u32 i = 0; i < DATAMAXCHANNELS; i++) {
34 | In[i] = nullptr;
35 | Out[i] = nullptr;
36 | }
37 | }
38 |
39 | ~PROCESS_DATA_BUFFER() {
40 | InChannelsCount = 0;
41 | OutChannelsCount = 0;
42 | for (u32 i = 0; i < DATAMAXCHANNELS; i++) {
43 | In[i] = nullptr;
44 | Out[i] = nullptr;
45 | }
46 | }
47 |
48 | void Resize(u32 InChannelsCountNew, u32 OutChannelsCountNew, u32 SamplesCountNew) {
49 | if (SamplesCountNew == 0) return;
50 |
51 | if (InChannelsCountNew != InChannelsCount) {
52 | for (u32 i = InChannelsCountNew; i < InChannelsCount; i++) {
53 | InData[i].clear();
54 | In[i] = nullptr;
55 | }
56 | InChannelsCount = InChannelsCountNew;
57 | }
58 |
59 | if (OutChannelsCountNew != OutChannelsCount) {
60 | for (u32 i = OutChannelsCountNew; i < OutChannelsCount; i++) {
61 | OutData[i].clear();
62 | Out[i] = nullptr;
63 | }
64 | OutChannelsCount = OutChannelsCountNew;
65 | }
66 |
67 | if (SamplesCountNew != SamplesCount) {
68 | for (u32 i = 0; i < InChannelsCount; i++) {
69 | InData[i].resize(SamplesCountNew);
70 | }
71 | for (u32 i = 0; i < OutChannelsCount; i++) {
72 | OutData[i].resize(SamplesCountNew);
73 | }
74 | SamplesCount = SamplesCountNew;
75 | }
76 |
77 | for (u32 i = 0; i < InChannelsCount; i++) {
78 | In[i] = &InData[i][0];
79 | }
80 | for (u32 i = 0; i < OutChannelsCount; i++) {
81 | Out[i] = &OutData[i][0];
82 | }
83 | }
84 | };
85 |
--------------------------------------------------------------------------------
/src/dynation/TiltEQAlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | struct TiltEQAlg_Simple { // Tilt eq 1000gz +- 18db
4 | void SetSampleRate(f32 SampleRate) {
5 | f32 sr3 = 3.0f * SampleRate;
6 | f32 Omega = 2.0f * 3.14159265358979323846f * (f32)1000.0;
7 | f32 n = 1 / (sr3 + Omega);
8 | a0 = 2 * Omega * n;
9 | b1 = (sr3 - Omega) * n;
10 | }
11 |
12 | void SetEQLevel(f32 EQLevel) {
13 | const f32 G_factor = 5.0f;
14 |
15 | if (EQLevel > 0) {
16 | g1 = -G_factor * EQLevel * 6.0;
17 | g2 = EQLevel * 6.0;
18 | } else {
19 | g1 = -EQLevel * 6.0;
20 | g2 = G_factor * EQLevel * 6.0;
21 | }
22 |
23 | f32 Amp = 6.0 / log(2.0);
24 | lgain = exp(g1 / Amp) - 1;
25 | hgain = exp(g2 / Amp) - 1;
26 | }
27 |
28 | f32 NextSample(f32 In) {
29 | prev_out = a0 * In + b1 * prev_out;
30 | return In + lgain * prev_out + hgain * (In - prev_out);
31 | }
32 | private:
33 | f32 prev_out = 0.0f;
34 | f32 g1 = 0.0f;
35 | f32 g2 = 0.0f;
36 | f32 lgain = 0.0f;
37 | f32 hgain = 0.0f;
38 | f32 a0 = 0.0f;
39 | f32 b1 = 0.0f;
40 | };
41 |
--------------------------------------------------------------------------------
/src/dynation/TiltEq.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "VST2_Header.h"
3 |
4 | struct TILTEQ_PARAMETER
5 | {
6 | f32* fEqLevel;
7 | f32* fCurrentSampleRate;
8 | };
9 |
10 | class CTiltEq
11 | {
12 | public:
13 | void Process(PROCESS_DATA* processData)
14 | {
15 | // Tilt eq 1000gz +- 18db
16 | f32& EQLevel = *CurrentParams->fEqLevel;
17 | f32& CurrentSampleRate = *CurrentParams->fCurrentSampleRate;
18 | f32 Amp = 6 / log(2);
19 | f32 sr3 = 3 * CurrentSampleRate;
20 | f32 g1 = 0;
21 | f32 g2 = 0;
22 | f32* OutCh = nullptr;
23 | if (EQLevel > 0)
24 | {
25 | g1 = -5/*gfactor*/ * EQLevel * 6.0f;
26 | g2 = EQLevel * 6.0f;
27 | }
28 | else
29 | {
30 | g1 = -EQLevel * 6.0f;
31 | g2 = 5/*gfactor*/ * EQLevel * 6.0f;
32 | }
33 |
34 | f32 lgain = exp(g1 / Amp) - 1;
35 | f32 hgain = exp(g2 / Amp) - 1;
36 | f32* llp_out = nullptr; // делаем переменную для указателя, чтобы динамически установить позицию
37 |
38 | for (size_t o = 0; o < processData->ChannelsCount; o++)
39 | {
40 | OutCh = processData->Out[o];
41 |
42 | switch (o)
43 | {
44 | case 0:
45 | llp_out = &_1_out;
46 | break;
47 | case 1:
48 | llp_out = &_2_out;
49 | break;
50 | case 2:
51 | llp_out = &_3_out;
52 | break;
53 | case 3:
54 | llp_out = &_4_out;
55 | break;
56 | case 4:
57 | llp_out = &_5_out;
58 | break;
59 | case 5:
60 | llp_out = &_6_out;
61 | break;
62 | case 6:
63 | llp_out = &_7_out;
64 | break;
65 | case 7:
66 | llp_out = &_8_out;
67 | break;
68 | default:
69 | break;
70 | }
71 |
72 | f32& p_out = *llp_out;
73 |
74 | f32 Omega = 2.0f * 3.14159265358979323846f * (f32)1000;
75 | f32 n = 1 / (sr3 + Omega);
76 | f32 a0 = 2 * Omega * n;
77 | f32 b1 = (sr3 - Omega) * n;
78 |
79 | for (u32 i = 0; i < processData->SamplesCount; i++) {
80 | p_out = a0 * OutCh[i] + b1 * p_out;
81 | OutCh[i] = OutCh[i] + lgain * p_out + hgain * (OutCh[i] - p_out);
82 | if (OutCh[i] >= 6.0f) OutCh[i] = 6.0f;
83 | if (OutCh[i] <= -6.0f) OutCh[i] = -6.0f;
84 | }
85 | }
86 | }
87 |
88 | void ProcessDouble(PROCESS_DATA_DOUBLE* processData)
89 | {
90 | // Tilt eq 1000gz +- 18db
91 | f32& EQLevel = *CurrentParams->fEqLevel;
92 |
93 | f32& CurrentSampleRate = *CurrentParams->fCurrentSampleRate;
94 | f32 Amp = 6 / log(2);
95 | f32 sr3 = 3 * CurrentSampleRate;
96 | f32 g1 = 0;
97 | f32 g2 = 0;
98 | f64* OutCh = nullptr;
99 | if (EQLevel > 0)
100 | {
101 | g1 = -5/*gfactor*/ * EQLevel * 6.0;
102 | g2 = EQLevel * 6.0;
103 | }
104 | else
105 | {
106 | g1 = -EQLevel * 6.0;
107 | g2 = 5/*gfactor*/ * EQLevel * 6.0;
108 | }
109 |
110 | f32 lgain = exp(g1 / Amp) - 1;
111 | f32 hgain = exp(g2 / Amp) - 1;
112 | f32* llp_out = nullptr; // делаем переменную для указателя, чтобы динамически установить позицию
113 |
114 | for (size_t o = 0; o < processData->ChannelsCount; o++)
115 | {
116 | OutCh = processData->Out[o];
117 |
118 | switch (o)
119 | {
120 | case 0:
121 | llp_out = &_1_out;
122 | break;
123 | case 1:
124 | llp_out = &_2_out;
125 | break;
126 | case 2:
127 | llp_out = &_3_out;
128 | break;
129 | case 3:
130 | llp_out = &_4_out;
131 | break;
132 | case 4:
133 | llp_out = &_5_out;
134 | break;
135 | case 5:
136 | llp_out = &_6_out;
137 | break;
138 | case 6:
139 | llp_out = &_7_out;
140 | break;
141 | case 7:
142 | llp_out = &_8_out;
143 | break;
144 | default:
145 | break;
146 | }
147 |
148 | f32& p_out = *llp_out;
149 |
150 | f32 Omega = 2.0 * 3.14159265358979323846 * 1000.0;
151 | f32 n = 1 / (sr3 + Omega);
152 | f32 a0 = 2 * Omega * n;
153 | f32 b1 = (sr3 - Omega) * n;
154 |
155 | for (u32 i = 0; i < processData->SamplesCount; i++) {
156 | p_out = a0 * OutCh[i] + b1 * p_out;
157 | OutCh[i] = OutCh[i] + lgain * p_out + hgain * (OutCh[i] - p_out);
158 | if (OutCh[i] >= 6.0f) OutCh[i] = 6.0f;
159 | if (OutCh[i] <= -6.0f) OutCh[i] = -6.0f;
160 | }
161 | }
162 | }
163 |
164 | void SetEffectParameter(void* pParam)
165 | {
166 | CurrentParams = (TILTEQ_PARAMETER*)pParam;
167 | }
168 |
169 | void Reset()
170 | {
171 | SamplesAdd = 0;
172 | _1_out = 0;
173 | _2_out = 0;
174 | _3_out = 0;
175 | _4_out = 0;
176 | _5_out = 0;
177 | _6_out = 0;
178 | _7_out = 0;
179 | _8_out = 0;
180 | }
181 |
182 | TILTEQ_PARAMETER* CurrentParams;
183 | i32 SamplesAdd;
184 | f32 _1_out = 0;
185 | f32 _2_out = 0;
186 | f32 _3_out = 0;
187 | f32 _4_out = 0;
188 | f32 _5_out = 0;
189 | f32 _6_out = 0;
190 | f32 _7_out = 0;
191 | f32 _8_out = 0;
192 | };
193 |
--------------------------------------------------------------------------------
/src/dynation/Validator.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (C) Anton Kovalev (vertver), 2018 - 2022. All rights reserved.
3 | * Copyright (C) Vladimir Shatrov (frowrik), 2018 - 2022. All rights reserved.
4 | * Dynation plugin
5 | * MIT License
6 | ***************************************************************************/
7 | #pragma once
8 | #include "VST2_Header.h"
9 |
10 | class KeyValidation
11 | {
12 | private:
13 | public:
14 | bool SetKey(string128 KeyStr)
15 | {
16 | return true;
17 | }
18 |
19 | bool ValidateKey()
20 | {
21 | return true;
22 | }
23 | };
24 |
--------------------------------------------------------------------------------
/src/dynation/compressor.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vertver/Dynation/ac4a2f7b53fb204fae1a5f94125111e2fd2b0506/src/dynation/compressor.cpp
--------------------------------------------------------------------------------
/src/dynation/main_PresetList.cpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (C) Anton Kovalev (vertver), 2018 - 2022. All rights reserved.
3 | * Copyright (C) Vladimir Shatrov (frowrik), 2018 - 2022. All rights reserved.
4 | * Dynation plugin
5 | * MIT License
6 | ***************************************************************************/
7 | #include "Header.h"
8 |
9 | void PluginDistortion::LoadDefaultPresets( ) {
10 | {
11 | auto& data = PresetsDefault[0];
12 | vst_strncpy(data.Name, "Init", 64);
13 | data.Version = VERSION;
14 | data.Params[0] = ParametrToParams(0, 0); // TypeDistortion
15 | data.Params[1] = ParametrToParams(1, 0); // InVolume
16 | data.Params[2] = ParametrToParams(2, 0); // OutVolume
17 | data.Params[3] = ParametrToParams(3, 0.00); // DriveLevel
18 | data.Params[4] = ParametrToParams(4, 32); // BitLevel
19 | data.Params[5] = ParametrToParams(5, 1.00); // SampleRateLevel
20 | data.Params[6] = ParametrToParams(6, 0.00); // EQLevel
21 | data.Params[7] = ParametrToParams(7, 1.00); // DryWetLevel
22 | data.Params[8] = ParametrToParams(8, 0.00); // CurvenessLevel
23 | data.Params[9] = ParametrToParams(9, 0.001f * 0.1f); // Compressor_Attack
24 | data.Params[10] = ParametrToParams(10, 0.001f * 10.0f); // Compressor_Release
25 | data.Params[11] = ParametrToParams(11, 0.0); // Compressor_Trashold
26 | data.Params[12] = ParametrToParams(12, 1.0); // Compressor_Ratio
27 | data.Params[13] = ParametrToParams(13, 0.0); // Compressor_Gain
28 | data.Params[14] = ParametrToParams(14, 0); // Oversampling
29 | data.Params[15] = ParametrToParams(15, 0); // Compressor_Post
30 | }
31 |
32 | {
33 | auto& data = PresetsDefault[1];
34 | vst_strncpy(data.Name, "BASS Gentle FatSub", 64);
35 | data.Version = VERSION;
36 | data.Params[0] = 0.0f;
37 | data.Params[1] = 0.5f;
38 | data.Params[2] = 0.5f;
39 | data.Params[3] = 0.0f;
40 | data.Params[4] = 1.0f;
41 | data.Params[5] = 1.0f;
42 | data.Params[6] = 0.423333406f;
43 | data.Params[7] = 1.0f;
44 | data.Params[8] = 1.0f;
45 | data.Params[9] = 0.223333344;
46 | data.Params[10] = 0.07100000023;
47 | data.Params[11] = 0.0633335545;
48 | data.Params[12] = 0.0600000545;
49 | data.Params[13] = 0.506666660;
50 | data.Params[14] = 1.0f;
51 | data.Params[15] = 0.0f;
52 | }
53 |
54 | {
55 | auto& data = PresetsDefault[2];
56 | vst_strncpy(data.Name, "BASS Heavy FatSub", 64);
57 | data.Version = VERSION;
58 | data.Params[0] = 0.0f;
59 | data.Params[1] = 0.5f;
60 | data.Params[2] = 0.507000029f;
61 | data.Params[3] = 0.0f;
62 | data.Params[4] = 1.0f;
63 | data.Params[5] = 1.0f;
64 | data.Params[6] = 0.436666727f;
65 | data.Params[7] = 1.0f;
66 | data.Params[8] = 1.0f;
67 | data.Params[9] = 0.223333344;
68 | data.Params[10] = 0.07100000023;
69 | data.Params[11] = 0.0633335545;
70 | data.Params[12] = 0.0600000545;
71 | data.Params[13] = 0.519999981;
72 | data.Params[14] = 1.0f;
73 | data.Params[15] = 0.0f;
74 | }
75 |
76 | {
77 | auto& data = PresetsDefault[3];
78 | vst_strncpy(data.Name, "DRM Cymbal Fattener", 64);
79 | data.Version = VERSION;
80 | data.Params[0] = 0.0f;
81 | data.Params[1] = 0.510000229f;
82 | data.Params[2] = 0.5f;
83 | data.Params[3] = 1.0f;
84 | data.Params[4] = 1.0f;
85 | data.Params[5] = 1.0f;
86 | data.Params[6] = 0.5f;
87 | data.Params[7] = 1.0f;
88 | data.Params[8] = 0.0f;
89 | data.Params[9] = 0.169999942;
90 | data.Params[10] = 0.0900000110;
91 | data.Params[11] = 0.0733335018;
92 | data.Params[12] = 0.896666646;
93 | data.Params[13] = 0.533333302;
94 | data.Params[14] = 0.5f;
95 | data.Params[15] = 0.0f;
96 | }
97 |
98 | {
99 | auto& data = PresetsDefault[4];
100 | vst_strncpy(data.Name, "DRM Smack That Drum", 64);
101 | data.Version = VERSION;
102 | data.Params[0] = 0.0f;
103 | data.Params[1] = 0.5f;
104 | data.Params[2] = 0.506666660f;
105 | data.Params[3] = 0.5066666850f;
106 | data.Params[4] = 1.0f;
107 | data.Params[5] = 1.0f;
108 | data.Params[6] = 0.5f;
109 | data.Params[7] = 1.0f;
110 | data.Params[8] = 1.0f;
111 | data.Params[9] = 0.320000023;
112 | data.Params[10] = 0.0710000023;
113 | data.Params[11] = 0.0633335635;
114 | data.Params[12] = 0.253333330;
115 | data.Params[13] = 0.539999962;
116 | data.Params[14] = 1.0f;
117 | data.Params[15] = 0.0f;
118 | }
119 |
120 | {
121 | auto& data = PresetsDefault[5];
122 | vst_strncpy(data.Name, "VOX Push n Pull", 64);
123 | data.Version = VERSION;
124 | data.Params[0] = 0.0f;
125 | data.Params[1] = 0.5f;
126 | data.Params[2] = 0.506666660f;
127 | data.Params[3] = 0.0700001493;
128 | data.Params[4] = 1.0f;
129 | data.Params[5] = 1.0f;
130 | data.Params[6] = 0.5f;
131 | data.Params[7] = 1.0f;
132 | data.Params[8] = 1.0f;
133 | data.Params[9] = 0.170000061;
134 | data.Params[10] = 0.107666649;
135 | data.Params[11] = 0.0633335635;
136 | data.Params[12] = 0.776666462;
137 | data.Params[13] = 0.599999905;
138 | data.Params[14] = 1.0f;
139 | data.Params[15] = 0.0f;
140 | }
141 |
142 | // copy to used presets
143 | memcpy(&Presets[0], &PresetsDefault[0], DEFAULT_PRESET_COUNT * sizeof(PluginPreset));
144 | }
145 |
--------------------------------------------------------------------------------
/src/dynation/musor.h:
--------------------------------------------------------------------------------
1 | #if 0
2 | if (SpecialAspectWH < 75 * 0.01) { // если ширина плагина меньше каковото размера то отключаем блок
3 | f32 BigSizeScale = (2098/1049); //
4 |
5 | Width2BloockPercent[0] *= BigSizeScale;
6 | Width2BloockPercent[1] *= BigSizeScale;
7 | Width2BloockPercent[3] *= BigSizeScale;
8 | Width2BloockPercent[4] = 0;
9 | Width2BloockPercent[5] = 0;
10 | Width2BloockPercent[6] *= BigSizeScale;
11 |
12 | Width2BloockPercent[2] = 1.0 - Width2BloockPercent[0] -Width2BloockPercent[1] - Width2BloockPercent[3]
13 | - Width2BloockPercent[4] - Width2BloockPercent[5] - Width2BloockPercent[6];
14 |
15 | HideCompessor = true;
16 | } else {
17 | HideCompessor = false;
18 |
19 | // чтобы левая часть не становилась меньше начального размера зжимаем правую часть
20 | f32 MainBlockAspect = Width2BloockPercent[2] * Width1Bloock[1].Size.x / Width1Bloock[1].Size.y;
21 | f32 MainBlockAspectNead = (798.0/1154.0);
22 | if (MainBlockAspect < MainBlockAspectNead) {
23 | f32 OffsetPercent = MainBlockAspectNead/MainBlockAspect; // относительно
24 | Width2BloockPercent[2] *= OffsetPercent;
25 | Width2BloockPercent[0] *= OffsetPercent;
26 | Width2BloockPercent[6] *= OffsetPercent;
27 |
28 | Width2BloockPercent[4] = 1.0 - Width2BloockPercent[0] -Width2BloockPercent[1] - Width2BloockPercent[2]
29 | - Width2BloockPercent[3] - Width2BloockPercent[5] - Width2BloockPercent[6];
30 | }
31 | }
32 | #endif
--------------------------------------------------------------------------------
/src/dynation/r8brain/CDSPProcessor.h:
--------------------------------------------------------------------------------
1 | //$ nobt
2 | //$ nocpp
3 |
4 | /**
5 | * @file CDSPProcessor.h
6 | *
7 | * @brief The base virtual class for DSP processing algorithms.
8 | *
9 | * This file includes the base virtual class for DSP processing algorithm
10 | * classes like FIR filtering and interpolation.
11 | *
12 | * r8brain-free-src Copyright (c) 2013-2018 Aleksey Vaneev
13 | * See the "License.txt" file for license.
14 | */
15 |
16 | #ifndef R8B_CDSPPROCESSOR_INCLUDED
17 | #define R8B_CDSPPROCESSOR_INCLUDED
18 |
19 | #include "r8bbase.h"
20 |
21 | namespace r8b {
22 |
23 | /**
24 | * @brief The base virtual class for DSP processing algorithms.
25 | *
26 | * This class can be used as a base class for various DSP processing
27 | * algorithms (processors). DSP processors that are derived from this class
28 | * can be seamlessly integrated into various DSP processing graphs.
29 | */
30 |
31 | class CDSPProcessor : public R8B_BASECLASS
32 | {
33 | R8BNOCTOR( CDSPProcessor );
34 |
35 | public:
36 | CDSPProcessor()
37 | {
38 | }
39 |
40 | virtual ~CDSPProcessor()
41 | {
42 | }
43 |
44 | /**
45 | * @return The latency, in samples, which is present in the output signal.
46 | * This value is usually zero if the DSP processor "consumes" the latency
47 | * automatically.
48 | */
49 |
50 | virtual int getLatency() const = 0;
51 |
52 | /**
53 | * @return Fractional latency, in samples, which is present in the output
54 | * signal. This value is usually zero if a linear-phase filtering is used.
55 | * With minimum-phase filters in use, this value can be non-zero even if
56 | * the getLatency() function returns zero.
57 | */
58 |
59 | virtual double getLatencyFrac() const = 0;
60 |
61 | /**
62 | * @param MaxInLen The number of samples planned to process at once, at
63 | * most.
64 | * @return The maximal length of the output buffer required when
65 | * processing the "MaxInLen" number of input samples.
66 | */
67 |
68 | virtual int getMaxOutLen( const int MaxInLen ) const = 0;
69 |
70 | /**
71 | * Function clears (resets) the state of *this object and returns it to
72 | * the state after construction. All input data accumulated in the
73 | * internal buffer so far will be discarded.
74 | */
75 |
76 | virtual void clear() = 0;
77 |
78 | /**
79 | * Function performs DSP processing.
80 | *
81 | * @param ip Input data pointer.
82 | * @param l0 How many samples to process.
83 | * @param[out] op0 Output data pointer. The capacity of this buffer should
84 | * be equal to the value returned by the getMaxOutLen() function for the
85 | * given "l0". This buffer can be equal to "ip" only if the
86 | * getMaxOutLen( l0 ) function returned a value lesser than "l0". This
87 | * pointer can be incremented on function's return if latency compensation
88 | * was performed by the processor. Note that on function's return, this
89 | * pointer may point to some internal buffers, including the "ip" buffer,
90 | * ignoring the originally passed value.
91 | * @return The number of output samples written to the "op0" buffer and
92 | * available after processing. This value can be smaller or larger in
93 | * comparison to the original "l0" value due to processing and filter's
94 | * latency compensation that took place, and due to resampling if it was
95 | * performed.
96 | */
97 |
98 | virtual int process( double* ip, int l0, double*& op0 ) = 0;
99 | };
100 |
101 | } // namespace r8b
102 |
103 | #endif // R8B_CDSPPROCESSOR_INCLUDED
104 |
--------------------------------------------------------------------------------
/src/dynation/r8brain/pffft.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2013 Julien Pommier ( pommier@modartt.com )
2 |
3 | Based on original fortran 77 code from FFTPACKv4 from NETLIB,
4 | authored by Dr Paul Swarztrauber of NCAR, in 1985.
5 |
6 | As confirmed by the NCAR fftpack software curators, the following
7 | FFTPACKv5 license applies to FFTPACKv4 sources. My changes are
8 | released under the same terms.
9 |
10 | FFTPACK license:
11 |
12 | http://www.cisl.ucar.edu/css/software/fftpack5/ftpk.html
13 |
14 | Copyright (c) 2004 the University Corporation for Atmospheric
15 | Research ("UCAR"). All rights reserved. Developed by NCAR's
16 | Computational and Information Systems Laboratory, UCAR,
17 | www.cisl.ucar.edu.
18 |
19 | Redistribution and use of the Software in source and binary forms,
20 | with or without modification, is permitted provided that the
21 | following conditions are met:
22 |
23 | - Neither the names of NCAR's Computational and Information Systems
24 | Laboratory, the University Corporation for Atmospheric Research,
25 | nor the names of its sponsors or contributors may be used to
26 | endorse or promote products derived from this Software without
27 | specific prior written permission.
28 |
29 | - Redistributions of source code must retain the above copyright
30 | notices, this list of conditions, and the disclaimer below.
31 |
32 | - Redistributions in binary form must reproduce the above copyright
33 | notice, this list of conditions, and the disclaimer below in the
34 | documentation and/or other materials provided with the
35 | distribution.
36 |
37 | THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
38 | EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF
39 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
40 | NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
41 | HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT, INCIDENTAL, SPECIAL,
42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY, WHETHER IN AN
43 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
44 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
45 | SOFTWARE.
46 | */
47 |
48 | /*
49 | PFFFT : a Pretty Fast FFT.
50 |
51 | This is basically an adaptation of the single precision fftpack
52 | (v4) as found on netlib taking advantage of SIMD instruction found
53 | on cpus such as intel x86 (SSE1), powerpc (Altivec), and arm (NEON).
54 |
55 | For architectures where no SIMD instruction is available, the code
56 | falls back to a scalar version.
57 |
58 | Restrictions:
59 |
60 | - 1D transforms only, with 32-bit single precision.
61 |
62 | - supports only transforms for inputs of length N of the form
63 | N=(2^a)*(3^b)*(5^c), a >= 5, b >=0, c >= 0 (32, 48, 64, 96, 128,
64 | 144, 160, etc are all acceptable lengths). Performance is best for
65 | 128<=N<=8192.
66 |
67 | - all (float*) pointers in the functions below are expected to
68 | have an "simd-compatible" alignment, that is 16 bytes on x86 and
69 | powerpc CPUs.
70 |
71 | You can allocate such buffers with the functions
72 | pffft_aligned_malloc / pffft_aligned_free (or with stuff like
73 | posix_memalign..)
74 |
75 | */
76 |
77 | #ifndef PFFFT_H
78 | #define PFFFT_H
79 |
80 | #include // for size_t
81 | #include // Addition by AV.
82 |
83 | #ifdef __cplusplus
84 | extern "C" {
85 | #endif
86 |
87 | /* opaque struct holding internal stuff (precomputed twiddle factors)
88 | this struct can be shared by many threads as it contains only
89 | read-only data.
90 | */
91 | typedef struct PFFFT_Setup PFFFT_Setup;
92 |
93 | /* direction of the transform */
94 | typedef enum { PFFFT_FORWARD, PFFFT_BACKWARD } pffft_direction_t;
95 |
96 | /* type of transform */
97 | typedef enum { PFFFT_REAL, PFFFT_COMPLEX } pffft_transform_t;
98 |
99 | /*
100 | prepare for performing transforms of size N -- the returned
101 | PFFFT_Setup structure is read-only so it can safely be shared by
102 | multiple concurrent threads.
103 | */
104 | PFFFT_Setup *pffft_new_setup(int N, pffft_transform_t transform);
105 | void pffft_destroy_setup(PFFFT_Setup *);
106 | /*
107 | Perform a Fourier transform , The z-domain data is stored in the
108 | most efficient order for transforming it back, or using it for
109 | convolution. If you need to have its content sorted in the
110 | "usual" way, that is as an array of interleaved complex numbers,
111 | either use pffft_transform_ordered , or call pffft_zreorder after
112 | the forward fft, and before the backward fft.
113 |
114 | Transforms are not scaled: PFFFT_BACKWARD(PFFFT_FORWARD(x)) = N*x.
115 | Typically you will want to scale the backward transform by 1/N.
116 |
117 | The 'work' pointer should point to an area of N (2*N for complex
118 | fft) floats, properly aligned. If 'work' is NULL, then stack will
119 | be used instead (this is probably the best strategy for small
120 | FFTs, say for N < 16384).
121 |
122 | input and output may alias.
123 | */
124 | void pffft_transform(PFFFT_Setup *setup, const float *input, float *output, float *work, pffft_direction_t direction);
125 |
126 | /*
127 | Similar to pffft_transform, but makes sure that the output is
128 | ordered as expected (interleaved complex numbers). This is
129 | similar to calling pffft_transform and then pffft_zreorder.
130 |
131 | input and output may alias.
132 | */
133 | void pffft_transform_ordered(PFFFT_Setup *setup, const float *input, float *output, float *work, pffft_direction_t direction);
134 |
135 | /*
136 | call pffft_zreorder(.., PFFFT_FORWARD) after pffft_transform(...,
137 | PFFFT_FORWARD) if you want to have the frequency components in
138 | the correct "canonical" order, as interleaved complex numbers.
139 |
140 | (for real transforms, both 0-frequency and half frequency
141 | components, which are real, are assembled in the first entry as
142 | F(0)+i*F(n/2+1). Note that the original fftpack did place
143 | F(n/2+1) at the end of the arrays).
144 |
145 | input and output should not alias.
146 | */
147 | void pffft_zreorder(PFFFT_Setup *setup, const float *input, float *output, pffft_direction_t direction);
148 |
149 | /*
150 | Perform a multiplication of the frequency components of dft_a and
151 | dft_b and accumulate them into dft_ab. The arrays should have
152 | been obtained with pffft_transform(.., PFFFT_FORWARD) and should
153 | *not* have been reordered with pffft_zreorder (otherwise just
154 | perform the operation yourself as the dft coefs are stored as
155 | interleaved complex numbers).
156 |
157 | the operation performed is: dft_ab += (dft_a * fdt_b)*scaling
158 |
159 | The dft_a, dft_b and dft_ab pointers may alias.
160 | */
161 | void pffft_zconvolve_accumulate(PFFFT_Setup *setup, const float *dft_a, const float *dft_b, float *dft_ab, float scaling);
162 |
163 | /*
164 | the float buffers must have the correct alignment (16-byte boundary
165 | on intel and powerpc). This function may be used to obtain such
166 | correctly aligned buffers.
167 | */
168 | void *pffft_aligned_malloc(size_t nb_bytes);
169 | void pffft_aligned_free(void *);
170 |
171 | /* return 4 or 1 wether support SSE/Altivec instructions was enable when building pffft.c */
172 | int pffft_simd_size();
173 |
174 | #ifdef __cplusplus
175 | }
176 | #endif
177 |
178 | #endif // PFFFT_H
179 |
--------------------------------------------------------------------------------
/src/dynation/r8brain/r8bbase.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file r8bbase.cpp
3 | *
4 | * @brief C++ file that should be compiled and included into your application.
5 | *
6 | * This is a single library file that should be compiled and included into the
7 | * project that uses the "r8brain-free-src" sample rate converter. This file
8 | * defines several global static objects used by the library.
9 | *
10 | * You may also need to include to your project: the "Kernel32" library
11 | * (on Windows) and the "pthread" library on Mac OS X and Linux.
12 | *
13 | * r8brain-free-src Copyright (c) 2013-2019 Aleksey Vaneev
14 | * See the "License.txt" file for license.
15 | */
16 |
17 | #include "CDSPFIRFilter.h"
18 | #include "CDSPFracInterpolator.h"
19 |
20 | namespace r8b {
21 |
22 | #if R8B_FLTTEST
23 | int InterpFilterFracs = -1;
24 | int InterpFilterFracsThird = -1;
25 | #endif // R8B_FLTTEST
26 |
27 | CSyncObject CDSPRealFFTKeeper :: StateSync;
28 | CDSPRealFFT :: CObjKeeper CDSPRealFFTKeeper :: FFTObjects[ 31 ];
29 |
30 | CSyncObject CDSPFIRFilterCache :: StateSync;
31 | CPtrKeeper< CDSPFIRFilter* > CDSPFIRFilterCache :: Objects;
32 | int CDSPFIRFilterCache :: ObjCount = 0;
33 |
34 | CSyncObject CDSPFracDelayFilterBankCache :: StateSync;
35 | CPtrKeeper< CDSPFracDelayFilterBank* > CDSPFracDelayFilterBankCache :: Objects;
36 | CPtrKeeper< CDSPFracDelayFilterBank* > CDSPFracDelayFilterBankCache :: StaticObjects;
37 | int CDSPFracDelayFilterBankCache :: ObjCount = 0;
38 |
39 | } // namespace r8b
40 |
--------------------------------------------------------------------------------
/src/dynation/r8brain/r8bconf.h:
--------------------------------------------------------------------------------
1 | //$ nobt
2 | //$ nocpp
3 |
4 | /**
5 | * @file r8bconf.h
6 | *
7 | * @brief The "configuration" inclusion file you can modify.
8 | *
9 | * This is the "configuration" inclusion file for the "r8brain-free-src"
10 | * sample rate converter. You may redefine the macros here as you see fit.
11 | *
12 | * r8brain-free-src Copyright (c) 2013-2019 Aleksey Vaneev
13 | * See the "License.txt" file for license.
14 | */
15 |
16 | #ifndef R8BCONF_INCLUDED
17 | #define R8BCONF_INCLUDED
18 |
19 | #if defined( _WIN32 ) || defined( _WIN64 )
20 | #define R8B_WIN 1
21 | #elif defined( __APPLE__ )
22 | #define R8B_MAC 1
23 | #else // defined( __APPLE__ )
24 | #define R8B_LNX 1 // Assume Linux (Unix) platform by default.
25 | #endif // defined( __APPLE__ )
26 |
27 | #if !defined( R8B_FLTLEN )
28 | /**
29 | * This macro defines the default fractional delay filter length. Macro is
30 | * used by the r8b::CDSPResampler class.
31 | */
32 |
33 | #define R8B_FLTLEN 28
34 | #endif // !defined( R8B_FLTLEN )
35 |
36 | #if !defined( R8B_FLTFRACS )
37 | /**
38 | * This macro defines the default number of fractional delay filters that
39 | * are sampled by the filter bank. Macro is used by the r8b::CDSPResampler
40 | * class. In order to get consistent results when resampling to/from
41 | * different sample rates, it is suggested to set this macro to a suitable
42 | * prime number.
43 | */
44 |
45 | #define R8B_FLTFRACS 1733
46 | #endif // !defined( R8B_FLTFRACS )
47 |
48 | #if !defined( R8B_IPP )
49 | /**
50 | * Set the R8B_IPP macro definition to 1 to enable the use of Intel IPP's
51 | * fast Fourier transform functions. Also uncomment and correct the IPP
52 | * header inclusion macros.
53 | *
54 | * Do not forget to call the ippInit() function at the start of the
55 | * application, before using this library's functions.
56 | */
57 |
58 | #define R8B_IPP 0
59 |
60 | // #include
61 | // #include
62 | #endif // !defined( R8B_IPP )
63 |
64 | #if !defined( R8BASSERT )
65 | /**
66 | * Assertion macro used to check for certain run-time conditions. By
67 | * default no action is taken if assertion fails.
68 | *
69 | * @param e Expression to check.
70 | */
71 |
72 | #define R8BASSERT( e )
73 | #endif // !defined( R8BASSERT )
74 |
75 | #if !defined( R8BCONSOLE )
76 | /**
77 | * Console output macro, used to output various resampler status strings,
78 | * including filter design parameters, convolver parameters.
79 | *
80 | * @param e Expression to send to the console, usually consists of a
81 | * standard "printf" format string followed by several parameters
82 | * (__VA_ARGS__).
83 | */
84 |
85 | #define R8BCONSOLE( ... )
86 | #endif // !defined( R8BCONSOLE )
87 |
88 | #if !defined( R8B_BASECLASS )
89 | /**
90 | * Macro defines the name of the class from which all classes that are
91 | * designed to be created on heap are derived. The default
92 | * r8b::CStdClassAllocator class uses "stdlib" memory allocation
93 | * functions.
94 | *
95 | * The classes that are best placed on stack or as class members are not
96 | * derived from any class.
97 | */
98 |
99 | #define R8B_BASECLASS :: r8b :: CStdClassAllocator
100 | #endif // !defined( R8B_BASECLASS )
101 |
102 | #if !defined( R8B_MEMALLOCCLASS )
103 | /**
104 | * Macro defines the name of the class that implements raw memory
105 | * allocation functions, see the r8b::CStdMemAllocator class for details.
106 | */
107 |
108 | #define R8B_MEMALLOCCLASS :: r8b :: CStdMemAllocator
109 | #endif // !defined( R8B_MEMALLOCCLASS )
110 |
111 | #if !defined( R8B_FILTER_CACHE_MAX )
112 | /**
113 | * This macro specifies the number of filters kept in the cache at most.
114 | * The actual number can be higher if many different filters are in use at
115 | * the same time.
116 | */
117 |
118 | #define R8B_FILTER_CACHE_MAX 96
119 | #endif // !defined( R8B_FILTER_CACHE_MAX )
120 |
121 | #if !defined( R8B_FRACBANK_CACHE_MAX )
122 | /**
123 | * This macro specifies the number of whole-number stepping fractional
124 | * delay filter banks kept in the cache at most. The actual number can be
125 | * higher if many different filter banks are in use at the same time. As
126 | * filter banks are usually big objects, it is advisable to keep this
127 | * cache size small.
128 | */
129 |
130 | #define R8B_FRACBANK_CACHE_MAX 12
131 | #endif // !defined( R8B_FRACBANK_CACHE_MAX )
132 |
133 | #if !defined( R8B_FLTTEST )
134 | /**
135 | * This macro, when equal to 1, enables fractional delay filter bank
136 | * testing: in this mode the filter bank becomes dynamic member of the
137 | * CDSPFracInterpolator object instead of being a global static object.
138 | */
139 |
140 | #define R8B_FLTTEST 0
141 | #endif // !defined( R8B_FLTTEST )
142 |
143 | #if !defined( R8B_FASTTIMING )
144 | /**
145 | * This macro, when equal to 1, enables fast approach to interpolation
146 | * sample timing. This approach improves interpolation performance
147 | * (by around 15%) at the expense of a minor sample timing drift which is
148 | * on the order of 1e-6 samples per 10 billion output samples. This
149 | * setting does not apply to whole-number stepping if it is in use as this
150 | * stepping provides zero timing error without performance impact. Also
151 | * does not apply to the cases when whole-numbered resampling is in actual
152 | * use.
153 | */
154 |
155 | #define R8B_FASTTIMING 0
156 | #endif // !defined( R8B_FASTTIMING )
157 |
158 | #if !defined( R8B_EXTFFT )
159 | /**
160 | * This macro, when equal to 1, extends length of low-pass filters' FFT
161 | * block by a factor of 2 by zero-padding them. This usually improves the
162 | * overall time performance of the resampler at the expense of higher
163 | * overall latency (initial processing delay). If such delay is not an
164 | * issue, setting this macro to 1 is preferrable. This macro can only have
165 | * a value of 0 or 1.
166 | */
167 |
168 | #define R8B_EXTFFT 0
169 | #endif // !defined( R8B_EXTFFT )
170 |
171 | #if !defined( R8B_PFFFT )
172 | /**
173 | * When defined as 1, enables PFFFT routines which are fast, but limited
174 | * to 24-bit precision.
175 | */
176 |
177 | #define R8B_PFFFT 0
178 | #endif // !defined( R8B_PFFFT )
179 |
180 | #if R8B_PFFFT
181 | #include "pffft.h"
182 | #define R8B_FLOATFFT 1
183 | #endif // R8B_PFFFT
184 |
185 | #if !defined( R8B_FLOATFFT )
186 | /**
187 | * The R8B_FLOATFFT definition enables double-to-float buffer conversion
188 | * for FFT operations for algorithms that work with "float" values.
189 | */
190 |
191 | #define R8B_FLOATFFT 0
192 | #endif // !defined( R8B_FLOATFFT )
193 |
194 | #endif // R8BCONF_INCLUDED
195 |
--------------------------------------------------------------------------------
/src/dynation/vstplug.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | vstpluginmain
3 | main=vstpluginmain
--------------------------------------------------------------------------------
/src/musor.h:
--------------------------------------------------------------------------------
1 | /*
2 | bool Window_Create(HWND Parent = nullptr);
3 | void Window_Destroy();
4 | LRESULT WINAPI Window_WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
5 | public:
6 | HANDLE Window_PaintThread_Handle;
7 | DWORD Window_PaintThread_ID;
8 | bool Window_PaintThread_isRun;
9 |
10 | bool Window_PaintThreadisCreate;
11 | void Window_BeginPaintThread();
12 | void Window_EndPaintThread();
13 | DWORD WINAPI Window_PaintThreadStatic(CONST LPVOID lpParam);
14 | void Window_PaintThread();
15 |
16 | public:
17 | HGLRC OpenGL_Context;
18 | bool OpenGL_ResetContext_isSet;
19 |
20 | bool OpenGL_Create(bool NewCreate = false);
21 | void OpenGL_Destroy();
22 | public:
23 | bool ImGui_Create();
24 | void ImGui_Destroy();
25 | void ImGui_Draw();
26 |
27 | void ImGui_SendWH(ImVec2 Size);
28 | public: // imgui
29 | GLuint g_FontTexture = 0;
30 |
31 | ImFont* fontBig = nullptr;
32 | ImFont* fontNormal = nullptr;
33 |
34 | ImGuiContext* ImGuiContext = nullptr;
35 | void ImGui_ImplOpenGL2_Create(bool ResetWindow = false);
36 | void ImGui_ImplOpenGL2_Destroy();
37 | void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data);
38 | bool ImGui_ImplOpenGL2_CreateFontsTexture();
39 | void ImGui_ImplOpenGL2_DestroyFontsTexture();
40 | */
41 |
42 |
43 | HANDLE WindowMNG_Thread_Handle;
44 | DWORD WindowMNG_Thread_ID;
45 | HANDLE WindowMNG_Thread_ExitEvent;
46 | HANDLE WindowMNG_Thread_ExitEvent2;
47 | HWND WindowMNG_Thread_WindowMessages;
48 |
49 | void WindowMNG_Loop();
50 |
51 | LRESULT WINAPI WindowMNG_WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
52 |
53 | static DWORD WINAPI WindowMNG_hreadStatic(CONST LPVOID lpParam) {
54 | WNDCLASSEX wc = {
55 | sizeof(WNDCLASSEX),
56 | CS_OWNDC,
57 | WindowMNG_WndProc,
58 | 0L,
59 | 0L,
60 | VST2_Window_Instance,
61 | NULL,
62 | NULL,
63 | NULL,
64 | NULL,
65 | "IMPVHDX11",
66 | NULL
67 | };
68 | RegisterClassEx(&wc);
69 |
70 | WindowMNG_Thread_WindowMessages = CreateWindowExA(0, "IMPVHDX11", nullptr, WS_POPUPWINDOW, 0, 0, 1, 1, NULL, NULL, wc.hInstance, NULL);
71 |
72 | while( true ) {
73 | if (WaitForSingleObject(WindowMNG_Thread_ExitEvent, 10) == WAIT_OBJECT_0) break;
74 | WindowMNG_Loop();
75 | }
76 |
77 | DestroyWindow(WindowMNG_Thread_WindowMessages);
78 | UnregisterClassA("IMPVHDX11", VST2_Window_Instance);
79 |
80 |
81 | SetEvent(WindowMNG_Thread_ExitEvent2);
82 | return 0;
83 | }
84 |
85 | void CreateWindowManager( ) {
86 | /*WindowMNG_Thread_ExitEvent = CreateEventA(NULL,FALSE,FALSE,NULL);
87 | WindowMNG_Thread_ExitEvent2 = CreateEventA(NULL,FALSE,FALSE,NULL);
88 | WindowMNG_Thread_ID = 0;
89 | WindowMNG_Thread_Handle = CreateThread(nullptr, 0, LPTHREAD_START_ROUTINE(&WindowMNG_hreadStatic), nullptr, 0, &WindowMNG_Thread_ID);
90 | */
91 | }
92 |
93 | void DestroyWindowManager( ) {
94 | /*SetEvent(WindowMNG_Thread_ExitEvent);
95 |
96 | if (WaitForSingleObject(WindowMNG_Thread_ExitEvent2, 2000) == WAIT_TIMEOUT) TerminateThread(WindowMNG_Thread_Handle, 0 );
97 |
98 | CloseHandle(WindowMNG_Thread_Handle);
99 | CloseHandle(WindowMNG_Thread_ExitEvent);
100 | */
101 |
102 | }
103 |
104 | HWND WindowMNG_CreateWindow( HWND Parent ) {
105 | // wait init parent
106 | while ( WindowMNG_Thread_WindowMessages == (HWND)0 ) Sleep(1);
107 |
108 | HWND res = (HWND)-1;
109 | SendMessageA(WindowMNG_Thread_WindowMessages, (WM_USER + 21),(WPARAM)&res, 0);
110 |
111 | // waitt create
112 | while ( res == (HWND)-1 ) Sleep(1);
113 |
114 | if (res == 0) ErrorMessage("not create window!");
115 |
116 | SetTimer( res, 10, USER_TIMER_MINIMUM, NULL );
117 |
118 | return res;
119 | }
120 |
121 |
122 | void WindowMNG_Loop( ) {
123 | MSG msg;
124 | while (PeekMessageA(&msg, WindowMNG_Thread_WindowMessages, 0U, 0U, PM_REMOVE)) {
125 | TranslateMessage(&msg);
126 | DispatchMessageA(&msg);
127 | }
128 | }
129 |
130 | LRESULT WINAPI WindowMNG_WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) {
131 | // create window extern thread
132 | //if (message == (WM_USER + 21)) {
133 | // HWND* Winout = (HWND*)wParam; // PTR TO HWND
134 | // *Winout = CreateWindowExA(0, "IMPVHDX11", nullptr,
135 | // WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE,
136 | // 0, 0, 1, 1, WindowMNG_Thread_WindowMessages, NULL, VST2_Window_Instance, NULL);
137 | // return 0;
138 | //}
139 |
140 | VST2_WINDOW *ed = reinterpret_cast(GetWindowLongPtrW(hwnd, GWLP_USERDATA));
141 | if (ed) {
142 | LRESULT Result = 0;
143 | if (ed->Window_WndProc(hwnd, message, wParam, lParam, Result)) return Result;
144 | }
145 |
146 | return DefWindowProcA(hwnd, message, wParam, lParam);
147 | }
148 |
149 |
150 |
--------------------------------------------------------------------------------