Skip to content

Commit 4d1db36

Browse files
author
David Braun
committed
first commit
0 parents  commit 4d1db36

19 files changed

+4069
-0
lines changed

.github/workflows/all.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Compile
2+
on:
3+
pull_request: {}
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
9+
build-windows:
10+
runs-on: windows-latest
11+
12+
strategy:
13+
matrix:
14+
python-version: [3.9]
15+
16+
steps:
17+
# - uses: actions/checkout@v2
18+
# with:
19+
# submodules: true
20+
21+
# - name: Setup Python ${{ matrix.python-version }}
22+
# uses: actions/setup-python@v2
23+
# with:
24+
# python-version: ${{ matrix.python-version }}
25+
26+
# - name: Install Python dependencies
27+
# run: |
28+
# python -m pip install --upgrade pip
29+
# pip install requests
30+
31+
- name: Add msbuild to PATH
32+
uses: microsoft/[email protected]
33+
34+
- name: Get CMake
35+
uses: lukka/get-cmake@latest
36+
37+
- name: Build Windows (Release)
38+
run: |
39+
mkdir build_release
40+
cmake -DCMAKE_BUILD_TYPE=Release -Bbuild_release
41+
cd build_release
42+
msbuild ChucKDesignerCHOP.sln /property:Configuration=Release
43+
44+
build-macos:
45+
runs-on: ${{ matrix.os }}
46+
strategy:
47+
matrix:
48+
python-version: [3.9]
49+
os: [macos-10.15]
50+
steps:
51+
- uses: actions/checkout@v2
52+
with:
53+
submodules: true
54+
55+
- name: Get CMake
56+
uses: lukka/get-cmake@latest
57+
58+
- name: Build libsamplerate
59+
run: |
60+
cd thirdparty/libsamplerate
61+
mkdir build_release
62+
cmake -DCMAKE_BUILD_TYPE=Release -Bbuild_release
63+
make --directory=build_release
64+
65+
- name: Build MacOS (Release)
66+
# the Projucer refers to PYTHONMAJOR
67+
env:
68+
PYTHONMAJOR: ${{ matrix.python-version }}
69+
run: |
70+
mkdir build_release
71+
cmake -DCMAKE_BUILD_TYPE=Release -Bbuild_release
72+
make --directory=build_release

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "thirdparty/chuck"]
2+
path = thirdparty/chuck
3+
url = https://github.com/ccrma/chuck

Backup/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.toe

CMakeLists.txt

