[PD-cvs] externals/grill/dynext/src main.cpp,1.11,1.12

Thomas Grill xovo at users.sourceforge.net
Sat Jul 1 15:53:22 CEST 2006


Update of /cvsroot/pure-data/externals/grill/dynext/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26293/src

Modified Files:
	main.cpp 
Log Message:
some more documentation (proxy objects)
last fixes for release
update docs
optimized DSP processing (less data copying, no more block delay)
fixed send method so that any messages work now


Index: main.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/dynext/src/main.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** main.cpp	6 Sep 2005 13:22:03 -0000	1.11
--- main.cpp	1 Jul 2006 13:53:20 -0000	1.12
***************
*** 3,7 ****
  dyn~ - dynamical object management for PD
  
! Copyright (c)2003-2005 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
--- 3,7 ----
  dyn~ - dynamical object management for PD
  
! Copyright (c)2003-2006 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
***************
*** 20,24 ****
  #endif
  
! #define DYN_VERSION "0.1.1"
  
  
--- 20,24 ----
  #endif
  
! #define DYN_VERSION "0.1.2"
  
  
***************
*** 46,50 ****
  	virtual ~dyn();
  
!     void m_reset() { DoExit(); DoInit(); }
  	void m_reload(); // refresh objects/abstractions
  	void m_newobj(int argc,const t_atom *argv);
--- 46,50 ----
  	virtual ~dyn();
  
!     void m_reset();
  	void m_reload(); // refresh objects/abstractions
  	void m_newobj(int argc,const t_atom *argv);
***************
*** 141,146 ****
  	        defsig = 0;
          }
- 
-         static void px_exit(proxy *px) { if(px->buf) FreeAligned(px->buf); }
  	};
  
