96000HZ audio impliementation code submission.
Moderator: ZSNES Mods
96000HZ audio impliementation code submission.
Well I actually didn't think I could do it but I did it. Well, the sound is really messed up but it does work a little bit although I probably need to adjust the buffer rate a bit more. I'll keep pluggin away at it though.
================================================
line 504 of cfgload.c
- WRITE_LINE("; 6 = 48,000 Hz\r\n\r\n");
+WRITE_LINE("; 6 = 48,000 Hz, 7 = 96,000 Hz\r\n\r\n");
line 818 of winlink.cpp
+ case 7:
+ wfx.nSamplesPerSec = 96000;
+ SoundBufferSize=1024*12;
+ break;
line 951 of winlink.cpp
+ case 7:
+ wfx.nSamplesPerSec = 96000;
+ SoundBufferSize=1024*12;
+ break;
line 1833 of guiwindp.inc
+GUISoundTextB8 db '96000HZ',0
line 1412 of guikeys.inc
- .sampratenext db 1,4,5,6,2,3,0,0,0,0
+.sampratenext db 1,4,5,6,2,3,7,0,0,0
line 2578 of guimouse.inc
- sampratenext db 1,4,5,6,2,3,0,0,0,0
+sampratenext db 1,4,5,6,2,3,7,0,0,0
================================================
Well Nach here's 50 dollars worth of coding dude. JK:P... I'll try and contribute something to the ZSnes project when I get a chance. Money's been tight since I recently got a new job but I'll do anything I can that will help even if only miniscule.
================================================
line 504 of cfgload.c
- WRITE_LINE("; 6 = 48,000 Hz\r\n\r\n");
+WRITE_LINE("; 6 = 48,000 Hz, 7 = 96,000 Hz\r\n\r\n");
line 818 of winlink.cpp
+ case 7:
+ wfx.nSamplesPerSec = 96000;
+ SoundBufferSize=1024*12;
+ break;
line 951 of winlink.cpp
+ case 7:
+ wfx.nSamplesPerSec = 96000;
+ SoundBufferSize=1024*12;
+ break;
line 1833 of guiwindp.inc
+GUISoundTextB8 db '96000HZ',0
line 1412 of guikeys.inc
- .sampratenext db 1,4,5,6,2,3,0,0,0,0
+.sampratenext db 1,4,5,6,2,3,7,0,0,0
line 2578 of guimouse.inc
- sampratenext db 1,4,5,6,2,3,0,0,0,0
+sampratenext db 1,4,5,6,2,3,7,0,0,0
================================================
Well Nach here's 50 dollars worth of coding dude. JK:P... I'll try and contribute something to the ZSnes project when I get a chance. Money's been tight since I recently got a new job but I'll do anything I can that will help even if only miniscule.
Last edited by Bahamut_ZERO_Clue on Thu Feb 23, 2006 4:52 am, edited 1 time in total.
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
Well, it from the edit it sounds aweful but it does prove it can be done with some minor adjustments to the output buffer.
Edit:
I did some reasearch into the problem and I THINK it's somehow connected to the MinGW DirectSound code which is still DX8 and AFAIK DX8 never had any support for 24bit/96khz audio chipsets and cards or impliementations on that part but I'll keep reasearching. I'll get this right or... any help or assistance would be nice.
Edit:
I did some reasearch into the problem and I THINK it's somehow connected to the MinGW DirectSound code which is still DX8 and AFAIK DX8 never had any support for 24bit/96khz audio chipsets and cards or impliementations on that part but I'll keep reasearching. I'll get this right or... any help or assistance would be nice.
-
- Trooper
- Posts: 535
- Joined: Wed Jul 28, 2004 3:26 am
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
I don't really think that's the case...Bahamut_ZERO_939 wrote:Well, it from the edit it sounds aweful but it does prove it can be done with some minor adjustments to the output buffer.
Edit:
I did some reasearch into the problem and I THINK it's somehow connected to the MinGW DirectSound code which is still DX8 and AFAIK DX8 never had any support for 24bit/96khz audio chipsets and cards or impliementations on that part but I'll keep reasearching. I'll get this right or... any help or assistance would be nice.
Some stuff I found with Google...
http://support.microsoft.com/?id=316638
http://support.microsoft.com/kb/308883/EN-US/
http://kxproject.lugosoft.com/tech.php?language=en
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
Mmm... it's been fixed... but if you didn't understand the context of the fixes, they explain in their descriptions that 24-bit audio is allowable for DirectSound...Bahamut_ZERO_939 wrote:So basically until this can be fixed within Windows you'd have to downmix the 96khz to something like 48khz or less... or get the hotfix.
Strangely enough, I don't know why we're never able to manually adjust the audio bitrate (I think that's the correct term)... hmm..
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
uint32 sample_24 = uint16(sample_16) << 8;Yeah and it looks like ZSnes is using a bitrate of 16 currently as read from lines...
Or if you really want to go all out here:
sample_24 = (sample_16 << 8) | (sample_16 >> 8);
Can't you at least just use 96khz with 16-bit samples? You're basically just making up data that isn't there. At all.
-
- ZSNES Shake Shake Prinny
- Posts: 5632
- Joined: Wed Jul 28, 2004 4:15 pm
- Location: PAL50, dood !
Great coding there, Bahamut.
皆黙って俺について来い!!
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Code: Select all
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
-
- Lurker
- Posts: 165
- Joined: Wed Jul 28, 2004 3:15 am
- Location: The Land of Insanity
- Contact:
Agreed. Maybe this should be put in ZSNES anyway, as an easter egg or somethingcreaothceann wrote:Awful, but somehow funny...
(j/k)
It is better to be silent and thought a fool then to open your mouth and remove all doubt
I am Zophar, Master of Sh*t!
[url=http://archlyn.bravejournal.com]View my blog[/url]
I am Zophar, Master of Sh*t!
[url=http://archlyn.bravejournal.com]View my blog[/url]
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
-
- Lurker
- Posts: 110
- Joined: Sat Sep 04, 2004 7:55 pm
- Location: USA
Um, what exactly is the problem with this code? If it generates 24-bit samples, it should be modified to generate 16-bit samples. (Sorry if I'm not reading the code carefully enough. DirectSound *does* support 96kHz x 16bits, right?) Since 96kHz is exactly 3 times 32kHz, it should theoretically be possible to get very clean sound with proper buffering. I know I'm not taking enough time to understand the issue, but what exactly is holding this code back from production?
This signature intentionally contains no text other than this sentence.
-
- Trooper
- Posts: 535
- Joined: Wed Jul 28, 2004 3:26 am
Did you listen to pagefault's recorded output with his code? It doesn't work.-_pentium5.1_- wrote:Um, what exactly is the problem with this code? If it generates 24-bit samples, it should be modified to generate 16-bit samples. (Sorry if I'm not reading the code carefully enough. DirectSound *does* support 96kHz x 16bits, right?) Since 96kHz is exactly 3 times 32kHz, it should theoretically be possible to get very clean sound with proper buffering. I know I'm not taking enough time to understand the issue, but what exactly is holding this code back from production?
AFAIK DirectSound can only produce up to 48000hz with 16bit samples, I'm still researching and I haven't had too much time to work on this. I have some time this week do do some more coing so I'll get back to work and see what I can figure out.
BTW I know it sounds like a cat getting rubbed by a cheese graiter (aka awful as hell). 24bit sampling is needed for anything over (again) 48khz AFAIK.
BTW I know it sounds like a cat getting rubbed by a cheese graiter (aka awful as hell). 24bit sampling is needed for anything over (again) 48khz AFAIK.
No.Bahamut_ZERO_939 wrote:AFAIK DirectSound can only produce up to 48000hz with 16bit samples
No again.BTW I know it sounds like a cat getting rubbed by a cheese graiter (aka awful as hell). 24bit sampling is needed for anything over (again) 48khz AFAIK.
You missed all the lovely tables in cpu/dspproc.asm. BufferSize, BufferSizes, SoundSpeeds, SBToSPCSpeeds, NumofSPCBlock... No, wait, I'm making this too easy for you.
For a start, maybe you should make the effort to test this crap on your own system before submitting patches. Not like you'll notice over all the placebo.