Skip to content

Commit

Permalink
update to chuck 1.5.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
DBraun committed Jul 24, 2024
1 parent 2224d85 commit 1d30ae0
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR)

SET(VERSION 0.3.4)
SET(VERSION 0.3.5)
project(ChucKDesigner VERSION ${VERSION})
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ChucKDesignerCHOP)

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ Install <a href="https://www.python.org/downloads/release/python-3117/">Python 3
Install CMake and confirm that it's installed by running <code>cmake --version</code> in a command prompt.
<br>
Then in this repository,
<br>
<code>
cmake . -DCMAKE_BUILD_TYPE=Release -Bbuild -DPYTHONVER="3.11"
</code>
<br>
Finally, open <code>build/ChucKDesignerCHOP.sln</code> and compile.
Then, <code>cmake --build build --config Release</code> to compile.
</details>

### MacOS
Expand Down
61 changes: 57 additions & 4 deletions src/Plugin_ChucK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
#include "Plugin_ChucK.h"
#include "chuck_globals.h"

#include "chuck_vm.h"
#include "util_platforms.h" // for ck_usleep

#include <iostream>
#include <map>

#ifndef WIN32
#include <unistd.h>
#endif
Expand Down Expand Up @@ -545,7 +549,9 @@ namespace ChucK_For_TouchDesigner
}


CHUCKDESIGNERSHARED_API bool getGlobalAssociativeIntArrayValueWithID(unsigned int chuckID, t_CKINT callbackID, const char* name, char* key, void(*callback)(t_CKINT, t_CKINT))
CHUCKDESIGNERSHARED_API bool getGlobalAssociativeIntArrayValueWithID(
unsigned int chuckID, t_CKINT callbackID, const char* name,
char* key, void(*callback)(t_CKINT, t_CKINT))
{
if (chuck_instances.count(chuckID) == 0) { return false; }
Chuck_Globals_Manager* gm = chuck_instances[chuckID]->globals();
Expand All @@ -555,6 +561,27 @@ namespace ChucK_For_TouchDesigner
name, callbackID, key, callback);
}

// internal/audio-thread-friendly global array setter
CHUCKDESIGNERSHARED_API bool setGlobalIntArray_AT(
unsigned int chuckID,const char* name, t_CKINT arrayValues[], unsigned int numValues)
{
if (chuck_instances.count(chuckID) == 0) { return false; }
Chuck_Globals_Manager* gm = chuck_instances[chuckID]->globals();
if (gm == NULL) { return false; }

return gm->set_global_int_array(name, arrayValues, numValues);
}

// internal/audio-thread-friendly
CHUCKDESIGNERSHARED_API bool setGlobalIntArrayValue_AT(
unsigned int chuckID, const char* name, unsigned int index, t_CKINT value)
{
if (chuck_instances.count(chuckID) == 0) { return false; }
Chuck_Globals_Manager* gm = chuck_instances[chuckID]->globals();
if (gm == NULL) { return false; }

return gm->set_global_float_array_value(name, index, value);
}

// float array methods
CHUCKDESIGNERSHARED_API bool setGlobalFloatArray(unsigned int chuckID,
Expand Down Expand Up @@ -700,6 +727,27 @@ namespace ChucK_For_TouchDesigner
}



// internal/audio-thread-friendly global array setter
CHUCKDESIGNERSHARED_API bool setGlobalFloatArray_AT(
unsigned int chuckID, const char* name, t_CKFLOAT arrayValues[], unsigned int numValues)
{
if (chuck_instances.count(chuckID) == 0) { return false; }
Chuck_Globals_Manager* gm = chuck_instances[chuckID]->globals();
if (gm == NULL) { return false; }

return gm->set_global_float_array(name, arrayValues, numValues);
}

CHUCKDESIGNERSHARED_API bool setGlobalFloatArrayValue_AT(
unsigned int chuckID, const char* name, unsigned int index, t_CKFLOAT value) {
if (chuck_instances.count(chuckID) == 0) { return false; }
Chuck_Globals_Manager* gm = chuck_instances[chuckID]->globals();
if (gm == NULL) { return false; }

return gm->set_global_float_array_value(name, index, value);
}

CHUCKDESIGNERSHARED_API bool setChoutCallback(unsigned int chuckID, void (*callback)(const char*))
{
return chuck_instances[chuckID]->setChoutCallback(callback);
Expand Down Expand Up @@ -1028,6 +1076,9 @@ namespace ChucK_For_TouchDesigner
data_instances.erase( chuckID );
}

// wait a bit
ck_usleep(30000);

op_ids_to_chuck_ids.erase(opId);

