* [drawterm] windows devaudio volume control
@ 2019-06-19 15:12 Jacob Moody
0 siblings, 0 replies; only message in thread
From: Jacob Moody @ 2019-06-19 15:12 UTC (permalink / raw)
To: 9front
All,
I worked on a quick patch for drawterm devaudio-win32.c to allow for
setting the application volume.
diff -r 5c953ddd29fa kern/devaudio-win32.c
--- a/kern/devaudio-win32.c Sat Mar 09 20:51:48 2019 +0100
+++ b/kern/devaudio-win32.c Wed Jun 19 10:07:37 2019 -0500
@@ -52,19 +52,24 @@
void
audiodevsetvol(int what, int left, int right)
{
- USED(what);
- USED(left);
- USED(right);
- error("not supported");
+ DWORD v;
+
+ //Windows uses a 0-255 scale, plan9 uses 0-100
+ v = right*0xFF/100;
+ v = (v<<8)|left*0xFF/100;
+ if(waveOutSetVolume(waveout, v) != MMSYSERR_NOERROR)
+ oserror();
}
void
audiodevgetvol(int what, int *left, int *right)
{
- USED(what);
- USED(left);
- USED(right);
- error("not supported");
+ DWORD v;
+
+ if(waveOutGetVolume(waveout, &v) != MMSYSERR_NOERROR)
+ oserror();
+ *left = (v&0xFF)*100/0xFF;
+ *right = ((v>>8)&0xFF)*100/0xFF;
}
int
Thanks,
Moody
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-19 15:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-19 15:12 [drawterm] windows devaudio volume control Jacob Moody
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).