Ejemplo n.º 1
0
SDIFfile::~SDIFfile(void)
{
	SdifGenKill();
	delete [] _filterPartials;
	delete [] _minFreqs;
	delete [] _maxFreqs;
	delete [] _avgFreqs;
	delete [] _maxAmps;
	for (long i = 0; i < _numFrames; i++)
		delete _frames[i];
	free(_frames);
	delete _curFrame;
}
Ejemplo n.º 2
0
/* open file and read header */
SdifFileT *open_file (char *infile)
{
    SdifFileT *file;

    SdifGenInit(NULL);
    if (!(file = SdifFOpen (infile, eReadFile)))
    {
	fprintf (SdifStdErr, "Can't open input file '%s'.\n", infile);
        SdifGenKill();
        exit(1);
    }

    /* read header */
    if (SdifFReadGeneralHeader(file) == 0  ||
	SdifFReadAllASCIIChunks(file) == 0)
    {
	fprintf (SdifStdErr, "Can't read header of input file '%s'.\n", infile);
	SdifFClose(file);
        SdifGenKill();
        exit(1);
    }

    return file;
}
Ejemplo n.º 3
0
static void sdiflists_types(t_sdiflists *x, t_symbol *types)
{
                  
  if(x->markers[0].filepos != -1 ) 
    {
      t_colout *u;
      int j;
      SdifFClose(x->file);
      for(j=0; j < x->nframes; j++)
        x->markers[j].timetag = x->markers[j].filepos = 0;

      x->markers[0].timetag = -1;
   
      for ( j=0, u = x->data; j < x->n_outs; u++, j++)
        freebytes( u->outvec, x->max_vec * sizeof(t_atom));
  
#if DEBUG                         
      post("sdiflists::types: closed previous file");              
#endif  
      x->nframes = IFRAMES;
    }                     	
  //prepend the full path onto the filename
  char fullfilename[MAXPDSTRING], namebuf[MAXPDSTRING];
  char buf[MAXPDSTRING], *bufptr, *dirname;
  int fd = 0;
															
  dirname=canvas_getdir(x->canvas)->s_name;
  t_binbuf *bbuf = binbuf_new();
  fd = open_via_path(dirname,  types->s_name,"", buf, &bufptr, MAXPDSTRING, 0);
  if(fd > 0)
    {
      namebuf[0] = 0;
      if (*buf)  
        strcat(namebuf, buf), strcat(namebuf, "/");
      strcat(namebuf, bufptr);
      sys_bashfilename(namebuf, fullfilename);
               
      SdifGenKill (); // have to close it to read a new .STYP
      SdifGenInitCond (types->s_name);
               
      post("sdiflists: types-declaration file: %s", types->s_name);     
    }
  else post ("sdiflists: types file %s could not be opened", types->s_name);
}