Skip to content

Commit 3bcf037

Browse files
committed
update
1 parent f8589eb commit 3bcf037

19 files changed

Lines changed: 173 additions & 62 deletions

.github/workflows/build_test.yaml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ jobs:
142142
${{ matrix.pluginval-binary }} --verbose --validate "$TEST_TARGET" --disabled-tests "${{ env.PLUGINVAL_DISABLED }}"
143143
env:
144144
STRICTNESS_LEVEL: 10
145-
REPEAT: 10
145+
REPEAT: 3
146146
TIMEOUT_MS: 300000
147147

148148
- name: Pluginval AU validations (macOS)
@@ -167,5 +167,30 @@ jobs:
167167
env:
168168
STRICTNESS_LEVEL: 10
169169
TIMEOUT_MS: 1440000
170-
REPEAT: 10
170+
REPEAT: 3
171171
RANDOM_SEED: "${{ steps.current-time.outputs.formattedTime }}"
172+
173+
- name: AU Validation with auval (macOS)
174+
if: runner.os == 'macOS'
175+
shell: bash
176+
run: |
177+
USER_COMPONENTS_DIR="$HOME/Library/Audio/Plug-Ins/Components"
178+
AU_FILE_NAME=$(basename "${{ env.AU_PATH }}")
179+
PLIST_PATH="$USER_COMPONENTS_DIR/$AU_FILE_NAME/Contents/Info.plist"
180+
181+
echo "Checking if plugin exists at: $USER_COMPONENTS_DIR/$AU_FILE_NAME"
182+
183+
COUNT=$(/usr/libexec/PlistBuddy -c "Print :AudioComponents" "$PLIST_PATH" | grep -E "^ [a-zA-Z]+" | wc -l | xargs)
184+
echo "Found $COUNT component(s) in bundle."
185+
186+
for (( i=0; i<$COUNT; i++ )); do
187+
TYPE=$(/usr/libexec/PlistBuddy -c "Print :AudioComponents:$i:type" "$PLIST_PATH")
188+
SUBT=$(/usr/libexec/PlistBuddy -c "Print :AudioComponents:$i:subtype" "$PLIST_PATH")
189+
MANU=$(/usr/libexec/PlistBuddy -c "Print :AudioComponents:$i:manufacturer" "$PLIST_PATH")
190+
191+
echo "-----------------------------------------------"
192+
echo "Validating Component $i: Type='$TYPE', Subtype='$SUBT', Manu='$MANU'"
193+
echo "-----------------------------------------------"
194+
195+
auval -v "$TYPE" "$SUBT" "$MANU"
196+
done

CMakeLists.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,28 @@ if(APPLE)
8484
src/dsp/dsp_avx.cpp
8585
src/dsp/dsp_sse4.cpp
8686
src/dsp/dsp_sse2.cpp
87+
src/dsp/dsp_avx2_fma.cpp
8788
)
88-
set_source_files_properties("src/dsp/dsp_neon.cpp" PROPERTIES COMPILE_FLAGS "-arch arm64")
89-
set_source_files_properties("src/dsp/dsp_sse2.cpp" PROPERTIES COMPILE_FLAGS "-arch x86_64 -msse2")
90-
set_source_files_properties("src/dsp/dsp_sse4.cpp" PROPERTIES COMPILE_FLAGS "-arch x86_64 -msse4.1")
91-
set_source_files_properties("src/dsp/dsp_avx.cpp" PROPERTIES COMPILE_FLAGS "-arch x86_64 -mavx")
92-
set_source_files_properties("src/dsp/dsp_avx2.cpp" PROPERTIES COMPILE_FLAGS "-arch x86_64 -mavx2")
89+
set_source_files_properties("src/dsp/dsp_neon.cpp" PROPERTIES COMPILE_FLAGS "-arch arm64 -ffast-math -Wno-nan-infinity-disabled")
90+
set_source_files_properties("src/dsp/dsp_sse2.cpp" PROPERTIES COMPILE_FLAGS "-arch x86_64 -msse2 -ffast-math -Wno-nan-infinity-disabled")
91+
set_source_files_properties("src/dsp/dsp_sse4.cpp" PROPERTIES COMPILE_FLAGS "-arch x86_64 -msse4.1 -ffast-math -Wno-nan-infinity-disabled")
92+
set_source_files_properties("src/dsp/dsp_avx.cpp" PROPERTIES COMPILE_FLAGS "-arch x86_64 -mavx -ffast-math -Wno-nan-infinity-disabled")
93+
set_source_files_properties("src/dsp/dsp_avx2.cpp" PROPERTIES COMPILE_FLAGS "-arch x86_64 -mavx2 -ffast-math -Wno-nan-infinity-disabled")
94+
set_source_files_properties("src/dsp/dsp_avx2_fma.cpp" PROPERTIES COMPILE_FLAGS "-arch x86_64 -mavx2 -mfma -ffast-math -Wno-nan-infinity-disabled")
9395
else()
9496
target_sources(${PROJECT_NAME}
9597
PRIVATE
98+
src/dsp/dsp_avx2_fma.cpp
9699
src/dsp/dsp_avx2.cpp
97100
src/dsp/dsp_avx.cpp
98101
src/dsp/dsp_sse4.cpp
99102
src/dsp/dsp_sse2.cpp
100103
)
101-
set_source_files_properties("src/dsp/dsp_sse2.cpp" PROPERTIES COMPILE_FLAGS "-msse2")
102-
set_source_files_properties("src/dsp/dsp_sse4.cpp" PROPERTIES COMPILE_FLAGS "-msse4.1")
103-
set_source_files_properties("src/dsp/dsp_avx.cpp" PROPERTIES COMPILE_FLAGS "-mavx")
104-
set_source_files_properties("src/dsp/dsp_avx2.cpp" PROPERTIES COMPILE_FLAGS "-mavx2")
104+
set_source_files_properties("src/dsp/dsp_sse2.cpp" PROPERTIES COMPILE_FLAGS "-msse2 -ffast-math -Wno-nan-infinity-disabled")
105+
set_source_files_properties("src/dsp/dsp_sse4.cpp" PROPERTIES COMPILE_FLAGS "-msse4.1 -ffast-math -Wno-nan-infinity-disabled")
106+
set_source_files_properties("src/dsp/dsp_avx.cpp" PROPERTIES COMPILE_FLAGS "-mavx -ffast-math -Wno-nan-infinity-disabled")
107+
set_source_files_properties("src/dsp/dsp_avx2.cpp" PROPERTIES COMPILE_FLAGS "-mavx2 -ffast-math -Wno-nan-infinity-disabled")
108+
set_source_files_properties("src/dsp/dsp_avx2_fma.cpp" PROPERTIES COMPILE_FLAGS "-mavx2 -mfma -ffast-math -Wno-nan-infinity-disabled")
105109
endif()
106110

