[PD-cvs] externals/grill/vst/src VstHost.cpp,1.11,1.12 VstHost.h,1.7,1.8 main.cpp,1.15,1.16

Thomas Grill xovo at users.sourceforge.net
Mon Aug 23 04:42:18 CEST 2004


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

Modified Files:
	VstHost.cpp VstHost.h main.cpp 
Log Message:
 ""

Index: main.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/vst/src/main.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** main.cpp	22 Aug 2004 02:47:19 -0000	1.15
--- main.cpp	23 Aug 2004 02:42:16 -0000	1.16
***************
*** 18,25 ****
  
  #include <string>
- using namespace std;
  
  
! #define VST_VERSION "0.1.0pre12"
  
  
--- 18,24 ----
  
  #include <string>
  
  
! #define VST_VERSION "0.1.0pre13"
  
  
***************
*** 68,72 ****
--- 67,82 ----
      V ms_program(I p);
      V mg_program(I &p) const { p = plug?plug->GetCurrentProgram():0; }
+     V mg_progname(int argc,const t_atom *argv) const;
      
+     V m_pname(I pnum);
+     V ms_paramnames(int cnt) { paramnames = cnt; if(plug) plug->ScanParams(cnt); }
+ 
+     V ms_param(I pnum,F val);
+     V ms_params(int argc,const t_atom *argv);
+     V mg_param(I pnum);
+     V mg_params(int argc,const t_atom *argv);
+     V m_ptext(I pnum);
+     V m_ptexts(int argc,const t_atom *argv);
+ 
  //    V m_control(const S *ctrl_name,I ctrl_value);
      V m_pitchbend(I ctrl_value);
***************
*** 77,91 ****
      inline V m_noteoff(I note) { m_note(note,0); }
  
-     V ms_param(I pnum,F val);
-     V mg_param(I pnum);
-     V m_pname(I pnum);
-     V m_ptext(I pnum);
- 
  private:
      V display_parameter(I param,BL showparams);
  
      VSTPlugin *plug;
!     string plugname;
!     BL echoparam,visible,bypass,mute;
  
      I blsz;
--- 87,97 ----
      inline V m_noteoff(I note) { m_note(note,0); }
  
  private:
      V display_parameter(I param,BL showparams);
  
      VSTPlugin *plug;
!     std::string plugname;
!     bool echoparam,visible,bypass,mute;
!     int paramnames;
  
      I blsz;
***************
*** 120,127 ****
  
      FLEXT_CALLVAR_I(mg_program,ms_program)
      FLEXT_CALLBACK_2(ms_param,int,float)
      FLEXT_CALLBACK_I(mg_param)
!     FLEXT_CALLBACK_I(m_pname)
      FLEXT_CALLBACK_I(m_ptext)
  
      FLEXT_CALLBACK_II(m_note)
--- 126,140 ----
  
      FLEXT_CALLVAR_I(mg_program,ms_program)
+     FLEXT_CALLBACK_V(mg_progname)
+ 
+     FLEXT_CALLBACK_I(m_pname)
+     FLEXT_ATTRGET_I(paramnames)
+     FLEXT_CALLSET_I(ms_paramnames)
      FLEXT_CALLBACK_2(ms_param,int,float)
+     FLEXT_CALLBACK_V(ms_params)
      FLEXT_CALLBACK_I(mg_param)
!     FLEXT_CALLBACK_V(mg_params)
      FLEXT_CALLBACK_I(m_ptext)
+     FLEXT_CALLBACK_V(m_ptexts)
  
      FLEXT_CALLBACK_II(m_note)
***************
*** 142,145 ****
--- 155,160 ----
      FLEXT_CALLGET_I(mg_plugversion)
      FLEXT_CALLGET_B(mg_issynth)
+ 
+     static const t_symbol *sym_progname,*sym_pname,*sym_param,*sym_ptext;
  };
  
