Skip to content

Commit c935b52

Browse files
authored
Feature/synthdef instance (#18)
Implementation of synthdef persistance into plugin with midi handling
1 parent c362aeb commit c935b52

File tree

109 files changed

+2796
-820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2796
-820
lines changed

.github/workflows/project-pipeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,4 @@ jobs:
143143
${{github.workspace}}/build/*_artefacts/${{ env.BUILD_TYPE }}/VST3/*.vst3/**
144144
${{github.workspace}}/build/*_artefacts/${{ env.BUILD_TYPE }}/CLAP/*.clap/**
145145
${{github.workspace}}/build/*_artefacts/${{ env.BUILD_TYPE }}/Standalone/*.exe
146+
#${{github.workspace}}/build/*_artefacts/${{ env.BUILD_TYPE }}/Standalone/*.pdb

CMakeLists.txt

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ set_property(SOURCE ${SC_DIR}/common/SC_Filesystem_macos.cpp PROPERTY COMPILE_FL
4141

4242
set(CMAKE_MODULE_PATH ${SC_DIR}/cmake_modules)
4343
include (${SC_DIR}/cmake_modules/FinalFile.cmake)
44+
4445
if (NOT APPLE AND NOT WIN32)
4546
set(SNDFILE_INCLUDE_DIR ${SC_DIR}/external_libraries/libsndfile)
4647
include (${SC_DIR}/cmake_modules/FindSndfile.cmake)
@@ -51,7 +52,7 @@ else()
5152
FetchContent_Declare(
5253
sndfile
5354
GIT_REPOSITORY "https://github.com/libsndfile/libsndfile"
54-
GIT_TAG 17a19ab264fcf238f46104cea9af9a0a5ca3786d
55+
GIT_TAG ea9ff560b4c2086c2f1cae3f02287768a0de4673
5556
GIT_PROGRESS TRUE
5657
GIT_SHALLOW TRUE
5758
)
@@ -87,7 +88,7 @@ include_directories(${SC_DIR}/external_libraries
8788
${SC_DIR}/include/plugin_interface
8889
${SC_DIR}/server/scsynth/
8990
${SC_DIR}/server/common
90-
${CMAKE_CURRENT_SOURCE_DIR}/Source
91+
${CMAKE_CURRENT_SOURCE_DIR}/source
9192
)
9293

9394
# This is a hack since we will define our own Driver
@@ -136,8 +137,8 @@ if(MSVC)
136137
set(${flag} "${${flag}} /wd4996") # The POSIX name for this item is deprecated.
137138
endforeach()
138139

139-
# this flag causes MSVC to correctly report __cplusplus, which prevents a compiler error
140-
# caused by some versions of libsndfile's C++ header redefining nullptr as NULL.
140+
# this flag causes MSVC to correctly report __cplusplus, which prevents a compiler error
141+
# caused by some versions of libsndfile's C++ header redefining nullptr as NULL.
141142
# See https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
142143
add_compile_options("/Zc:__cplusplus")
143144

@@ -152,7 +153,7 @@ endif(MSVC)
152153
IF (EXISTS ${SC_DIR}/build/common)
153154
include_directories(${SC_DIR}/build/common)
154155
ELSE()
155-
include_directories(Source/generated)
156+
include_directories(source/generated)
156157
ENDIF()
157158

158159
if (NOT Boost_FOUND)
@@ -162,17 +163,17 @@ endif()
162163

163164
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS c)
164165

165-
project(PluginCollider VERSION 0.1.0)
166+
project(PluginCollider VERSION 0.2.0)
166167

167168
add_subdirectory(libs/JUCE) # If you've put JUCE in a subdirectory called JUCE
168169

169170
juce_add_plugin(PluginCollider
170171
# VERSION ... # Set this if the plugin version is different to the project version
171-
ICON_BIG Resources/ui/plugincollider_256x256.png
172+
ICON_BIG resources/ui/plugincollider_256x256.png
172173
# ICON_SMALL ...
173174
COMPANY_NAME "Digital Suburban" # Specify the name of the plugin's author
174175
BUNDLE_ID "com.digitalsuburban.PluginCollider" # The bundle identifier for the plugin, if it should be a standalone bundle
175-
IS_SYNTH FALSE # Is this a synth or an effect?
176+
IS_SYNTH TRUE # Is this a synth or an effect?
176177
NEEDS_MIDI_INPUT TRUE # Does the plugin need midi input?
177178
# NEEDS_MIDI_OUTPUT TRUE/FALSE # Does the plugin need midi output?
178179
# IS_MIDI_EFFECT TRUE/FALSE # Is this plugin a MIDI effect?
@@ -205,6 +206,10 @@ if (WIN32)
205206
${SC_DIR}/common/SC_Filesystem_win.cpp)
206207
endif (WIN32)
207208

209+
target_sources(PluginCollider
210+
PRIVATE
211+
source/ext/value_tree_debugger.cpp)
212+
208213
if (NOT SC_DYNAMIC_PLUGINS)
209214
target_sources(PluginCollider
210215
PRIVATE
@@ -271,12 +276,12 @@ target_sources(PluginCollider
271276
${SC_DIR}/server/scsynth/SC_World.cpp
272277

273278
# plugincollider itself =============================
274-
Source/UDPPort.cpp
275-
Source/OSCMessages.cpp
276-
Source/PluginEditor.cpp
277-
Source/PluginProcessor.cpp
278-
Source/SCProcess.cpp
279-
Source/SCPluginDriver.cpp
279+
source/UDPPort.cpp
280+
source/OSCMessages.cpp
281+
source/PluginEditor.cpp
282+
source/PluginProcessor.cpp
283+
source/SCProcess.cpp
284+
source/SCPluginDriver.cpp
280285

281286
${boost_system_sources}
282287
${boost_filesystem_sources})
@@ -294,6 +299,7 @@ target_link_libraries(PluginCollider
294299
PRIVATE
295300
# AudioPluginData # If we'd created a binary data target, we'd link to it here
296301
juce::juce_audio_utils
302+
juce::juce_osc
297303
PUBLIC
298304
juce::juce_recommended_config_flags
299305
juce::juce_recommended_lto_flags

README.md

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,63 @@ Plugincollider
33

44
Plugincollider is a generic (cross-platform/plugin format) wrapper that allows using a [SuperCollider](https://supercollider.github.io/) server inside a VST3 or AU plugin. The embedded server may be controlled over OSC as usual.
55

6-
Now support Linux, macOS and Windows.
6+
![plugincollider screenshot](resources/ui/screenshot_bitwig.png)
77

8-
An external installation of [SuperCollider](https://supercollider.github.io/) is required to run the interpreted code. For now Plugincollider only acts as a server; consider this as a scsynth replacement. The classic SuperCollider UI is still used to send "synths/code" the the server that is running inside the plugin.
8+
Now support Linux, macOS and Windows.
99

1010
*Plugincollider is based on AU version of https://github.com/supercollider/SuperColliderAU*
1111

12-
# State of the project
12+
## State of the project
1313

1414
SuperCollider is a highly modular ecosystem (sc-plugins, scsynth definitions) that needs to be adapted for each platform from the VST3/clap component. For now consider this as a vanilla scsynth implementation with no external plugins.
1515

1616
Latest build are available from [https://github.com/asb2m10/plugincollider/actions](https://github.com/asb2m10/plugincollider/actions)
1717

18-
### Known issues
18+
## Usage - Supercollider server
19+
Plugincollider can be used as a standard SuperCollider server by using the SC IDE (or any other sclang client). You can test the plugin by using this SC code (where Plugincollider is running at 127.0.0.1:8898) :
1920

20-
* Be sure to set your DAW latency size to a power of two (256, 512, 1024) otherwise some SC plugins might not work properly.
21-
* If you are running multiple VST instances, scsynth errors messages might end up into one specific unrelated vst logs since scsynth is design to be run into one single process. Some DAWs has a "Dedicated process" runtime that might resolve the issue.
21+
o = ServerOptions.new;
22+
s = Server.remote(\Plugincollider, NetAddr("127.0.0.1", 8898), o);
23+
{ [SinOsc.ar(439, 0, 0.2), SinOsc.ar(444, 0, 0.2)] }.play(s);
2224

23-
### TODO
25+
## Usage - SynthDefs files
2426

25-
- [ ] implement /midi and /velocity from DAW midi message
26-
- [ ] more accurate OSC DAW timing
27-
- [ ] *macOS* enable Plugincollider to use SuperCollider scsynth plugin that the user previously installed
28-
- [ ] move OSC messages to realtime (dsp) thread
29-
- [x] *Windows* bundle sndfile.dll within the plugin installation
27+
Plugincollider can load previously compiled [SynthDefs](resources/scsyndef) (*.scsyndef) that will be saved within the DAW plugin state. No installation/usage of Supercollider afterwards is required if you want to exclusively use scsyndef files.
28+
29+
If the SynthDef has arguments, they will be exposed to the plugin and the user can set the lower and upper values for each arguments. The user can then easily change them from the Plugincollider UI.
30+
31+
### FX Mode
32+
33+
If there is a SynthDef loaded, the plugin can be put in "FX Mode" that will run this SynthDef on a single node every time the plugin is running. This can be useful if you want to use the plugin as an effect or a drone/noodle.
34+
35+
### Non-Fx Mode (Synth Mode)
36+
37+
In this mode (and when a SynthDef is loaded), everytime Plugincollider receives a midi node, it will trigger this synth based on those parameters:
3038

31-
### macOS notes
39+
| Midi Event | ScSynDef args | Conversion |
40+
| ------------------ | ------------- | ------------------------------------------------------------------- |
41+
| note-on midi note | freq | Converts midi node (0-127) to frequency (hz) |
42+
| note-on velocity | amp | Converts midi velocity (0-127) to amp(0.0-1.0), linearly (for now). |
43+
| note-off | gate | Sends gate=0 on midi note off |
44+
45+
If for example your SynthDef doesn't have the gate arguments, the node will be freed once the note off is triggered.
46+
47+
# Known issues
48+
49+
* Be sure to set your DAW latency size to a power of two (256, 512, 1024) otherwise some SC plugins might not work properly.
50+
* If you are running multiple VST instances, scsynth errors messages might end up into one specific unrelated vst logs since scsynth is design to be run into one single process. Some DAWs has a "Dedicated process" runtime that might resolve this issue.
51+
* PluginCollider is currently built with "static" SC-plugin. It is great because you don't need any SuperCollider installation but it cannot load additional SC-plugins. This will be resolved when we will be able to package the plugin on any platform. (you can disable this by building PluginCollider with the SC_DYNAMIC_PLUGINS directive)
52+
* On Windows, if you are using the github releases, be sure to update the [MSVC Runtime](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022) to the latest version
53+
54+
# TODO
55+
- [ ] add [CLAP](https://github.com/free-audio/clap) plugin format
56+
- [ ] assign scsyndef parameters to controlbus (and plug parameters values)
57+
- [ ] multi scsyndef support
58+
- [x] implement /freq and /amp from DAW midi message
59+
- [ ] *macOS* enable Plugincollider to use SuperCollider scsynth plugin that the user previously installed (handle notarization)
60+
- [x] *Windows* bundle sndfile.dll within the plugin installation
61+
- [ ] more accurate OSC DAW timing
3262

33-
macOS makes it harder to use shared libraries from SuperCollider to Plugincollider. It is easier to build it from your computer for now. I will check how I can do this without having to repackage everything in the plugin within the distribution.
3463

3564
# Interacting with SuperCollider server (scsynth) from DAW
3665

@@ -47,13 +76,13 @@ Plugin parameters are now linked to the first 32 control buses. The SC code must
4776
var sig = SinOsc.ar(freq);
4877
Out.ar(sig, sig!2 * 1);
4978
}).play(s);
50-
79+
5180
b = Bus.control(s, 1);
5281
x.map(\freq, b)
5382

5483
Please note that control buses are not yet read from server to DAW.
5584

56-
## Build instructions
85+
# Build instructions
5786

5887
Be sure to install SuperCollider and JUCE dependencies; dont forget [sndfile](https://github.com/libsndfile/libsndfile) on Linux. Then clone recursivly the repository and build Plugincollider like a normal cmake project :
5988

@@ -63,9 +92,3 @@ Be sure to install SuperCollider and JUCE dependencies; dont forget [sndfile](ht
6392
cd build
6493
cmake .. # add `-G Xcode` if you want to use Xcode
6594
make
66-
67-
In order to test the plugin, with sclang execute this code (replace port 8898 where the server port is actually running):
68-
69-
o = ServerOptions.new;
70-
s = Server.remote(\Plugincollider, NetAddr("127.0.0.1", 8898), o);
71-
{ [SinOsc.ar(439, 0, 0.2), SinOsc.ar(444, 0, 0.2)] }.play(s);

Source/OSCMessages.cpp

Lines changed: 0 additions & 128 deletions
This file was deleted.

Source/OSCMessages.h

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)