]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cd_bsd.c
updated darkplaces icon with 6 sizes of 32bit (XP icon) and 4 sizes of 8bit (non...
[xonotic/darkplaces.git] / cd_bsd.c
index bdb6f751942af8844690e70e443006179b112445..5f4aa2b260f17a9149f7b040d86c5cd1ebf417cc 100644 (file)
--- a/cd_bsd.c
+++ b/cd_bsd.c
@@ -62,6 +62,9 @@ int CDAudio_SysGetAudioDiskInfo (void)
 {
        struct ioc_toc_header tochdr;
 
+       if (cdfile == -1)
+               return -1;
+
        if (ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1)
        {
                Con_DPrint("ioctl CDIOREADTOCHEADER failed\n");
@@ -78,6 +81,38 @@ int CDAudio_SysGetAudioDiskInfo (void)
 }
 
 
+float CDAudio_SysGetVolume (void)
+{
+       struct ioc_vol vol;
+
+       if (cdfile == -1)
+               return -1.0f;
+
+       if (ioctl (cdfile, CDIOCGETVOL, &vol) == -1)
+       {
+               Con_DPrint("ioctl CDIOCGETVOL failed\n");
+               return -1.0f;
+       }
+
+       return (vol.vol[0] + vol.vol[1]) / 2.0f / 255.0f;
+}
+
+
+void CDAudio_SysSetVolume (float volume)
+{
+       struct ioc_vol vol;
+
+       if (cdfile == -1)
+               return;
+
+       vol.vol[0] = vol.vol[1] = volume * 255;
+       vol.vol[2] = vol.vol[3] = 0;
+
+       if (ioctl (cdfile, CDIOCSETVOL, &vol) == -1)
+               Con_DPrintf ("ioctl CDIOCSETVOL failed\n");
+}
+
+
 int CDAudio_SysPlay (qbyte track)
 {
        struct ioc_read_toc_entry rte;