diff options
| author | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-10-30 16:57:58 +0000 |
|---|---|---|
| committer | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-10-30 16:57:58 +0000 |
| commit | b224a1e794a7f241c69a7daa390e65dfba085b9c (patch) | |
| tree | 65d688c14c48deedcc6b2dbb39863084e0e032b6 /libpcsxcore/cdriso.c | |
| parent | 35ab5b225bfb7af2d4fd4b76e79af147fbbd7ee9 (diff) | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@58936 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'libpcsxcore/cdriso.c')
| -rw-r--r-- | libpcsxcore/cdriso.c | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 5bef990a..0e7b4bb1 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -132,11 +132,11 @@ static long GetTickCount(void) { } #endif -
-u16 *iso_play_cdbuf;
-u16 iso_play_bufptr;
-
-
+ +u16 *iso_play_cdbuf; +u16 iso_play_bufptr; + + // this thread plays audio data #ifdef _WIN32 static void playthread(void *param) @@ -145,14 +145,14 @@ static void *playthread(void *param) #endif { long d, t, i, s; - unsigned char tmp;
+ unsigned char tmp; int sec; t = GetTickCount(); - iso_play_cdbuf = 0;
- iso_play_bufptr = 0;
-
+ iso_play_cdbuf = 0; + iso_play_bufptr = 0; + while (playing) { d = t - (long)GetTickCount(); if (d <= 0) { @@ -187,8 +187,8 @@ static void *playthread(void *param) else { s = fread(sndbuffer, 1, sizeof(sndbuffer), cddaHandle); - sec = cddaCurOffset / CD_FRAMESIZE_RAW;
-
+ sec = cddaCurOffset / CD_FRAMESIZE_RAW; + if (subHandle != NULL) { fseek(subHandle, sec * SUB_FRAMESIZE, SEEK_SET); fread(subbuffer, 1, SUB_FRAMESIZE, subHandle); @@ -212,59 +212,59 @@ static void *playthread(void *param) } } - // wipe data track
- if( subHandle || subChanMixed ) {
- if( ti[ ((struct SubQ *) subbuffer)->TrackNumber ].type == DATA )
- memset( sndbuffer, 0, s );
- }
-
+ // wipe data track + if( subHandle || subChanMixed ) { + if( ti[ ((struct SubQ *) subbuffer)->TrackNumber ].type == DATA ) + memset( sndbuffer, 0, s ); + } + SPU_playCDDAchannel((short *)sndbuffer, s); } -
+ cddaCurOffset += s; -
-
- // BIOS CD Player: Fast forward / reverse seek
- if( cdr.FastForward ) {
- // ~+0.25 sec
- cddaCurOffset += CD_FRAMESIZE_RAW * 75 * 3;
-
-#if 0
- // Bad idea: too much static
- if( subChanInterleaved )
- fseek( cddaHandle, s * (CD_FRAMESIZE_RAW + SUB_FRAMESIZE), SEEK_SET );
- else
- fseek( cddaHandle, s * CD_FRAMESIZE_RAW, SEEK_SET );
-#endif
- }
- else if( cdr.FastBackward ) {
- // ~-0.25 sec
- cddaCurOffset -= CD_FRAMESIZE_RAW * 75 * 3;
- if( cddaCurOffset & 0x80000000 ) {
- cddaCurOffset = 0;
- cdr.FastBackward = 0;
-
- playing = 0;
- fclose(cddaHandle);
- cddaHandle = NULL;
- initial_offset = 0;
- break;
- }
-
-#if 0
- // Bad idea: too much static
- if( subChanInterleaved )
- fseek( cddaHandle, s * (CD_FRAMESIZE_RAW + SUB_FRAMESIZE), SEEK_SET );
- else
- fseek( cddaHandle, s * CD_FRAMESIZE_RAW, SEEK_SET );
-#endif
- }
-
-
- // Vib Ribbon: decoded buffer IRQ
- iso_play_cdbuf = sndbuffer;
- iso_play_bufptr = 0;
+ + + // BIOS CD Player: Fast forward / reverse seek + if( cdr.FastForward ) { + // ~+0.25 sec + cddaCurOffset += CD_FRAMESIZE_RAW * 75 * 3; + +#if 0 + // Bad idea: too much static + if( subChanInterleaved ) + fseek( cddaHandle, s * (CD_FRAMESIZE_RAW + SUB_FRAMESIZE), SEEK_SET ); + else + fseek( cddaHandle, s * CD_FRAMESIZE_RAW, SEEK_SET ); +#endif + } + else if( cdr.FastBackward ) { + // ~-0.25 sec + cddaCurOffset -= CD_FRAMESIZE_RAW * 75 * 3; + if( cddaCurOffset & 0x80000000 ) { + cddaCurOffset = 0; + cdr.FastBackward = 0; + + playing = 0; + fclose(cddaHandle); + cddaHandle = NULL; + initial_offset = 0; + break; + } + +#if 0 + // Bad idea: too much static + if( subChanInterleaved ) + fseek( cddaHandle, s * (CD_FRAMESIZE_RAW + SUB_FRAMESIZE), SEEK_SET ); + else + fseek( cddaHandle, s * CD_FRAMESIZE_RAW, SEEK_SET ); +#endif + } + + + // Vib Ribbon: decoded buffer IRQ + iso_play_cdbuf = sndbuffer; + iso_play_bufptr = 0; } #ifdef _WIN32 @@ -695,7 +695,7 @@ static int opensubfile(const char *isoname) { return 0; } -static long CALLBACK ISOinit(void) { +long CALLBACK ISOinit(void) { assert(cdHandle == NULL); assert(subHandle == NULL); @@ -750,12 +750,12 @@ static long CALLBACK ISOopen(void) { else if (parsemds(GetIsoFile()) == 0) { SysPrintf("[+mds]"); } - else if (parsecue(GetIsoFile()) == 0) {
- SysPrintf("[+cue]");
- }
- else if (parsetoc(GetIsoFile()) == 0) {
- SysPrintf("[+toc]");
- }
+ else if (parsecue(GetIsoFile()) == 0) { + SysPrintf("[+cue]"); + } + else if (parsetoc(GetIsoFile()) == 0) { + SysPrintf("[+toc]"); + } if (!subChanMixed && opensubfile(GetIsoFile()) == 0) { SysPrintf("[+sub]"); @@ -919,22 +919,22 @@ static unsigned char* CALLBACK ISOgetBufferSub(void) { } static long CALLBACK ISOgetStatus(struct CdrStat *stat) { - u32 sect;
-
- CDR__getStatus(stat);
-
- if (playing) {
- stat->Status |= 0x80;
- }
-
- // relative -> absolute time
- sect = cddaCurOffset / CD_FRAMESIZE_RAW + 150;
- sec2msf(sect, (u8 *)stat->Time);
-
- // BIOS - boot ID (CD type)
- stat->Type = ti[1].type;
-
- return 0;
+ u32 sect; + + CDR__getStatus(stat); + + if (playing) { + stat->Status |= 0x80; + } + + // relative -> absolute time + sect = cddaCurOffset / CD_FRAMESIZE_RAW + 150; + sec2msf(sect, (u8 *)stat->Time); + + // BIOS - boot ID (CD type) + stat->Type = ti[1].type; + + return 0; } void cdrIsoInit(void) { |
