// file: $isip/doc/examples/class/mmedia/mmedia_example_00/example.cc
// version: $Id: example.cc 6107 2000-12-28 21:23:56Z hamaker $
//

// isip include files
//
#include <AudioFile.h>

// main program starts here
//
int main() {
  
  // declare AudioFile objects for read and write
  //
  AudioFile src;
  src.open(L"./input.raw");
  
  AudioFile dst;
  dst.setFileType(AudioFile::SOF_TEXT);    
  String output(L"./output.sof");
  dst.open(output, File::WRITE_ONLY);
  
  // loop through 50 samples at a time
  //
  for (long i = 0; i < 5; i++) {
    
    Vector<VectorFloat> data(1);
    
    // call
    // getData(VectorFloat& data, long channel_tag, long start_samp, long num_samp);
    //
    src.getData(data(0), 0, i * 50, 501);
    
    // write these 50 samples to the output
    //
    dst.writeAudioData(data, 0);
  }
  src.close();
  dst.close();
  
  output.debug(L"output");
  
  // exit gracefully
  //
  Integral::exit();
}
