- d = cdimg_read_func(cddaHandle, sndbuffer + s, cdda_cur_sector);
- if (d < CD_FRAMESIZE_RAW)
- break;
-
- if (cdda_cur_sector < cdda_first_sector)
- memset(sndbuffer + s, 0, CD_FRAMESIZE_RAW);
+ sector_offs = cdda_cur_sector - cdda_first_sector;
+ if (sector_offs < 0) {
+ d = CD_FRAMESIZE_RAW;
+ memset(sndbuffer + s, 0, d);
+ }
+ else {
+ d = cdimg_read_func(cddaHandle, cdda_file_offset,
+ sndbuffer + s, sector_offs);
+ if (d < CD_FRAMESIZE_RAW)
+ break;
+ }