Return to previous page Return to menu Go to next page

(3) Read ahead to CD buffer

When reading large files successively little by little, you can maximize the CD reading speed by specifying prefetching to the CD buffer with GFS_NwCdRead.
In the following program example, a 1000-sector file is read continuously 10 sectors at a time. Since GFS_NwCdRead specifies that 1000 sectors are read ahead, the target file is played back continuously for 1000 sectors and stored in the buffer. Since data is taken out from the CD buffer in parallel with this processing, the buffer is not full and playback is not interrupted.
* If the processing in this example is performed without using prefetching, CD playback will be interrupted every 10 sectors, resulting in wasted time.

 [Example]
#define SECT_SIZE 2048
#define FILE_SIZE     1000*SECT_SIZE
#define RD_UNIT       10

Uint8 * rd_bp, * proc_bp; / * Read buffer and processing buffer * / Uint32 buf1 [RD_UNIT * SECT_SIZE / 4]; / ​​* Data storage area 1 * / Uint32 buf2 [RD_UNIT * SECT_SIZE / 4]; / ​​* Data storage area 2 * / GfsHn gfs; Sint32 i, stat, nbyte;

gfs = GFS_Open(fid); GFS_NwCdRead (gfs, FILE_SIZE); / * Prefetch instruction to CD buffer * / GFS_SetTransPara (gfs, RD_UNIT); / * Take out the maximum RD_UNIT sector once * / for (i = 0; i


Return to previous page Return to menu Go to next page