***************
*** 147,150 ****
--- 162,167 ----
  
  
+ const t_symbol *vst::sym_progname,*vst::sym_pname,*vst::sym_param,*vst::sym_ptext;
+ 
  V vst::Setup(t_classid c)
  {
***************
*** 171,179 ****
  	FLEXT_CADDMETHOD_(c,0,"progchg",m_programchange);
  	FLEXT_CADDATTR_VAR(c,"program",mg_program,ms_program);
  
  	FLEXT_CADDMETHOD_2(c,0,"param",ms_param,int,float);
  	FLEXT_CADDMETHOD_(c,0,"getparam",mg_param);
! 	FLEXT_CADDMETHOD_I(c,0,"getpname",m_pname);
! 	FLEXT_CADDMETHOD_I(c,0,"getptext",m_ptext);
  
  	FLEXT_CADDATTR_VAR1(c,"echo",echoparam);
--- 188,201 ----
  	FLEXT_CADDMETHOD_(c,0,"progchg",m_programchange);
  	FLEXT_CADDATTR_VAR(c,"program",mg_program,ms_program);
+ 	FLEXT_CADDMETHOD_(c,0,"getprogname",mg_progname);
  
+ 	FLEXT_CADDMETHOD_I(c,0,"getpname",m_pname);
+ 	FLEXT_CADDATTR_VAR(c,"pnames",paramnames,ms_paramnames);
  	FLEXT_CADDMETHOD_2(c,0,"param",ms_param,int,float);
+ 	FLEXT_CADDMETHOD_2(c,0,"param",ms_params,t_symptr,float);
  	FLEXT_CADDMETHOD_(c,0,"getparam",mg_param);
! 	FLEXT_CADDMETHOD_(c,0,"getparam",mg_params);
! 	FLEXT_CADDMETHOD_(c,0,"getptext",m_ptext);
! 	FLEXT_CADDMETHOD_(c,0,"getptext",m_ptexts);
  
  	FLEXT_CADDATTR_VAR1(c,"echo",echoparam);
***************
*** 192,195 ****
--- 214,222 ----
  	FLEXT_CADDATTR_GET(c,"synth",mg_issynth);
  
+     sym_progname = MakeSymbol("progname");
+     sym_pname = MakeSymbol("pname");
+     sym_param = MakeSymbol("param");
+     sym_ptext = MakeSymbol("ptext");
+ 
      SetupEditor();
  }
***************
*** 200,204 ****
      blsz(0),
      vstfun(NULL),vstin(NULL),vstout(NULL),tmpin(NULL),tmpout(NULL),
!     echoparam(false),bypass(false),mute(false)
  {
      if(argc >= 2 && CanbeInt(argv[0]) && CanbeInt(argv[1])) {
--- 227,231 ----
      blsz(0),
      vstfun(NULL),vstin(NULL),vstout(NULL),tmpin(NULL),tmpout(NULL),
!     echoparam(false),bypass(false),mute(false),paramnames(0)
  {
      if(argc >= 2 && CanbeInt(argv[0]) && CanbeInt(argv[1])) {
***************
*** 235,238 ****
--- 262,267 ----
  
      InitBuf();
+ 
+     plug->ScanParams(paramnames);
  }
  
***************
*** 277,281 ****
  }
  
! static string findFilePath(const string &path,const string &dllname)
  {
  	_chdir( path.c_str() );
--- 306,310 ----
  }
  
! static std::string findFilePath(const std::string &path,const std::string &dllname)
  {
  	_chdir( path.c_str() );
***************
*** 309,313 ****
  */
     
!     return string();
  }
  
--- 338,342 ----
  */
     
!     return std::string();
  }
  
***************
*** 323,326 ****
--- 352,366 ----
  		GetAString(argv[i],buf,sizeof buf);
          strlwr(buf);
+ 
+ #if FLEXT_SYS == FLEXT_SYS_PD
+         // strip char escapes (only in newer/devel PD version)
+         char *cs = buf,*cd = cs;
+         while(*cs) {
+             if(*cs != '\\') *(cd++) = *cs;
+             ++cs;
+         }
+         *cd = 0;
+ #endif
+ 
  		plugname += buf;
  	}
***************
*** 354,358 ****
  	        if(dir == name) strcpy(dir,".");
          
!             string dllname(dir);
              dllname += "\\";
              dllname += name;
--- 394,398 ----
  	        if(dir == name) strcpy(dir,".");
          
!             std::string dllname(dir);
              dllname += "\\";
              dllname += name;