--- 141,144 ----
***************
*** 248,252 ****
  {
  	post("");
! 	post("dyn~ %s - dynamic object management, (C)2003-2005 Thomas Grill",DYN_VERSION);
  	post("");
  
--- 246,250 ----
  {
  	post("");
! 	post("dyn~ %s - dynamic object management, (C)2003-2006 Thomas Grill",DYN_VERSION);
  	post("");
  
***************
*** 260,277 ****
  
  	// set up proxy class for inbound messages
!     pxin_class = class_new(const_cast<t_symbol *>(sym_dynin),(t_newmethod)pxin_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
  	add_anything(pxin_class,proxyin::px_method); 
  
  	// set up proxy class for inbound signals
! 	pxins_class = class_new(const_cast<t_symbol *>(sym_dynsin),(t_newmethod)pxins_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
      add_dsp(pxins_class,proxyin::dsp);
      CLASS_MAINSIGNALIN(pxins_class, proxyin, defsig);
  
  	// set up proxy class for outbound messages
! 	pxout_class = class_new(const_cast<t_symbol *>(sym_dynout),(t_newmethod)pxout_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
  	add_anything(pxout_class,proxyout::px_method); 
  
  	// set up proxy class for outbound signals
! 	pxouts_class = class_new(const_cast<t_symbol *>(sym_dynsout),(t_newmethod)pxouts_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
  	add_dsp(pxouts_class,proxyout::dsp);
      CLASS_MAINSIGNALIN(pxouts_class, proxyout, defsig);
--- 258,275 ----
  
  	// set up proxy class for inbound messages
!     pxin_class = class_new(const_cast<t_symbol *>(sym_dynin),(t_newmethod)pxin_new,NULL,sizeof(proxyin),0, A_NULL);
  	add_anything(pxin_class,proxyin::px_method); 
  
  	// set up proxy class for inbound signals
! 	pxins_class = class_new(const_cast<t_symbol *>(sym_dynsin),(t_newmethod)pxins_new,NULL,sizeof(proxyin),0, A_NULL);
      add_dsp(pxins_class,proxyin::dsp);
      CLASS_MAINSIGNALIN(pxins_class, proxyin, defsig);
  
  	// set up proxy class for outbound messages
! 	pxout_class = class_new(const_cast<t_symbol *>(sym_dynout),(t_newmethod)pxout_new,NULL,sizeof(proxyout),0, A_NULL);
  	add_anything(pxout_class,proxyout::px_method); 
  
  	// set up proxy class for outbound signals
! 	pxouts_class = class_new(const_cast<t_symbol *>(sym_dynsout),(t_newmethod)pxouts_new,NULL,sizeof(proxyout),0, A_NULL);
  	add_dsp(pxouts_class,proxyout::dsp);
      CLASS_MAINSIGNALIN(pxouts_class, proxyout, defsig);
***************
*** 652,655 ****
--- 650,661 ----
  }
  
+ void dyn::m_reset() 
+ { 
+     int dsp = canvas_suspend_dsp(); 
+     DoExit(); 
+     DoInit(); 
+     canvas_resume_dsp(dsp); 
+ }
+ 
  void dyn::m_reload()
  {
***************
*** 838,851 ****
  }
  
- 
  void dyn::proxyin::dsp(proxyin *x,t_signal **sp)
  {
  	int n = sp[0]->s_n;
  	if(n != x->n) {
! 		// if vector size has changed make new buffer
! 		if(x->buf) FreeAligned(x->buf);
! 		x->buf = (t_sample *)NewAligned(sizeof(t_sample)*(x->n = n));
  	}
! 	dsp_add_copy(x->buf,sp[0]->s_vec,n);
  }
  
--- 844,856 ----
  }
  
  void dyn::proxyin::dsp(proxyin *x,t_signal **sp)
  {
+     FLEXT_ASSERT(x->buf && x->n);
  	int n = sp[0]->s_n;
  	if(n != x->n) {
!         post("dyn~ proxyin - blocksize doesn't match!");
  	}
!     else
! 	    dsp_add_copy(x->buf,sp[0]->s_vec,n);
  }
  
***************
*** 861,871 ****
  void dyn::proxyout::dsp(proxyout *x,t_signal **sp)
  {
  	int n = sp[0]->s_n;
  	if(n != x->n) {
! 		// if vector size has changed make new buffer
! 		if(x->buf) FreeAligned(x->buf);
! 		x->buf = (t_sample *)NewAligned(sizeof(t_sample)*(x->n = n));
  	}
! 	dsp_add_copy(sp[0]->s_vec,x->buf,n);
  }
  
--- 866,876 ----
  void dyn::proxyout::dsp(proxyout *x,t_signal **sp)
  {
+     FLEXT_ASSERT(x->buf && x->n);
  	int n = sp[0]->s_n;
  	if(n != x->n) {
!         post("dyn~ proxyout - blocksize doesn't match!");
  	}
!     else
! 	    dsp_add_copy(sp[0]->s_vec,x->buf,n);
  }
  
***************
*** 880,898 ****
  bool dyn::CbDsp()
  {
! 	// add sub canvas to dsp list (no signal vector to borrow from .. set it to NULL)
      mess1((t_pd *)canvas,const_cast<t_symbol *>(sym_dsp),NULL);
      return true;
  }
      
! void dyn::CbSignal()
! {
! 	int i,n = Blocksize();
!     t_sample *const *in = InSig(),*const *out = OutSig();
! 	for(i = 0; i < s_inlets; ++i)
! 		if(pxin[i]->buf)
! 		    CopySamples(pxin[i]->buf,in[i+1],n);
! 
! 	for(i = 0; i < s_outlets; ++i)
! 		if(pxout[i]->buf)
! 		    CopySamples(out[i],pxout[i]->buf,n);
! }
--- 885,898 ----
  bool dyn::CbDsp()
  {
!     int n = Blocksize();
!     t_sample *const *in = InSig(),*const *out = OutSig();
! 	int i;
! 	for(i = 0; i < s_inlets; ++i) pxin[i]->buf = in[i+1],pxin[i]->n = n;
! 	for(i = 0; i < s_outlets; ++i) pxout[i]->buf = out[i],pxout[i]->n = n;
! 
!     // add sub canvas to dsp list (no signal vector to borrow from .. set it to NULL)
      mess1((t_pd *)canvas,const_cast<t_symbol *>(sym_dsp),NULL);
      return true;
  }
      
! void dyn::CbSignal() {}





More information about the Pd-cvs mailing list