VOGONS


First post, by Compact

User metadata
Rank Newbie
Rank
Newbie

Hello. I am new here. If I made my post in a wrong section, I'm sorry.

Is it possible to force the game to run at specific sample rate? I would like to make Star Wars Jedi Knight: Jedi Outcast run at 44khz sample rate when OpenAL is on. Game supports 44khz when running through software(dsound), but for some reason uses 22khz when using OpenAL.

I only managed to make the game resample 22khz to 44khz using cheat engine. I have no clue what I can do to make it run native 44khz.

Last edited by Compact on 2017-09-23, 10:27. Edited 1 time in total.

Reply 2 of 5, by leileilol

User metadata
Rank l33t++
Rank
l33t++

s_khz only applies to the standard software mixer in Q3 and has nothing to do with the OpenAL backend.

OpenAL generally runs at 48khz and if it doesn't sound like it's 48khz, then it's not working, and IIRC Jk2/JA was very picky on what sound cards were allowed to use the OpenAL backend depending on supported EAX extensions

apsosig.png
long live PCem

Reply 3 of 5, by Compact

User metadata
Rank Newbie
Rank
Newbie
aqrit wrote:

what did you alter with Cheat Engine? the "s_khz" cvar?

edit [2]
https://github.com/JACoders/OpenJK/blob/a09d4 … nd_dma.cpp#L491

Sorry for late response. In cheat engine, what I did was searched for 44100 value and in-game I was switching s_useOpenAL from 1 to 0 and vice versa. Then through monitoring the changes in cheat engine I found memory address 00E5b774. Forcing its value to be 44100 made the game run at 44khz but it was clearly resampled, because audio was either distorted or accelerated.

Yesterday I took it a bit further - I tried debugging and searched for this address. I have basically 0 clue how to program or reverse engineer, but I tried it for fun. I managed to somehow get some of the game to output 44khz(or at least audio wasn't distorted or accelerated..) through modifying this address value(00E5b774) to 44100 and modifying all OpenAl32.AlSourceGetBuffers functions to push 44100 value instead of 22050. Music was still distorted, but menu button clicking audio were playing properly.

All this was for nothing anyway, because after I load a savegame, game freezes.

s_khz only applies to the standard software mixer in Q3 and has nothing to do with the OpenAL backend.

OpenAL generally runs at 48khz and if it doesn't sound like it's 48khz, then it's not working, and IIRC Jk2/JA was very picky on what sound cards were allowed to use the OpenAL backend depending on supported EAX extensions

I have creative X-fi Fatal1ty card (I got it as a gift) and OpenAL seems to work. I have 3D audio, though reverb is really lacking(I had to boost EAX effects by like 6dB for it to be even audible) and refraction seems to not be there. It's supposed to be heard at the start of the 2nd level(artus mine) but it's clearly not there. So it's probably running EAX 2.0

Well, all seems to be mostly fine, so what's wrong?
I use audio mods, which basically are all 44khz. 3D audio doesn't work for these files. Yea, I can maybe try to change these audio files to 22khz, but I would for now prefer to make game run at 44khz native.

Reply 4 of 5, by aqrit

User metadata
Rank Member
Rank
Member

memory address 00E5b774

did you poke the memory, or patch it where the original value was set?
Use Cheat Engine's debugger to "Find out what writes to this address""
and patch it where it's set so it is ready during initialization.

it is hopefully dma.speed:
snd_dma.cpp#L491

OpenAl32.AlSourceGetBuffers functions

a wrapper around "alBufferData" ?

follow it back to the call sites in the client code, and patch there.

there should be seven instances:
snd_mem.cpp#L843
snd_mem.cpp#L913
snd_dma.cpp#L2727
snd_dma.cpp#L2953
snd_dma.cpp#L2966
snd_dma.cpp#L3252
snd_dma.cpp#L3257

game freezes

potential issue with LipSync tables maybe?

---
I don't have the game, and I'm too lazy to look into this.
You're on your own, sorry.

Reply 5 of 5, by Compact

User metadata
Rank Newbie
Rank
Newbie
aqrit wrote:
did you poke the memory, or patch it where the original value was set? Use Cheat Engine's debugger to "Find out what writes to […]
Show full quote

memory address 00E5b774

did you poke the memory, or patch it where the original value was set?
Use Cheat Engine's debugger to "Find out what writes to this address""
and patch it where it's set so it is ready during initialization.

it is hopefully dma.speed:
snd_dma.cpp#L491

OpenAl32.AlSourceGetBuffers functions

a wrapper around "alBufferData" ?

follow it back to the call sites in the client code, and patch there.

there should be seven instances:
snd_mem.cpp#L843
snd_mem.cpp#L913
snd_dma.cpp#L2727
snd_dma.cpp#L2953
snd_dma.cpp#L2966
snd_dma.cpp#L3252
snd_dma.cpp#L3257

game freezes

potential issue with LipSync tables maybe?

---
I don't have the game, and I'm too lazy to look into this.
You're on your own, sorry.

Thank you for your answer. I will attempt to school myself and I will follow your advice.