***************
*** 363,369 ****
  
      if(!lf) { // try finding it on the VST path
! 		C *vst_path = getenv ("VST_PATH");
  
! 		string dllname(plugname);
  		if(dllname.find(".dll") == -1) dllname += ".dll";			
  
--- 403,409 ----
  
      if(!lf) { // try finding it on the VST path
! 		C *vst_path = getenv("VST_PATH");
  
! 		std::string dllname(plugname);
  		if(dllname.find(".dll") == -1) dllname += ".dll";			
  
***************
*** 374,383 ****
  			char *tok = strtok( tok_path , ";" );
  			while( tok != NULL ) {
! 				string abpath( tok );
  				if( abpath[abpath.length()-1] != '\\' ) abpath += "\\";
  
          		FLEXT_LOG1("trying VST_PATH %s",(const C *)abpath.c_str());
  
! 				string realpath = findFilePath( abpath , dllname );				
  				//post( "findFilePath( %s , %s ) = %s\n" , abpath , dllname , realpath );
  				if ( realpath.length() ) {
--- 414,423 ----
  			char *tok = strtok( tok_path , ";" );
  			while( tok != NULL ) {
! 				std::string abpath( tok );
  				if( abpath[abpath.length()-1] != '\\' ) abpath += "\\";
  
          		FLEXT_LOG1("trying VST_PATH %s",(const C *)abpath.c_str());
  
! 				std::string realpath = findFilePath( abpath , dllname );				
  				//post( "findFilePath( %s , %s ) = %s\n" , abpath , dllname , realpath );
  				if ( realpath.length() ) {
***************
*** 445,455 ****
              (plug->*vstfun)(const_cast<R **>(insigs),const_cast<R **>(outsigs),n);
          else {
              R **inv,**outv;
  
!             if(inputs <= CntInSig()) 
                  inv = const_cast<R **>(insigs);
              else { // more plug inputs than inlets
                  I i;
!                 for(i = 0; i < CntInSig(); ++i) tmpin[i] = const_cast<R *>(insigs[i]);
  
                  // set dangling inputs to zero
--- 485,496 ----
              (plug->*vstfun)(const_cast<R **>(insigs),const_cast<R **>(outsigs),n);
          else {
+             const int cntin = CntInSig(),cntout = CntOutSig();
              R **inv,**outv;
  
!             if(inputs <= cntin) 
                  inv = const_cast<R **>(insigs);
              else { // more plug inputs than inlets
                  I i;
!                 for(i = 0; i < cntin; ++i) tmpin[i] = const_cast<R *>(insigs[i]);
  
                  // set dangling inputs to zero
***************
*** 460,469 ****
              }
  
!             const BL more = outputs <= CntOutSig();
              if(more) // more outlets than plug outputs 
                  outv = const_cast<R **>(outsigs);
              else {
                  I i;
!                 for(i = 0; i < CntOutSig(); ++i) tmpout[i] = outsigs[i];
                  for(; i < outputs; ++i) tmpout[i] = vstout[i];
  
--- 501,510 ----
              }
  
!             const BL more = outputs <= cntout;
              if(more) // more outlets than plug outputs 
                  outv = const_cast<R **>(outsigs);
              else {
                  I i;
!                 for(i = 0; i < cntout; ++i) tmpout[i] = outsigs[i];
                  for(; i < outputs; ++i) tmpout[i] = vstout[i];
  
***************
*** 471,474 ****
--- 512,516 ----
              }
  
+             // call plugin DSP function
              (plug->*vstfun)(inv,outv,n);
  
***************
*** 477,481 ****
  
                  // currently simply clear them....
!                 for(int i = outputs; i < CntOutSig(); ++i)
                      ZeroSamples(outsigs[i],n);
              }
--- 519,523 ----
  
                  // currently simply clear them....
!                 for(int i = outputs; i < cntout; ++i)
                      ZeroSamples(outsigs[i],n);
              }
***************
*** 532,535 ****
--- 574,604 ----
  }
  
+ void vst::mg_progname(int argc,const t_atom *argv) const
+ {
+     if(plug) {
+         int cat,pnum;
+         if(argc == 1 && CanbeInt(argv[0])) {
+             cat = -1,pnum = GetAInt(argv[0]);
+         }
+         else if(argc == 2 && CanbeInt(argv[0]) && CanbeInt(argv[1])) {
+             cat = GetAInt(argv[0]),pnum = GetAInt(argv[1]);
+         }
+         else pnum = -1;
+ 
+         if(pnum >= 0) {
+             char str[256];
+             plug->GetProgramName(cat,pnum,str);
+ 
+             A at[3];
+             SetInt(at[0],cat);
+             SetInt(at[1],pnum);
+             SetString(at[2],str);
+ 	        ToOutAnything(GetOutAttr(),sym_progname,3,at);
+         }
+         else 
+             post("%s - Syntax: %s [category] program",thisName(),GetString(thisTag()));
+     }
+ }
+ 
  V vst::m_ctrlchange(I control,I ctrl_value)     
  {
***************
*** 640,644 ****
  	if(*name) {
  		if (showparams) {
! //			plug->DescribeValue( j , display );		
              plug->GetParamValue(j,display);
  			val = plug->GetParamValue( j );
--- 709,713 ----
  	if(*name) {
  		if (showparams) {
! //			plug->DescribeValue( j , display );
              plug->GetParamValue(j,display);
  			val = plug->GetParamValue( j );
***************
*** 652,655 ****
--- 721,736 ----
  }
  
+ V vst::m_pname(I pnum)
+ {
+     if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return;
+ 
+ 	char name[256]; // how many chars needed?
+ 	plug->GetParamName(pnum,name);
+ 
+     A at[2];
+     SetInt(at[0],pnum);
+     SetString(at[1],name);
+ 	ToOutAnything(GetOutAttr(),sym_pname,2,at);
+ }
  
  // set the value of a parameter
***************
*** 669,672 ****
--- 750,772 ----
  }
  
+ void vst::ms_params(int argc,const t_atom *argv)
+ {
+     if(plug) {
+         char str[255]; *str = 0;
+         if(argc && CanbeFloat(argv[argc-1]))
+             PrintList(argc-1,argv,str,sizeof str);
+ 
+         if(*str) {
+             int ix = plug->GetParamIx(str);
+             if(ix >= 0)
+                 ms_param(ix,GetAFloat(argv[argc-1]));
+             else
+                 post("%s %s - Parameter not found",thisName(),GetString(thisTag()),str);
+         }
+         else
+             post("%s - Syntax: %s name value",thisName(),GetString(thisTag()));
+     }
+ }
+ 
  V vst::mg_param(I pnum)
  {
***************
*** 676,695 ****
      SetInt(at[0],pnum);
      SetFloat(at[1],plug->GetParamValue(pnum));
! 	ToOutAnything(GetOutAttr(),MakeSymbol("param"),2,at);
  }
  
! V vst::m_pname(I pnum)
  {
!     if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return;
! 
!     C name[109]; /* the Steinberg(tm) way... */
! 
!     memset(name,0,sizeof(name));
! 	plug->GetParamName(pnum,name);
  
!     A at[2];
!     SetInt(at[0],pnum);
!     SetString(at[1],name);
! 	ToOutAnything(GetOutAttr(),MakeSymbol("pname"),2,at);
  }
  
--- 776,798 ----
      SetInt(at[0],pnum);
      SetFloat(at[1],plug->GetParamValue(pnum));
! 	ToOutAnything(GetOutAttr(),sym_param,2,at);
  }
  
! V vst::mg_params(int argc,const t_atom *argv)
  {
!     if(plug) {
!         char str[255];
!         PrintList(argc,argv,str,sizeof str);
  
!         if(*str) {
!             int ix = plug->GetParamIx(str);
!             if(ix >= 0)
!                 mg_param(ix);
!             else
!                 post("%s %s - Parameter not found",thisName(),GetString(thisTag()),str);
!         }
!         else
!             post("%s - Syntax: %s name value",thisName(),GetString(thisTag()));
!     }
  }
  
***************
*** 698,703 ****
      if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return;
  
! 	C display[164];  /* the Steinberg(tm) way... */
! 
  	memset(display,0,sizeof(display));
  	plug->GetParamValue(pnum,display);
--- 801,805 ----
      if(!plug || pnum < 0 || pnum >= plug->GetNumParams()) return;
  
! 	char display[256]; // how many chars needed?
  	memset(display,0,sizeof(display));
  	plug->GetParamValue(pnum,display);
***************
*** 706,710 ****
      SetInt(at[0],pnum);
      SetString(at[1],display);
! 	ToOutAnything(GetOutAttr(),MakeSymbol("ptext"),2,at);
  }
  
--- 808,830 ----
      SetInt(at[0],pnum);
      SetString(at[1],display);
! 	ToOutAnything(GetOutAttr(),sym_ptext,2,at);
! }
! 
! V vst::m_ptexts(int argc,const t_atom *argv)
! {
!     if(plug) {
!         char str[255];
!         PrintList(argc,argv,str,sizeof str);
! 
!         if(*str) {
!             int ix = plug->GetParamIx(str);
!             if(ix >= 0)
!                 m_ptext(ix);
!             else
!                 post("%s %s - Parameter not found",thisName(),GetString(thisTag()),str);
!         }
!         else
!             post("%s - Syntax: %s name value",thisName(),GetString(thisTag()));
!     }
  }
  

Index: VstHost.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/vst/src/VstHost.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** VstHost.cpp	22 Aug 2004 02:47:19 -0000	1.11
--- VstHost.cpp	23 Aug 2004 02:42:16 -0000	1.12
***************
*** 12,16 ****
  #include "AEffectx.h"
  
! using namespace std;
  
  static VstTimeInfo _timeInfo;
--- 12,16 ----
  #include "AEffectx.h"
  
! #include <ctype.h>
  
  static VstTimeInfo _timeInfo;
***************
*** 22,26 ****
      h_dll(NULL),hwnd(NULL),_pEffect(NULL),
      posx(0),posy(0),
! 	_midichannel(0),queue_size(0)
  {}
  
--- 22,27 ----
      h_dll(NULL),hwnd(NULL),_pEffect(NULL),
      posx(0),posy(0),
! 	_midichannel(0),queue_size(0),
!     paramnamecnt(0)
  {}
  
***************
*** 63,74 ****
  	FLEXT_ASSERT(ret == 'NvEf');
  
! 	if (!Dispatch( effGetProductString, 0, 0, &_sProductName, 0.0f)) {
  		// no product name given by plugin -> extract it from the filename
  
! 		string str1(dllname);
! 		string::size_type slpos = str1.rfind('\\');
! 		if(slpos == string::npos) {
  			slpos = str1.rfind('/');
! 			if(slpos == string::npos)
  				slpos = 0;
  			else
--- 64,77 ----
  	FLEXT_ASSERT(ret == 'NvEf');
  
!     *_sProductName = 0;
! 	Dispatch( effGetProductString, 0, 0, &_sProductName, 0.0f);
!     if(_sProductName) {
  		// no product name given by plugin -> extract it from the filename
  
! 		std::string str1(dllname);
! 		std::string::size_type slpos = str1.rfind('\\');
! 		if(slpos == std::string::npos) {
  			slpos = str1.rfind('/');
! 			if(slpos == std::string::npos)
  				slpos = 0;
  			else
***************
*** 77,83 ****
  		else
  			++slpos;
! 		string str2 = str1.substr(slpos);
  		int snip = str2.find('.');
!         if( snip != string::npos )
  			str1 = str2.substr(0,snip);
  		else
--- 80,86 ----
  		else
  			++slpos;
! 		std::string str2 = str1.substr(slpos);
  		int snip = str2.find('.');
!         if( snip != std::string::npos )
  			str1 = str2.substr(0,snip);
  		else
***************
*** 86,99 ****
  	}
  	
! 	if(!Dispatch( effGetVendorString, 0, 0, &_sVendorName, 0.0f))
! 		strcpy(_sVendorName, "Unknown vendor");
  
  	_sDllName = dllname;
  
- /*
- 	Dispatch( effMainsChanged,  0, 1);
- 	Dispatch( effSetSampleRate,  0, 0,NULL,44100.);
- 	Dispatch( effSetBlockSize,  0, 64);
- */
  	return VSTINSTANCE_NO_ERROR;
  }
--- 89,97 ----
  	}
  	
! 	*_sVendorName = 0;
! 	Dispatch( effGetVendorString, 0, 0, &_sVendorName, 0.0f);
  
  	_sDllName = dllname;
  
  	return VSTINSTANCE_NO_ERROR;
  }
***************
*** 141,157 ****
  void VSTPlugin::DspInit(float samplerate,int blocksize)
  {
! //	sample_rate = samplerate;
! 
!     Dispatch(effMainsChanged,  0, 1);
  	Dispatch(effSetSampleRate, 0, 0,NULL,samplerate);
  	Dispatch(effSetBlockSize,  0, blocksize);
  }
  
  void VSTPlugin::GetParamName(int numparam,char *name) const
  {
! 	if(numparam < GetNumParams()) 
          Dispatch(effGetParamName,numparam,0,name,0.0f);
  	else 
!         strcpy(name,"Index out of Range");
  }
  
--- 139,166 ----
  void VSTPlugin::DspInit(float samplerate,int blocksize)
  {
!     // sample rate and block size must _first_ be set
  	Dispatch(effSetSampleRate, 0, 0,NULL,samplerate);
  	Dispatch(effSetBlockSize,  0, blocksize);
+     // than signal that mains have changed!
+     Dispatch(effMainsChanged,  0, 1);
+ }
+ 
+ static void striptrail(char *txt)
+ {
+     // strip trailing whitespace
+     for(int i = strlen(txt)-1; i >= 0; --i) 
+         // cast to unsigned char since isspace functions don't want characters like 0x80 = -128
+         if(isspace(((unsigned char *)txt)[i])) txt[i] = 0;
  }
  
  void VSTPlugin::GetParamName(int numparam,char *name) const
  {
!     if(numparam < GetNumParams()) {
!         name[0] = 0;
          Dispatch(effGetParamName,numparam,0,name,0.0f);
+         striptrail(name);
+     }
  	else 
!         name[0] = 0;
  }
  
***************
*** 170,181 ****
      if(Is()) {
          if(numparam < GetNumParams()) {
! //			char par_name[64];
! 			char par_display[64];
! 			char par_label[64];
! 
! //			Dispatch(effGetParamName,parameter,0,par_name,0.0f);
  			Dispatch(effGetParamDisplay,numparam,0,par_display,0.0f);
! 			Dispatch(effGetParamLabel,numparam,0,par_label,0.0f);
! //			sprintf(psTxt,"%s:%s%s",par_name,par_display,par_label);
  			sprintf(parval,"%s%s",par_display,par_label);
          }
--- 179,193 ----
      if(Is()) {
          if(numparam < GetNumParams()) {
!             // how many chars needed?
!             char par_display[64]; par_display[0] = 0;
  			Dispatch(effGetParamDisplay,numparam,0,par_display,0.0f);
! //            if(par_display[7]) par_display[8] = 0; // set trailing zero
! 
!             // how many chars needed?
! 			char par_label[64]; par_label[0] = 0;
!             Dispatch(effGetParamLabel,numparam,0,par_label,0.0f);
!             striptrail(par_label);
! //            if(par_label[7]) par_label[8] = 0; // set trailing zero
! 
  			sprintf(parval,"%s%s",par_display,par_label);
          }
***************
*** 195,198 ****
--- 207,230 ----
  }
  
+ void VSTPlugin::ScanParams(int cnt)
+ {
+     if(cnt < 0) cnt = GetNumParams();
+     if(paramnamecnt >= cnt) return;
+     if(cnt >= GetNumParams()) cnt = GetNumParams();
+ 
+     char name[64];
+     for(int i = paramnamecnt; i < cnt; ++i) {
+         GetParamName(i,name);
+         if(*name) paramnames[std::string(name)] = i;
+     }
+     paramnamecnt = cnt;
+ }
+ 
+ int VSTPlugin::GetParamIx(const char *p) const
+ {
+     NameMap::const_iterator it = paramnames.find(std::string(p));
+     return it == paramnames.end()?-1:it->second;
+ }
+ 
  void VSTPlugin::Edit(bool open)
  {	
***************
*** 309,315 ****
  bool VSTPlugin::GetProgramName( int cat , int p, char *buf) const
  {
  	int parameter = p;
! 	if(parameter < GetNumPrograms()) {
  		Dispatch(effGetProgramNameIndexed,parameter,cat,buf,0.0f);
  		return true;
  	}
--- 341,349 ----
  bool VSTPlugin::GetProgramName( int cat , int p, char *buf) const
  {
+     buf[0] = 0;
  	int parameter = p;
! 	if(parameter < GetNumPrograms() && cat < GetNumCategories()) {
  		Dispatch(effGetProgramNameIndexed,parameter,cat,buf,0.0f);
+         striptrail(buf);
  		return true;
  	}

Index: VstHost.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/vst/src/VstHost.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** VstHost.h	25 Feb 2004 05:34:53 -0000	1.7
--- VstHost.h	23 Aug 2004 02:42:16 -0000	1.8
***************
*** 73,76 ****
--- 73,83 ----
  	float GetParamValue(int numparam) const;
  
+     // scan plugin names (can take a _long_ time!!)
+     void ScanParams(int i = -1);
+     // get number of scanned parameters
+     int ScannedParams() const { return paramnamecnt; }
+     // get index of named (scanned) parameter... -1 if not found
+     int GetParamIx(const char *p) const;
+ 
      bool SetParamFloat(int parameter, float value);
      bool SetParamInt(int parameter, int value) { return SetParamFloat(parameter,value/65535.0f); }
***************
*** 144,147 ****
--- 151,164 ----
      std::string _sDllName;	// Contains dll name
  
+     struct NameCmp:
+         std::less<std::string>
+     {
+         bool operator()(const std::string &a,const std::string &b) const { return a.compare(b) < 0; }
+     };
+ 
+     typedef std::map<std::string,int,NameCmp> NameMap;
+     int paramnamecnt;
+     NameMap paramnames;
+ 
  /*
  	float *inputs[MAX_INOUTS];





More information about the Pd-cvs mailing list