diff options
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | libpcsxcore/cdriso.c | 19 | ||||
| -rw-r--r-- | plugins/dfcdrom/cdr.c | 16 |
3 files changed, 40 insertions, 2 deletions
@@ -1,3 +1,10 @@ +August 29, 2009 Wei Mingzhi <weimingzhi@gmail.com> + + * plugins/dfcdrom/cdr.c: Don't restart the track if play was called with + the same time as the previous call. + * libpcsxcore/cdriso.c: Added playCDDA() and stopCDDA() functions. (still + not implemented) + August 27, 2009 Wei Mingzhi <weimingzhi@gmail.com> * libpcsxcore/plugins.h: Added prototype and interface for diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index dbcf5147..94977022 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -111,6 +111,14 @@ static void tok2msf(char *time, char *msf) { } } +// start the CDDA playback +static void startCDDA(unsigned int offset) { +} + +// stop the CDDA playback +static void stopCDDA() { +} + // this function tries to get the .toc file of the given .bin // the necessary data is put into the ti (trackinformation)-array static int parsetoc(const char *isofile) { @@ -381,6 +389,7 @@ static long CALLBACK ISOshutdown(void) { fclose(subHandle); subHandle = NULL; } + stopCDDA(); return 0; } @@ -426,6 +435,7 @@ static long CALLBACK ISOclose(void) { fclose(subHandle); subHandle = NULL; } + stopCDDA(); return 0; } @@ -494,12 +504,17 @@ static unsigned char * CALLBACK ISOgetBuffer(void) { // sector: byte 0 - minute; byte 1 - second; byte 2 - frame // does NOT uses bcd format static long CALLBACK ISOplay(unsigned char *time) { - return 0; // TODO + if (SPU_playCDDAchannel != NULL) { + SysPrintf("Starting cdda-audio (%i:%i:%i)...\n", time[0], time[1], time[2]); + startCDDA(MSF2SECT(time[0], time[1], time[2]) * CD_FRAMESIZE_RAW); + } + return 0; } // stops cdda audio static long CALLBACK ISOstop(void) { - return 0; // TODO + stopCDDA(); + return 0; } // gets subchannel data diff --git a/plugins/dfcdrom/cdr.c b/plugins/dfcdrom/cdr.c index 2b2316fc..58e56275 100644 --- a/plugins/dfcdrom/cdr.c +++ b/plugins/dfcdrom/cdr.c @@ -35,6 +35,8 @@ static inline int msf_to_lba(char m, char s, char f) { return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET; } +int initial_time = 0; + pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t cond = PTHREAD_COND_INITIALIZER; @@ -127,6 +129,7 @@ long CDRopen(void) { playing = 0; stopth = 0; + initial_time = 0; return 0; } @@ -365,6 +368,18 @@ long CDRplay(unsigned char *sector) { if (cdHandle < 1) return 0; + // If play was called with the same time as the previous call, + // don't restart it. of course, if play is called with a different + // track, stop playing the current stream. + if (playing) + { + if (msf_to_lba(sector[0], sector[1], sector[2]) == initial_time) + return 0; + else + CDRstop(); + } + initial_time = msf_to_lba(sector[0], sector[1], sector[2]); + // 0 is the last track of every cdrom, so play up to there if (CDRgetTD(0, ptmp) == -1) return -1; @@ -402,6 +417,7 @@ long CDRstop(void) { } playing = 0; + initial_time = 0; return 0; } |