107111
# 头文件目录

README.md

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,83 @@
11
# plugin template
2+
一个插件模板。
3+
A plugin template.
24

3-
## MacOS
5+
## Install Plugin / 安装插件
6+
7+
GitHub Release 里的 zip 是按平台分别打包的,解压后目录会多一层平台文件夹,这个是正常的。
8+
GitHub Release zip files are packaged per platform, so it is normal to see one extra platform folder after extraction.
9+
10+
你真正需要复制的是插件 bundle 本身,不是 `Release``VST3` / `AU` / `LV2` 这一层目录。
11+
What you actually need to copy is the plugin bundle itself, not the `Release` or `VST3` / `AU` / `LV2` folder that contains it.
12+
13+
解压后大致会看到这样的结构:
14+
After extraction, the folder structure will look roughly like this:
15+
16+
```text
17+
plugin-win-vX.Y.Z.zip
18+
plugin-win/
19+
PluginName_artefacts/
20+
VST3/
21+
PluginName.vst3/
22+
23+
plugin-macos-vX.Y.Z.zip
24+
plugin-macos/
25+
PluginName_artefacts/
26+
AU/
27+
PluginName.component/
28+
VST3/
29+
PluginName.vst3/
30+
31+
plugin-linux-vX.Y.Z.zip
32+
plugin-linux/
33+
PluginName_artefacts/
34+
LV2/
35+
PluginName.lv2/
36+
VST3/
37+
PluginName.vst3/
38+
```
39+
40+
安装时请直接复制这些文件夹之一:
41+
When installing, copy one of these folders directly:
42+
43+
- `PluginName.vst3`
44+
- `PluginName.component`
45+
- `PluginName.lv2`
46+
47+
常见安装目录:
48+
Common install locations:
49+
50+
- Windows VST3: `C:\Program Files\Common Files\VST3\`
51+
- macOS VST3: `/Library/Audio/Plug-Ins/VST3/` or `~/Library/Audio/Plug-Ins/VST3/`
52+
- macOS AU: `/Library/Audio/Plug-Ins/Components/` or `~/Library/Audio/Plug-Ins/Components/`
53+
- Linux LV2: `~/.lv2/` or `/usr/lib/lv2/`
54+
- Linux VST3: `~/.vst3/` or `/usr/lib/vst3/`
55+
56+
例如在 Windows 上,不要复制 `VST3` 文件夹本身,而是把其中的 `PluginName.vst3` 整个文件夹复制到 `C:\Program Files\Common Files\VST3\`
57+
For example, on Windows, do not copy the `VST3` folder itself. Copy the whole `PluginName.vst3` folder inside it to `C:\Program Files\Common Files\VST3\`.
58+
59+
额外的,macOS 用户还需要做以下工作:
60+
Additionally, macOS users may need to do the following:
461

562
```bash
663
sudo xattr -dr com.apple.quarantine /path/to/your/plugins/plugin_name.component
764
sudo xattr -dr com.apple.quarantine /path/to/your/plugins/plugin_name.vst3
865
sudo xattr -dr com.apple.quarantine /path/to/your/plugins/plugin_name.lv2
966
```
10-
## build
67+
68+
如果 macOS 阻止打开下载的插件,可以对插件 bundle 执行上面的命令来移除 quarantine 属性。
69+
If macOS blocks a downloaded plugin, you can run the commands above on the plugin bundle to remove the quarantine attribute.
70+
71+
## Build / 构建
1172

1273
```bash
1374
git clone --recurse https://github.com/ManasWorld/plugin-template.git
1475

