1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-14 23:46:10 +00:00
freebsd-ports/audio/cdplay/files/patch-ab
Tim Vanderhoek d088df7687 Add patches to support IDE cd-roms. While I'm here, respect
${CFLAGS}.  Heck, why not go all the way and respect ${PREFIX},
too (respect now added).  As an intentional side-effect, these
patches also prevent the pause function from blasting the listener's
ears off (the way cdcontrol currently does (and cdplay used to)).
1998-06-27 05:35:02 +00:00

74 lines
2.0 KiB
Plaintext

--- cd.c.orig Fri Oct 24 11:38:25 1997
+++ cd.c Sat Jun 27 00:53:10 1998
@@ -98,8 +98,15 @@
cd_play.end_s=cdinfo.s_sec[cdinfo.l_track-1];
cd_play.end_f=cdinfo.s_frame[cdinfo.l_track-1];
- if(ioctl (cd_fd, CDIOCPLAYMSF, (char *) &cd_play)<0)
- per();
+ if(ioctl (cd_fd, CDIOCPLAYMSF, (char *) &cd_play)<0) {
+ /* Hack for IDE CD-ROMs */
+ if (cd_play.start_s < 2) {
+ cd_play.start_s=2;
+ if(ioctl (cd_fd, CDIOCPLAYMSF, (char *) &cd_play)<0)
+ per();
+ } else
+ per();
+ }
}
/* Skips one track forward */
@@ -111,7 +118,7 @@
/* Quess */
void prev(void)
{
- if(cdinfo.c_sec<1)
+ if(cdinfo.c_sec<4)
play_track(cdinfo.c_track-1);
else play_track(cdinfo.c_track);
}
@@ -141,6 +148,43 @@
}
}
+/* Softly pauses the cd, or unpauses, as appropriate */
+void cdsoftpause(void)
+{
+ struct ioc_vol real_vol, cur_vol;
+ int i;
+
+ if(ioctl(cd_fd,CDIOCGETVOL,(char *) &real_vol)) per();
+ cur_vol = real_vol;
+
+ if(cdinfo.pause){
+ message="continue";
+ memset (cur_vol.vol, 0, sizeof(cur_vol.vol));
+ if(ioctl(cd_fd,CDIOCSETVOL,(char *) &cur_vol)) per();
+ if(ioctl(cd_fd,CDIOCRESUME)<0) per(); else cdinfo.pause=0;
+ for (i=0; i<20; usleep(21), i++) {
+ cur_vol.vol[0] += (real_vol.vol[0] / 20);
+ cur_vol.vol[1] += (real_vol.vol[1] / 20);
+ cur_vol.vol[2] += (real_vol.vol[2] / 20);
+ cur_vol.vol[3] += (real_vol.vol[3] / 20);
+ if(ioctl(cd_fd,CDIOCSETVOL,(char *) &cur_vol)) per();
+ }
+ if(ioctl(cd_fd,CDIOCSETVOL,(char *) &real_vol)) per();
+ }
+ else {
+ message="pause";
+ for (i=0; i<20; usleep(21), i++) {
+ cur_vol.vol[0] -= (real_vol.vol[0] / 20);
+ cur_vol.vol[1] -= (real_vol.vol[1] / 20);
+ cur_vol.vol[2] -= (real_vol.vol[2] / 20);
+ cur_vol.vol[3] -= (real_vol.vol[3] / 20);
+ if(ioctl(cd_fd,CDIOCSETVOL,(char *) &cur_vol)) per();
+ }
+ if(ioctl (cd_fd, CDIOCPAUSE)<0) per(); else cdinfo.pause=1;
+ if(ioctl (cd_fd, CDIOCSETVOL,(char *) &real_vol)) per();
+ }
+}
+
/* Huge kludge */
void ff(void)
{