9front - general discussion about 9front
 help / color / mirror / Atom feed
* [drawterm] patch for bug in windows audio level set
@ 2019-09-24 19:19 Jacob Moody
  2019-09-24 19:44 ` [9front] " hiro
  0 siblings, 1 reply; 4+ messages in thread
From: Jacob Moody @ 2019-09-24 19:19 UTC (permalink / raw)
  To: 9front

All,

In my original patch for this DWORD is assumed to be 16 bits when it
is actually 32, this patch fixes that.

diff -r 6b68ed2b2324 kern/devaudio-win32.c
--- a/kern/devaudio-win32.c     Wed Jun 19 17:34:27 2019 +0200
+++ b/kern/devaudio-win32.c     Tue Sep 24 14:14:56 2019 -0500
@@ -54,9 +54,9 @@
 {
        DWORD v;

-       //Windows uses a 0-255 scale, plan9 uses 0-100
-       v = right*0xFF/100;
-       v = (v<<8)|left*0xFF/100;
+       //Windows uses a 0-0xFFFF scale, plan9 uses 0-100
+       v = right*0xFFFF/100;
+       v = (v<<16)|(left*0xFFFF/100);
        if(waveOutSetVolume(waveout, v) != MMSYSERR_NOERROR)
                oserror();
 }
@@ -68,8 +68,8 @@

        if(waveOutGetVolume(waveout, &v) != MMSYSERR_NOERROR)
                oserror();
-       *left = (v&0xFF)*100/0xFF;
-       *right = ((v>>8)&0xFF)*100/0xFF;
+       *left = (v&0xFFFF)*100/0xFFFF;
+       *right = ((v>>16)&0xFFFF)*100/0xFFFF;
 }

 int



sorry for the trouble,

Jacob Moody


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] [drawterm] patch for bug in windows audio level set
  2019-09-24 19:19 [drawterm] patch for bug in windows audio level set Jacob Moody
@ 2019-09-24 19:44 ` hiro
  2019-09-24 20:42   ` Jacob Moody
  0 siblings, 1 reply; 4+ messages in thread
From: hiro @ 2019-09-24 19:44 UTC (permalink / raw)
  To: 9front

hey, you or your mail program? messed up the whitespace...


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] [drawterm] patch for bug in windows audio level set
  2019-09-24 19:44 ` [9front] " hiro
@ 2019-09-24 20:42   ` Jacob Moody
  2019-09-24 21:02     ` hiro
  0 siblings, 1 reply; 4+ messages in thread
From: Jacob Moody @ 2019-09-24 20:42 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 224 bytes --]

Sorry,

I've included the diff as an attachment.

On Tue, Sep 24, 2019 at 2:44 PM hiro <23hiro@gmail.com> wrote:
>
> hey, you or your mail program? messed up the whitespace...



-- 
Jacob Moody
Computer Engineering Student

[-- Attachment #2: win32audiofix.diff --]
[-- Type: application/octet-stream, Size: 712 bytes --]

diff -r 6b68ed2b2324 kern/devaudio-win32.c
--- a/kern/devaudio-win32.c	Wed Jun 19 17:34:27 2019 +0200
+++ b/kern/devaudio-win32.c	Tue Sep 24 15:38:18 2019 -0500
@@ -54,9 +54,9 @@
 {
 	DWORD v;
 
-	//Windows uses a 0-255 scale, plan9 uses 0-100
-	v = right*0xFF/100;
-	v = (v<<8)|left*0xFF/100;
+	//Windows uses a 0-0xFFFF scale, plan9 uses 0-100
+	v = right*0xFFFF/100;
+	v = (v<<16)|(left*0xFFFF/100);
 	if(waveOutSetVolume(waveout, v) != MMSYSERR_NOERROR)
 		oserror();
 }
@@ -68,8 +68,8 @@
 
 	if(waveOutGetVolume(waveout, &v) != MMSYSERR_NOERROR)
 		oserror();
-	*left = (v&0xFF)*100/0xFF;
-	*right = ((v>>8)&0xFF)*100/0xFF;
+	*left = (v&0xFFFF)*100/0xFFFF;
+	*right = ((v>>16)&0xFFFF)*100/0xFFFF;
 }
 
 int

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] [drawterm] patch for bug in windows audio level set
  2019-09-24 20:42   ` Jacob Moody
@ 2019-09-24 21:02     ` hiro
  0 siblings, 0 replies; 4+ messages in thread
From: hiro @ 2019-09-24 21:02 UTC (permalink / raw)
  To: 9front

thanks a lot, applied

On 9/24/19, Jacob Moody <jsmoody@iastate.edu> wrote:
> Sorry,
>
> I've included the diff as an attachment.
>
> On Tue, Sep 24, 2019 at 2:44 PM hiro <23hiro@gmail.com> wrote:
>>
>> hey, you or your mail program? messed up the whitespace...
>
>
>
> --
> Jacob Moody
> Computer Engineering Student
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-24 21:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24 19:19 [drawterm] patch for bug in windows audio level set Jacob Moody
2019-09-24 19:44 ` [9front] " hiro
2019-09-24 20:42   ` Jacob Moody
2019-09-24 21:02     ` hiro

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).