+246
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR)
2+
3+
project(ChucKDesigner VERSION 0.0.1)
4+
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ChucKDesignerCHOP)
5+
6+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
7+
8+
################################################################################
9+
# Sub-projects
10+
################################################################################
11+
project(ChucKDesignerShared VERSION 0.0.1)
12+
# include(CMake/Utils.cmake)
13+
14+
file(GLOB CK_SOURCES
15+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/*.h
16+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/*.cpp
17+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/*.c
18+
# ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/*.c
19+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/regcomp.c
20+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/regerror.c
21+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/regexec.c
22+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/tre-ast.c
23+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/tre-compile.c
24+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/tre-filter.c
25+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/tre-match-approx.c
26+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/tre-match-backtrack.c
27+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/tre-match-parallel.c
28+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/tre-mem.c
29+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/tre-parse.c
30+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/tre-stack.c
31+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex/tre-xmalloc.c
32+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/lo/*.c
33+
)
34+
35+
if(WIN32)
36+
list(FILTER CK_SOURCES EXCLUDE REGEX ".*server_thread.c")
37+
list(FILTER CK_SOURCES EXCLUDE REGEX ".*lo/config.h")
38+
endif()
39+
40+
add_library(ChucKDesignerShared SHARED
41+
${CK_SOURCES}
42+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerPlugin.h
43+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerPlugin.cpp
44+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerShared.h
45+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerShared.cpp
46+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner/CHOP_CPlusPlusBase.h
47+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner/CPlusPlus_Common.h
48+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner/GL_Extensions.h
49+
)
50+
51+
# Include header directories
52+
target_include_directories(ChucKDesignerShared PUBLIC
53+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
54+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core>
55+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex>
56+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner>
57+
$<INSTALL_INTERFACE:ChucKDesignerShared>
58+
)
59+
60+
target_compile_definitions(${PROJECT_NAME} PRIVATE
61+
"$<$<CONFIG:Debug>:"
62+
"_DEBUG"
63+
">"
64+
"$<$<CONFIG:Release>:"
65+
"NDEBUG"
66+
">"
67+
"NDEBUG"
68+
"_USRDLL"
69+
"HAVE_CONFIG_H"
70+
)
71+
72+
if(WIN32)
73+
target_compile_definitions(${PROJECT_NAME} PRIVATE
74+
"WIN32;"
75+
"__PLATFORM_WIN32__;"
76+
"__WINDOWS_MODERN__;"
77+
"__WINDOWS_DS__;"
78+
"_WINDOWS;"
79+
)
80+
# win sock 32
81+
target_link_libraries(${PROJECT_NAME} ws2_32)
82+
# windows multimedia for rt midi
83+
target_link_libraries(${PROJECT_NAME} winmm)
84+
# more
85+
target_link_libraries(${PROJECT_NAME} wsock32)
86+
target_link_libraries(${PROJECT_NAME} dsound dinput8 dxguid)
87+
else()
88+
target_compile_definitions(${PROJECT_NAME} PRIVATE
89+
"__MACOSX_CORE__;"
90+
"__APPLE__;"
91+
"__MACH__;"
92+
)
93+
target_link_libraries(${PROJECT_NAME} "-framework CoreFoundation" "-framework CoreMIDI" "-framework CoreAudio")
94+
endif()
95+
96+
add_custom_command(TARGET ${PROJECT_NAME}
97+
POST_BUILD
98+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
99+
"$<TARGET_FILE:ChucKDesignerShared>"
100+
${CMAKE_SOURCE_DIR}/Plugins
101+
# "%USERPROFILE%/Documents/Derivative/Plugins"
102+
)
103+
104+
############ listener
105+
106+
project(ChucKListenerCHOP VERSION 0.0.1)
107+
108+
add_library(ChucKListenerCHOP SHARED
109+
${CK_SOURCES}
110+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChucKListenerCHOP.h
111+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChucKListenerCHOP.cpp
112+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerShared.h
113+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerShared.cpp
114+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerPlugin.h
115+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerPlugin.cpp
116+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner/CHOP_CPlusPlusBase.h
117+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner/CPlusPlus_Common.h
118+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner/GL_Extensions.h
119+
)
120+
121+
# Include header directories
122+
target_include_directories(ChucKListenerCHOP PUBLIC
123+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
124+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core>
125+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex>
126+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner>
127+
$<INSTALL_INTERFACE:ChucKListenerCHOP>
128+
)
129+
130+
target_compile_definitions(${PROJECT_NAME} PRIVATE
131+
"$<$<CONFIG:Debug>:"
132+
"_DEBUG"
133+
">"
134+
"$<$<CONFIG:Release>:"
135+
"NDEBUG"
136+
">"
137+
"NDEBUG"
138+
"_USRDLL"
139+
"HAVE_CONFIG_H"
140+
)
141+
142+
if(WIN32)
143+
target_compile_definitions(${PROJECT_NAME} PRIVATE
144+
"WIN32;"
145+
"__PLATFORM_WIN32__;"
146+
"__WINDOWS_MODERN__;"
147+
"__WINDOWS_DS__;"
148+
"_WINDOWS;"
149+
)
150+
# win sock 32
151+
target_link_libraries(${PROJECT_NAME} ws2_32)
152+
# windows multimedia for rt midi
153+
target_link_libraries(${PROJECT_NAME} winmm)
154+
# more
155+
target_link_libraries(${PROJECT_NAME} wsock32)
156+
target_link_libraries(${PROJECT_NAME} dsound dinput8 dxguid)
157+
else()
158+
target_compile_definitions(${PROJECT_NAME} PRIVATE
159+
"__MACOSX_CORE__;"
160+
"__APPLE__;"
161+
"__MACH__;"
162+
)
163+
target_link_libraries(${PROJECT_NAME} "-framework CoreFoundation" "-framework CoreMIDI" "-framework CoreAudio")
164+
endif()
165+
166+
add_custom_command(TARGET ${PROJECT_NAME}
167+
POST_BUILD
168+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
169+
"$<TARGET_FILE:ChucKListenerCHOP>"
170+
${CMAKE_SOURCE_DIR}/Plugins
171+
# "%USERPROFILE%/Documents/Derivative/Plugins"
172+
)
173+
174+
######## touchdesigner project
175+
176+
project(ChucKDesignerCHOP VERSION 0.0.1)
177+
178+
add_library(ChucKDesignerCHOP SHARED
179+
${CK_SOURCES}
180+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerPlugin.h
181+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerPlugin.cpp
182+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerShared.h
183+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChuckDesignerShared.cpp
184+
${CMAKE_CURRENT_SOURCE_DIR}/src/ChucKDesignerCHOP_plugin.cpp
185+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner/CHOP_CPlusPlusBase.h
186+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner/CPlusPlus_Common.h
187+
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner/GL_Extensions.h
188+
)
189+
190+
# Include header directories
191+
target_include_directories(ChucKDesignerCHOP PUBLIC
192+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
193+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core>
194+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chuck/src/core/regex>
195+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/TouchDesigner>
196+
$<INSTALL_INTERFACE:ChucKDesignerCHOP>
197+
)
198+
199+
target_compile_definitions(${PROJECT_NAME} PRIVATE
200+
"$<$<CONFIG:Debug>:"
201+
"_DEBUG"
202+
">"
203+
"$<$<CONFIG:Release>:"
204+
"NDEBUG"
205+
">"
206+
"NDEBUG"
207+
"_USRDLL"
208+
"HAVE_CONFIG_H"
209+
)
210+
211+
if(WIN32)
212+
target_compile_definitions(${PROJECT_NAME} PRIVATE
213+
"WIN32;"
214+
"__PLATFORM_WIN32__;"
215+
"__WINDOWS_MODERN__;"
216+
"__WINDOWS_DS__;"
217+
"_WINDOWS;"
218+
)
219+
# win sock 32
220+
target_link_libraries(${PROJECT_NAME} ws2_32)
221+
# windows multimedia for rt midi
222+
target_link_libraries(${PROJECT_NAME} winmm)
223+
# more
224+
target_link_libraries(${PROJECT_NAME} wsock32)
225+
target_link_libraries(${PROJECT_NAME} dsound dinput8 dxguid)
226+
else()
227+
target_compile_definitions(${PROJECT_NAME} PRIVATE
228+
"__MACOSX_CORE__;"
229+
"__APPLE__;"
230+
"__MACH__;"
231+
)
232+
target_link_libraries(${PROJECT_NAME} "-framework CoreFoundation" "-framework CoreMIDI" "-framework CoreAudio")
233+
endif()
234+
235+
add_custom_command(TARGET ${PROJECT_NAME}
236+
POST_BUILD
237+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
238+
"$<TARGET_FILE:ChucKDesignerCHOP>"
239+
${CMAKE_SOURCE_DIR}/Plugins
240+
# "%USERPROFILE%/Documents/Derivative/Plugins"
241+
)
242+
243+
set_target_properties(${PROJECT_NAME} PROPERTIES
244+
VS_DEBUGGER_COMMAND "C:\\Program Files\\Derivative\\TouchDesigner\\bin\\TouchDesigner.exe"
245+
VS_DEBUGGER_COMMAND_ARGUMENTS "..\\$(ProjectName).toe")
246+
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)

ChucKDesigner.toe

4.57 KB
Binary file not shown.

Plugins/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.json
2+
*.dll

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ChucKDesigner
2+
3+
[ChucK](https://chuck.stanford.edu/) + [TouchDesigner](https://derivative.ca/)
4+
5+
ChucKDesigner is an integration of the ChucK music/audio programming language with the TouchDesigner visual programming language. ChucKDesigner is similar in spirit to [Chunity](https://chuck.stanford.edu/chunity/), the combination of ChucK and the Unity game engine. With ChucKDesigner, TouchDesigner can control ChucK code via user interfaces and channel operator streams. In the other direction, ChucK can send audio, events, and arrays back to TouchDesigner. This enables tight synchronization of audio and video. ChucKDesigner is supported on Windows and will have MacOS support soon. Please use the [issues](https://github.com/DBraun/ChucKDesigner/issues) and [discussions](https://github.com/DBraun/ChucKDesigner/discussions) pages on Github.

src/ChucKDesignerCHOP_plugin.cpp

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#include "ChucKDesignerPlugin.h"
2+
#include <stdio.h>
3+
#include <string.h>
4+
5+
// These functions are basic C function, which the DLL loader can find
6+
// much easier than finding a C++ Class.
7+
// The DLLEXPORT prefix is needed so the compile exports these functions from the .dll
8+
// you are creating
9+
extern "C"
10+
{
11+
12+
DLLEXPORT
13+
void
14+
FillCHOPPluginInfo(CHOP_PluginInfo* info)
15+
{
16+
// Always set this to CHOPCPlusPlusAPIVersion.
17+
info->apiVersion = CHOPCPlusPlusAPIVersion;
18+
19+
// The opType is the unique name for this CHOP. It must start with a
20+
// capital A-Z character, and all the following characters must lower case
21+
// or numbers (a-z, 0-9)
22+
info->customOPInfo.opType->setString("Chuckaudio");
23+
24+
// The opLabel is the text that will show up in the OP Create Dialog
25+
info->customOPInfo.opLabel->setString("ChucK Audio");
26+
27+
// Information about the author of this OP
28+
info->customOPInfo.authorName->setString("David Braun");
29+
info->customOPInfo.authorEmail->setString("github.com/DBraun");
30+
31+
// This CHOP can work with 0 inputs
32+
info->customOPInfo.minInputs = 0;
33+
34+
// It can accept up to 1 input though, which changes it's behavior
35+
info->customOPInfo.maxInputs = 1;
36+
}
37+
38+
DLLEXPORT
39+
CHOP_CPlusPlusBase*
40+
CreateCHOPInstance(const OP_NodeInfo* info)
41+
{
42+
// Return a new instance of your class every time this is called.
43+
// It will be called once per CHOP that is using the .dll
44+
return new ChucKDesignerPlugin(info);
45+
}
46+
47+
DLLEXPORT
48+
void
49+
DestroyCHOPInstance(CHOP_CPlusPlusBase* instance)
50+
{
51+
// Delete the instance here, this will be called when
52+
// Touch is shutting down, when the CHOP using that instance is deleted, or
53+
// if the CHOP loads a different DLL
54+
delete (ChucKDesignerPlugin*)instance;
55+
}
56+
57+
};

0 commit comments

Comments
 (0)