From cccbe115fb82d8699c50831f9fdc79dfe541e8ee Mon Sep 17 00:00:00 2001 From: gw-chuck Date: Tue, 15 Jul 2008 12:19:28 +0000 Subject: [PATCH] *** empty log message *** --- notes/VERSIONS | 1 + v2/chuck_lang.cpp | 30 ++++++++++++++++++++++++++++-- v2/chuck_lang.h | 3 ++- v2/chuck_ugen.cpp | 25 +++++++++++++++++++++---- v2/chuck_ugen.h | 3 ++- 5 files changed, 54 insertions(+), 8 deletions(-) diff --git a/notes/VERSIONS b/notes/VERSIONS index 7065a875..0e902e21 100644 --- a/notes/VERSIONS +++ b/notes/VERSIONS @@ -19,6 +19,7 @@ new UAna: XCorr computes the cross correlation of the first two UAna input - (added) UGen.isConnectedTo( Ugen ) // is connected to another ugen? + - (added) UAna.isUpConnectedTo( UAna ) // is connected to another uana via =^? - (added) int Shred.done() // is the shred done? int Shred.running() // is the shred running? - (added) int Math.ensurePow2( int ) diff --git a/v2/chuck_lang.cpp b/v2/chuck_lang.cpp index 142476f3..17f6ab84 100755 --- a/v2/chuck_lang.cpp +++ b/v2/chuck_lang.cpp @@ -153,7 +153,7 @@ t_CKBOOL init_class_ugen( Chuck_Env * env, Chuck_Type * type ) func = make_new_mfun( "int", "isConnectedTo", ugen_connected ); func->add_arg( "UGen", "right" ); if( !type_engine_import_mfun( env, func ) ) goto error; - + // end type_engine_import_class_end( env ); @@ -219,6 +219,11 @@ t_CKBOOL init_class_uana( Chuck_Env * env, Chuck_Type * type ) func = make_new_mfun( "complex", "cval", uana_cval ); func->add_arg( "int", "index" ); if( !type_engine_import_mfun( env, func ) ) goto error; + + // add isUpConnectedTo + func = make_new_mfun( "int", "isUpConnectedTo", uana_connected ); + func->add_arg( "UAna", "right" ); + if( !type_engine_import_mfun( env, func ) ) goto error; // TODO: add nonchuck // func = make_new_mfun( "void", "nonchuck", uana_nonchuck ); @@ -1787,7 +1792,28 @@ CK_DLL_MFUN( uana_cval ) cvals.get( i, &val ); RETURN->v_complex = val; } -} +} + +CK_DLL_MFUN( uana_connected ) +{ + // get ugen + Chuck_UAna * uana = (Chuck_UAna *)SELF; + Chuck_UAna * right = (Chuck_UAna *)GET_NEXT_OBJECT(ARGS); + + // sanity + t_CKINT ret = FALSE; + if( !right ) + { + ret = FALSE; + } + else + { + ret = right->is_up_connected_from( uana ); + } + + RETURN->v_int = ret; +} + // blob proxy implementation Chuck_UAnaBlobProxy::Chuck_UAnaBlobProxy( Chuck_Object * blob ) diff --git a/v2/chuck_lang.h b/v2/chuck_lang.h index cbd4cfe3..0066e418 100755 --- a/v2/chuck_lang.h +++ b/v2/chuck_lang.h @@ -104,7 +104,8 @@ CK_DLL_MFUN( uana_blob ); CK_DLL_MFUN( uana_fvals ); CK_DLL_MFUN( uana_cvals ); CK_DLL_MFUN( uana_fval ); -CK_DLL_MFUN( uana_cval ); +CK_DLL_MFUN( uana_cval ); +CK_DLL_MFUN( uana_connected ); //----------------------------------------------------------------------------- diff --git a/v2/chuck_ugen.cpp b/v2/chuck_ugen.cpp index 1095fe46..0463d29d 100755 --- a/v2/chuck_ugen.cpp +++ b/v2/chuck_ugen.cpp @@ -768,10 +768,27 @@ Chuck_UAna * Chuck_UAna::getIncomingUAna( t_CKUINT index ) const // TODO: DANGER: this cast is very dangerous! return ((Chuck_UAna *)m_src_uana_list[index]); } - - - - + + + + +//----------------------------------------------------------------------------- +// name: is_up_connected_from() +// desc: ... +//----------------------------------------------------------------------------- +t_CKBOOL Chuck_UAna::is_up_connected_from( Chuck_UAna * src ) +{ + if( m_src_uana_list != NULL && fa_lookup( m_src_uana_list, m_num_uana_src, src ) ) + return TRUE; + + // TODO: multichannel? + + return FALSE; +} + + + + //----------------------------------------------------------------------------- // name: tock() // dsec: ... diff --git a/v2/chuck_ugen.h b/v2/chuck_ugen.h index 40c4e25e..fc91c5a7 100755 --- a/v2/chuck_ugen.h +++ b/v2/chuck_ugen.h @@ -141,7 +141,8 @@ public: virtual ~Chuck_UAna( ); public: - t_CKBOOL system_tock( t_CKTIME now ); + t_CKBOOL system_tock( t_CKTIME now ); + t_CKBOOL is_up_connected_from( Chuck_UAna * src ); public: // blob retrieval t_CKINT numIncomingUAnae() const; -- 2.11.4.GIT