// todo: is this dangerous?
Expand Down Expand Up @@ -1077,13 +1128,15 @@ namespace ChucK_For_TouchDesigner
CHUCKDESIGNERSHARED_API void cleanRegisteredChucks() {

// first, invalidate all callbacks' references to chucks
for( std::map< unsigned int, EffectData::Data * >::iterator it =
data_instances.begin(); it != data_instances.end(); it++ )
for (std::map<unsigned int, EffectData::Data*>::iterator it = data_instances.begin(); it != data_instances.end(); it++)
{
EffectData::Data * data = it->second;
EffectData::Data* data = it->second;
data->myId = -1;
}

// wait for callbacks to finish their current run
ck_usleep(30000);

// next, delete chucks
for( std::map< unsigned int, ChucK * >::iterator it =
chuck_instances.begin(); it != chuck_instances.end(); it++ )
Expand Down
5 changes: 4 additions & 1 deletion src/Plugin_ChucK.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ extern "C" {
CHUCKDESIGNERSHARED_API bool getGlobalAssociativeIntArrayValue(unsigned int chuckID, const char* name, char* key, void (*callback)(t_CKINT));
CHUCKDESIGNERSHARED_API bool getNamedGlobalAssociativeIntArrayValue(unsigned int chuckID, const char* name, char* key, void (*callback)(const char*, t_CKINT));
CHUCKDESIGNERSHARED_API bool getGlobalAssociativeIntArrayValueWithID(unsigned int chuckID, t_CKINT callbackID, const char* name, char* key, void (*callback)(t_CKINT, t_CKINT));
CHUCKDESIGNERSHARED_API bool setGlobalIntArray_AT(unsigned int chuckID, const char* name, t_CKINT arrayValues[], unsigned int numValues); // internal/audio-thread-friendly global array setter
CHUCKDESIGNERSHARED_API bool setGlobalIntArrayValue_AT(unsigned int chuckID, const char* name, unsigned int index, t_CKINT value); // internal/audio-thread-friendly
// TODO: set entire dict, add to dict in batch; get entire dict

// float array methods
Expand All @@ -94,7 +96,8 @@ extern "C" {
CHUCKDESIGNERSHARED_API bool getGlobalAssociativeFloatArrayValue(unsigned int chuckID, const char* name, char* key, void (*callback)(t_CKFLOAT));
CHUCKDESIGNERSHARED_API bool getNamedGlobalAssociativeFloatArrayValue(unsigned int chuckID, const char* name, char* key, void (*callback)(const char*, t_CKFLOAT));
CHUCKDESIGNERSHARED_API bool getGlobalAssociativeFloatArrayValueWithID(unsigned int chuckID, t_CKINT callbackID, const char* name, char* key, void (*callback)(t_CKINT, t_CKFLOAT));

CHUCKDESIGNERSHARED_API bool setGlobalFloatArray_AT(unsigned int chuckID, const char* name, t_CKFLOAT arrayValues[], unsigned int numValues); // internal/audio-thread-friendly global array setter
CHUCKDESIGNERSHARED_API bool setGlobalFloatArrayValue_AT(unsigned int chuckID, const char* name, unsigned int index, t_CKFLOAT value); // internal/audio-thread-friendly

CHUCKDESIGNERSHARED_API bool initChuckInstance(unsigned int chuckID, unsigned int sampleRate, unsigned int numInChannels, unsigned int numOutChannels, string globalDir);
CHUCKDESIGNERSHARED_API bool clearChuckInstance(unsigned int chuckID);
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/chuck
Submodule chuck updated 57 files
+37 −0 .github/workflows/webchuck-dev.yml
+1 −0 .gitignore
+133 −3 VERSIONS
+58 −0 examples/basic/blit3.ck
+31 −0 examples/basic/delay2.ck
+38 −0 examples/basic/envelope2.ck
+715 −0 examples/deep/smb.ck
+1 −0 examples/midi/midiout.ck
+50 −0 examples/midi/midiout2.ck
+1 −1 examples/oper/overload_overview.ck
+43 −0 examples/osc/r2.ck
+64 −0 examples/osc/utilities/midi2osc-r.ck
+156 −0 examples/osc/utilities/midi2osc-s.ck
+4 −1 examples/special/scream-o-matic/scream-o-matic.ck
+2 −1 src/core/chuck.cpp
+2 −0 src/core/chuck.lex
+1 −1 src/core/chuck_def.h
+143 −2 src/core/chuck_dl.cpp
+23 −1 src/core/chuck_dl.h
+5 −0 src/core/chuck_emit.cpp
+2 −2 src/core/chuck_globals.h
+152 −4 src/core/chuck_io.cpp
+9 −0 src/core/chuck_io.h
+2 −1 src/core/chuck_lang.cpp
+2 −0 src/core/chuck_parse.cpp
+17 −0 src/core/chuck_type.cpp
+7 −8 src/core/chuck_ugen.cpp
+49 −0 src/core/chuck_vm.cpp
+39 −0 src/core/chuck_vm.h
+1,400 −1,325 src/core/chuck_yacc.c
+47 −45 src/core/chuck_yacc.h
+32 −14 src/core/midiio_rtmidi.cpp
+1 −0 src/core/midiio_rtmidi.h
+2 −2 src/core/ugen_osc.cpp
+493 −8 src/core/ugen_stk.cpp
+5 −0 src/core/ugen_stk.h
+69 −33 src/core/ugen_xxx.cpp
+1 −0 src/core/ugen_xxx.h
+557 −28 src/core/ulib_doc.cpp
+15 −3 src/core/ulib_doc.h
+3 −0 src/core/ulib_opsc.cpp
+455 −314 src/core/util_buffers.h
+7 −4 src/core/util_serial.cpp
+43 −18 src/core/util_string.cpp
+5 −2 src/core/util_string.h
+1 −0 src/host-examples/makefile
+11 −11 src/host/RtAudio/RtAudio.cpp
+21 −11 src/host/chuck_audio.cpp
+78 −8 src/host/chuck_main.cpp
+17 −4 src/makefile
+32 −12 src/scripts/ckdoc/gen-all.ck
+29 −0 src/scripts/ckdoc/makefile
+12 −0 src/test/01-Basic/250-ugen-arrays.ck
+1 −0 src/test/01-Basic/250-ugen-arrays.txt
+41 −0 src/test/01-Basic/253-scope-cleanup.ck
+9 −0 src/test/01-Basic/253-scope-cleanup.txt
+27 −0 src/test/makefile

0 comments on commit 1d30ae0

Please sign in to comment.