Ejemplo n.º 1
0
void WaveTrack::Read(sampleType * buffer, WaveBlock * b,
                     sampleCount start, sampleCount len)
{
   wxASSERT(b);
   wxASSERT(start >= 0);
   wxASSERT(start + len <= b->len);

   BlockFile *f = b->f;
   bool opened = f->OpenReadData();
   wxASSERT(opened);

   f->SeekTo(totalHeaderLen + (start * sizeof(sampleType)));

   int result = f->Read((void *) buffer, (int) (len * sizeof(sampleType)));

   if (result != (int) (len * sizeof(sampleType))) {
      printf("Expected to read %d bytes, got %d bytes.\n",
             len * sizeof(sampleType), result);
   }

   wxASSERT(result == (int) (len * sizeof(sampleType)));

   f->Close();
}