diff -urN mcd-0.2b/Makefile mcd-0.2c/Makefile --- mcd-0.2b/Makefile Sun Jul 22 19:53:41 2001 +++ mcd-0.2c/Makefile Sun Jul 22 23:53:21 2001 @@ -7,7 +7,7 @@ #CC = gcc CC = diet gcc -CFLAGS = -Os -Wall -pipe -fomit-frame-pointer +CFLAGS = -O2 -Wall -pipe -fomit-frame-pointer LDFLAGS = S_FLAGS = -R .note -R .comment diff -urN mcd-0.2b/cddev.c mcd-0.2c/cddev.c --- mcd-0.2b/cddev.c Sun Jul 22 19:51:43 2001 +++ mcd-0.2c/cddev.c Mon Jul 23 03:55:11 2001 @@ -5,21 +5,19 @@ * See doc/README for more information about COPYING terms. */ #include "mcd.h" - static void cd_playmsf(struct mcd *cd, struct cdrom_msf *msf); static void cd_playmsf(struct mcd *cd, struct cdrom_msf *msf) { - if (cd->cds.cdsc_audiostatus == CDROM_AUDIO_PLAY) { - if (ioctl(cd->fd,CDROMPAUSE,NULL)<0) - draw_status("error, while stopping",1); + if (cd->status == CDROM_AUDIO_PLAY) { + if (ioctl(cd->fd,CDROMPAUSE,NULL)<0) + draw_status("error: stopping",1); } if (ioctl(cd->fd,CDROMPLAYMSF, msf)<0) - draw_status("error, while playing",1); + draw_status("error: playing",1); return; } /* GLOBAL */ - /* open device or exit ! */ int cd_init(const char *cdpath, struct mcd *cd) { cd->fd=open(cdpath,O_RDONLY|O_NONBLOCK); @@ -89,17 +87,23 @@ /* audiostatus changed */ if (cd->cds.cdsc_audiostatus!=cd->status) { cd->status=cd->cds.cdsc_audiostatus; - if (cd->method==M_INTRO) { - updates[U_TRACKS]=1; - cd->title[0]++; + /* intro */ + if (cd->method==M_INTRO && cd->status==CDROM_AUDIO_COMPLETED) { + cd->title[0]++; updates[U_TRACKS]=1; cd_start(&cd[0]); } - if ((cd->method==M_REPEAT_CD) && cd->title[0]==cd->title[1]) { - updates[U_TRACKS]=1; - cd->title[0]=1; + /* repeat cd */ + if (cd->method==M_REPEAT_CD && + cd->title[0]==cd->title[1] && + cd->status==CDROM_AUDIO_COMPLETED) { + cd->title[0]=1; updates[U_TRACKS]=1; cd_start(&cd[0]); } - updates[U_STATUS]=1; + /* needed for the last track */ + if (cd->method==M_REPEAT_TRK && cd->status==CDROM_AUDIO_COMPLETED) { + cd_start(&cd[0]); + } + updates[U_STATUS]=1; /* show status */ } /* volume(0..3) changed */ @@ -114,7 +118,7 @@ cd->vol.channel3=cdv.channel3; updates[U_VOLUME]=1; } /* track changed */ - if (cd->cds.cdsc_trk!=cd->title[0]) { /* title[0]=current title[1]=max */ + if (cd->cds.cdsc_trk!=cd->title[0] && cd->method!=M_INTRO) { /* title[0]=current title[1]=max */ if (cd->method==M_REPEAT_TRK) { cd_start(&cd[0]); return cd->title[0]; @@ -137,9 +141,11 @@ msf.cdmsf_min0 = cd->cdte[cd->title[0]].cdte_addr.msf.minute; msf.cdmsf_sec0 = cd->cdte[cd->title[0]].cdte_addr.msf.second; msf.cdmsf_frame0 = cd->cdte[cd->title[0]].cdte_addr.msf.frame; + if (cd->method==M_INTRO) { msf.cdmsf_min1 = cd->cdte[cd->title[0]].cdte_addr.msf.minute; msf.cdmsf_sec1 = cd->cdte[cd->title[0]].cdte_addr.msf.second+MCD_INTRO_TIME; + if (msf.cdmsf_sec1>=60) { msf.cdmsf_min1++; msf.cdmsf_sec1-=60; } msf.cdmsf_frame1 = cd->cdte[cd->title[0]].cdte_addr.msf.frame; } else { /* leadout */ @@ -156,7 +162,7 @@ void cd_skip(struct mcd *cd, int secs) { struct cdrom_msf msf; - if (cd->method==M_INTRO) return; /* skipping, if intros */ + if (cd->method==M_INTRO) return; /* skipping @intros ? */ if ((cd->title[0]==1) && (secs<0)) { if (cd->cds.cdsc_absaddr.msf.minute*60+cd->cds.cdsc_absaddr.msf.second+secs<=2) diff -urN mcd-0.2b/doc/CHANGES mcd-0.2c/doc/CHANGES --- mcd-0.2b/doc/CHANGES Sun Jul 22 19:56:42 2001 +++ mcd-0.2c/doc/CHANGES Mon Jul 23 03:17:16 2001 @@ -1,3 +1,9 @@ +0.2c: + fixed play-method repeat cd in cd_start() + fixed play-method intro in cd_start() and cd_readsubchannel() + fixed draw.c in some cases (only apearence) + set MCD_INTRO_TIME in params.h to 10 + 0.2b: added this file (doc/CHANGES) removed shuffle completly, it will be included if it is stable diff -urN mcd-0.2b/draw.c mcd-0.2c/draw.c --- mcd-0.2b/draw.c Sun Jul 22 20:09:55 2001 +++ mcd-0.2c/draw.c Mon Jul 23 03:13:29 2001 @@ -5,7 +5,6 @@ * See doc/README for more information about COPYING terms. */ #include "mcd.h" - static void draw_hline(int i, char *ch); /* draw an hline */ static void draw_box(int x1, int y1, int x2, int y2); /* draw a box */ static void draw_method(char *msg); @@ -117,7 +116,7 @@ draw_status( (cd->status==CDROM_AUDIO_NO_STATUS) ? "no status":"" && (cd->status==CDROM_AUDIO_ERROR ) ? "error ":"" && - (cd->status==CDROM_AUDIO_COMPLETED) ? "stopped ":"" && + (cd->status==CDROM_AUDIO_COMPLETED) ? "completed":"" && (cd->status==CDROM_AUDIO_PAUSED ) ? "paused ":"" && (cd->status==CDROM_AUDIO_PLAY ) ? "playing ":"" && (cd->status==CDROM_AUDIO_INVALID ) ? "invalid ":"",0); @@ -147,9 +146,10 @@ /* always */ gotoxy(11,7); - _printf("%02d:%02d", + _printf("%02d:%02d (%2d/%2d)", cd->cds.cdsc_reladdr.msf.minute, - cd->cds.cdsc_reladdr.msf.second); + cd->cds.cdsc_reladdr.msf.second, + cd->title[0],cd->title[1]); gotoxy(11,8); _printf("%02d:%02d", cd->cds.cdsc_absaddr.msf.minute, diff -urN mcd-0.2b/mcd.1 mcd-0.2c/mcd.1 --- mcd-0.2b/mcd.1 Sun Jul 22 19:36:57 2001 +++ mcd-0.2c/mcd.1 Mon Jul 23 03:54:34 2001 @@ -1,14 +1,14 @@ .\" Tino Reichardt -.TH MCD 1 "2001-07-22" "mcd-0.2b" "User commands" +.TH MCD 1 "2001-07-23" "mcd-0.2c" "User commands" .SH "NAME" mcd \- a small cdplayer for linux .SH "SYNOPSIS" \fBmcd\fR [\fI/dev/some-cdrom-device\fR] -.SH "OPTIONS" -There is simple only one (optional) option: a cd device (e.g. /dev/cdrom2) ! .SH "DESCRIPTION" The command \fBmcd\fR is used for playing AudioCD's. It has a curses like userinterface and is fairly simple to use. +.SH "OPTIONS" +There is only one (optional) option: a cd device (e.g. /dev/cdrom2) ! .SH "KEYS" .TS tab (@); diff -urN mcd-0.2b/mcd.c mcd-0.2c/mcd.c --- mcd-0.2b/mcd.c Sun Jul 22 20:10:58 2001 +++ mcd-0.2c/mcd.c Mon Jul 23 02:22:08 2001 @@ -91,6 +91,10 @@ case 'C': case 'c': cd_close(&cd->fd); + case '?': + case 'H': + case 'h': + draw_status("See manpage !",2); break; case '+': pluskey=(pluskey<9)?++pluskey:0; @@ -104,20 +108,23 @@ cd->vol.channel0=cd->vol.channel1=cd->vol.channel2=cd->vol.channel3= (cd->vol.channel0>0)?cd->vol.channel0-=3:255; if (ioctl(cd->fd,CDROMVOLCTRL,&cd->vol)<0) - draw_status("error, setting volume",1); + draw_status("error: setting volume",1); updates[U_VOLUME]=1; break; case '>': cd->vol.channel0=cd->vol.channel1=cd->vol.channel2=cd->vol.channel3= (cd->vol.channel0<255)?cd->vol.channel0+=3:0; if (ioctl(cd->fd,CDROMVOLCTRL,&cd->vol)<0) - draw_status("error, setting volume",1); + draw_status("error: setting volume",1); updates[U_VOLUME]=1; break; case 'q': case 'Q': quit=1; break; case '0': + if (!pluskey && !((int)ch-48)) { + draw_status("hey, this isn't valid!",1); break; + } case '1': case '2': case '3': @@ -127,18 +134,15 @@ case '7': case '8': case '9': - if ((pluskey==0)&&((int)ch-48)==0) { - draw_status("hey, this isn't valid!",1); - break; - } else { - cd->title[0]=((pluskey*10)+((int)ch-48)); - cd_start(&cd[0]); - } + if ((pluskey*10)+((int)ch-48)>cd->title[1] || (pluskey*10)+((int)ch-48)<1) break; + else { + cd->title[0]=((pluskey*10)+((int)ch-48)); + cd_start(&cd[0]); updates[U_TRACKS]=1; - break; - } - } - } + } break; + } /* switch */ + } /* select */ + } /* while */ mcd_quit(1); /* cleanup */ exit(0); } diff -urN mcd-0.2b/mcd.h mcd-0.2c/mcd.h --- mcd-0.2b/mcd.h Sun Jul 22 20:11:14 2001 +++ mcd-0.2c/mcd.h Mon Jul 23 03:55:21 2001 @@ -24,7 +24,7 @@ #include "params.h" -#define MCD_VERSION "0.2b" +#define MCD_VERSION "0.2c" /* METHODS (don't change!) */ #define M_PLAY_CD 0 /* play whole cd and stop */ @@ -94,15 +94,12 @@ extern int cd_init(const char *cdpath, struct mcd *cd); extern int cd_readtracks(struct mcd *cd); extern int cd_readsubchannel(struct mcd *cd); - extern void cd_pauseresume(struct mcd *cd); extern void cd_skip(struct mcd *cd, int secs); extern void cd_start(struct mcd *cd); extern void cd_stop(struct mcd *cd); extern void cd_eject(int *fd); extern void cd_close(int *fd); -extern void cd_initshuffle(struct mcd *cd); -extern void cd_randomize(struct mcd *cd); /* ********* */ /* formats.c */ diff -urN mcd-0.2b/params.h mcd-0.2c/params.h --- mcd-0.2b/params.h Sun Jul 22 19:59:12 2001 +++ mcd-0.2c/params.h Mon Jul 23 03:20:33 2001 @@ -1,13 +1,14 @@ /* * Please edit these settings to match your system. * When you're done, type 'make' to compile and link. + * Then you may install with 'make install'. */ #ifndef _MCD_PARAMS_H #define _MCD_PARAMS_H #define CDROM_DEFAULT "/dev/cdrom" -#define MCD_INTRO_TIME 2 /* seconds for the intro */ +#define MCD_INTRO_TIME 10 /* seconds for the intro */ #define MCD_CDAUDIO_MAX 99 /* maxtracks of the cd (RedBook) */ #define FW_FAST 30 /* FF (sec. ffast forward) */ @@ -50,6 +51,5 @@ * fg: 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=grey * bg: 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=grey */ - #endif /* _MCD_PARAMS_H */