From 32e76936b7a5e079d61ed7ae78ff6720207a83c4 Mon Sep 17 00:00:00 2001 From: Ge Wang Date: Mon, 6 Jan 2025 21:13:48 -0800 Subject: [PATCH] add ChucK::bind() api --- src/core/chuck.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/core/chuck.cpp b/src/core/chuck.cpp index f07455278..347cc2ec5 100644 --- a/src/core/chuck.cpp +++ b/src/core/chuck.cpp @@ -1587,6 +1587,28 @@ void ChucK::poop() +//----------------------------------------------------------------------------- +// name: bind() +// desc: additional native chuck bindings/types (use with extra caution) +//----------------------------------------------------------------------------- +t_CKBOOL ChucK::bind( f_ck_query queryFunc, const std::string & name ) +{ + // check if we have initialized a compiler + if( !compiler() ) + { + // error message + EM_error2( 0, "cannot bind() -- ChucK/compiler is not initialized..." ); + // done + return FALSE; + } + + // perform the bind + return compiler()->bind( queryFunc, name ); +} + + + + //----------------------------------------------------------------------------- // name: setMainThreadHook() // desc: set a function pointer to call from the main thread loop