15-
# windows
76+
# Windows
1677
cmake -G "Ninja" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang -DCMAKE_BUILD_TYPE=Release -S . -B build
1778
cmake --build build --config Release
1879

19-
# linux
80+
# Linux
2081
sudo apt update
2182
sudo apt-get install libx11-dev libfreetype-dev libfontconfig1-dev libasound2-dev libxrandr-dev libxinerama-dev libxcursor-dev
2283
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -S . -B .build

libs/simde

Submodule simde updated 1 file

resources/FSEX300.ttf

562 KB
Binary file not shown.

src/PluginProcessor.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ EmptyAudioProcessor::EmptyAudioProcessor()
1212
.withOutput("Output", juce::AudioChannelSet::stereo(), true)
1313
#endif
1414
) {
15+
dsp_processor_ = dsp::GetProcessorDsp();
16+
1517
juce::AudioProcessorValueTreeState::ParameterLayout layout;
1618

1719
value_tree_ = std::make_unique<juce::AudioProcessorValueTreeState>(*this, nullptr, kParameterValueTreeIdentify,
@@ -84,8 +86,11 @@ void EmptyAudioProcessor::changeProgramName(int index, const juce::String& newNa
8486

8587
//==============================================================================
8688
void EmptyAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock) {
89+
if (!dsp_processor_.IsValid()) return;
90+
8791
float fs = static_cast<float>(sampleRate);
8892
param_listener_.MarkAll();
93+
dsp_processor_.init(dsp_state_, fs);
8994
}
9095

9196
void EmptyAudioProcessor::releaseResources() {
@@ -116,12 +121,18 @@ bool EmptyAudioProcessor::isBusesLayoutSupported(const BusesLayout& layouts) con
116121
}
117122

118123
void EmptyAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages) {
124+
if (!dsp_processor_.IsValid()) return;
125+
119126
juce::ScopedNoDenormals noDenormals;
120127
param_listener_.HandleDirty();
121128

122-
size_t const num_samples = buffer.getNumSamples();
129+
const int num_samples = buffer.getNumSamples();
123130
float* left_ptr = buffer.getWritePointer(0);
124-
float* right_ptr = buffer.getWritePointer(1);
131+
float* right_ptr = nullptr;
132+
if (buffer.getNumChannels() == 2) {
133+
right_ptr = buffer.getWritePointer(1);
134+
}
135+
dsp_processor_.process(dsp_state_, left_ptr, right_ptr, num_samples);
125136
}
126137

127138
//==============================================================================

src/PluginProcessor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "pluginshared/preset_manager.hpp"
44
#include "pluginshared/wrap_parameters.hpp"
55

6+
#include "dsp/dsp_state.hpp"
7+
68
class EmptyAudioProcessor final : public juce::AudioProcessor {
79
public:
810
static constexpr auto kParameterValueTreeIdentify = "PARAMETERS";
@@ -45,6 +47,9 @@ class EmptyAudioProcessor final : public juce::AudioProcessor {
4547
JuceParamListener param_listener_;
4648
std::unique_ptr<juce::AudioProcessorValueTreeState> value_tree_;
4749
std::unique_ptr<pluginshared::PresetManager> preset_manager_;
50+
51+
dsp::DspProcessor dsp_processor_;
52+
dsp::DspState dsp_state_;
4853
private:
4954
//==============================================================================
5055
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(EmptyAudioProcessor)

src/dsp/dsp_avx.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#define DSP_EXPORT_NAME dsp_avx
2+
#define DSP_INST_NAME "avx"
23
#include "dsp_lane8_template.cpp"

src/dsp/dsp_avx2.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#define DSP_EXPORT_NAME dsp_avx2
2+
#define DSP_INST_NAME "avx2"
23
#include "dsp_lane8_template.cpp"

src/dsp/dsp_avx2_fma.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#define DSP_EXPORT_NAME dsp_avx2_fma
2+
#define DSP_INST_NAME "avx2/fma"
3+
#include "dsp_lane8_template.cpp"

0 commit comments

Comments
 (0)