]> 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 6c8f9a81aa89149ad39e210c9d50986f6bda668f..5f4aa2b260f17a9149f7b040d86c5cd1ebf417cc 100644 (file)
--- a/cd_bsd.c
+++ b/cd_bsd.c
@@ -83,14 +83,33 @@ int CDAudio_SysGetAudioDiskInfo (void)
 
 float CDAudio_SysGetVolume (void)
 {
-       // IMPLEMENTME
-       return -1.0f;
+       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)
 {
-       // IMPLEMENTME
+       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");
 }