示例#1
0
void TSampler::open_file(char* pFileName) {
  if (zSampleIsLoaded) {
    close_file();
  }
  FileRead fileread;
  fileread.open(pFileName);
  std::cout << "read format: " << fileread.format() << std::endl;
  for(int p=0; p<cPolyNum; p++)
  {
    zLoop[p].resize(fileread.fileSize(), fileread.channels());
    fileread.read(zLoop[p], 0, false);
  }
  zLoopLength = fileread.fileSize();
  zNumOfChannels = fileread.channels();
  zSampleIsLoaded = 1;
  float max = -100000;
  float min =  100000;
  for(int i = 0; i < zLoopLength; i++)
  {
    if (zLoop[0][i] > max)
    {
        max = zLoop[0][i];
    }
    if (zLoop[0][i] < min)
    {
        min = zLoop[0][i];
    }
  }
  std::cout << "first read value" << zLoop[0][0] << std::endl;
  std::cout << "max read value:" << max << std::endl;
  std::cout << "min read value:" << min << std::endl;
}
示例#2
0
void Cut::thaw( const char* path )
{
	clear();

	FileRead thaw;
	
	thaw.open( path );

	m_cutSize = thaw.fileSize();
	m_frames = new StkFrames( thaw.fileSize(), N_CHANNELS );


	thaw.read( *m_frames, 0, true );
}