void WaveTrack::Read64K(sampleType * buffer, WaveBlock * b, sampleCount start, sampleCount len) { wxASSERT(b); wxASSERT(start >= 0); wxASSERT(start + len <= ((b->len + 65535) / 65536)); start *= 2; len *= 2; BlockFile *f = b->f; bool opened = f->OpenReadHeader(); wxASSERT(opened); f->SeekTo(headerTagLen + start * sizeof(sampleType)); int result = f->Read((void *) buffer, (int) (len * sizeof(sampleType))); wxASSERT(result == (int) (len * sizeof(sampleType))); f->Close(); }
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(); }