Commit Graph

4288 Commits

Author SHA1 Message Date
RadWolfie 990b87198e Replace NULL to nullptr since it is pointer... 2018-04-29 12:40:44 -05:00
RadWolfie 3c723d2763 Various bug fixes
* no reason to re-set value twice from SetBufferData
* passdown the length, not offset
* use counter instead of count
* if size is the same replace "out of memory" to "ok" result, and ignore
DSP image function.

This is the corrections, however doesn't cover every faults few titles
has atm.
2018-04-29 12:40:44 -05:00
RadWolfie 7fb1451fee Add SwitchToThread inside loop when buffer playing 2018-04-29 12:40:43 -05:00
RadWolfie 18c6948153 Fix SetBufferData biggest issue of all
!Major breakthrough!

Titles improved:
* The Simpsons: Road Rage (now has music and voiceover audible)
* Ghost Recon: Thunder Island (No longer output distort noises ingame.
100% sure the rest of sequels will work correctly.)
2018-04-29 12:40:43 -05:00
RadWolfie 3590aa0f19 Another small update
* Only perform a buffer resize. Allow play function to make buffer
update only.
* Removed unused parameters.
2018-04-29 12:40:43 -05:00
RadWolfie 17ca484370 Small updates 2018-04-29 12:40:43 -05:00
RadWolfie 73ebd2f893 Also fix DS Buffer GetStatus function too.
PAUSED (xbox) and BUFFERLOST (host) are using same value. We're only
enforcing 3 flags for xbox.
2018-04-29 12:40:43 -05:00
RadWolfie 5e48c63046 Replace unimplemented to ignored for HRTF functions 2018-04-29 12:40:43 -05:00
RadWolfie be6fab6b7e Add audio debug mute control
For pinpoint which audio is causing problem then troubleshoot from
there.
2018-04-29 12:40:43 -05:00
RadWolfie f16423a17e Update copyright year 2018-04-29 12:40:43 -05:00
RadWolfie 8b9570e5ee Remove unused function 2018-04-29 12:40:43 -05:00
RadWolfie 0f48c04b31 Fix possible Pocketbike Racer audio skipping bug
At least should resolve the bug, need tester to test it one more time to
verify the bug is gone for good.
2018-04-29 12:40:43 -05:00
RadWolfie ebe552f62c Add another minor note 2018-04-29 12:40:43 -05:00
RadWolfie d93990264f Add test case log for DS Stream Process function 2018-04-29 12:40:43 -05:00
RadWolfie 8ac0bb1371 Last fixup for mixbin
There are other identifiers of mixbin, except we're not focusing on
them.
2018-04-29 12:40:43 -05:00
RadWolfie 7627267c15 Preserve and correct some volume stuff
We don't want volume to constant increase over time. 😉
2018-04-29 12:40:43 -05:00
RadWolfie e5bd691615 Another fixup for XDSMIXBIN flags 2018-04-29 12:40:43 -05:00
RadWolfie edd526ff2f Add some support for SetMixBinVolumes_8
Plus include pre-set volume for if one of audio codec is disabled to
both Buffer and Stream class creations.
2018-04-29 12:40:43 -05:00
RadWolfie db2c8017d2 Move note to above function 2018-04-29 12:40:43 -05:00
RadWolfie d14ab3b0e6 Fix note for SetMixBinVolumes patch 2018-04-29 12:40:43 -05:00
RadWolfie 4a115afc26 Remove debug messages
No longer is necessary.
2018-04-29 12:40:43 -05:00
RadWolfie 11222a8538 Another minor fixup for Flush function
Plus ensure flags are reset inside Discontinuity function.
2018-04-29 12:40:43 -05:00
RadWolfie e7d38340ec Minor fix for hybrid pause function 2018-04-29 12:40:43 -05:00
RadWolfie 30e36f36de Revert PAUSENOACTIVATE since it broke audio for RF2
Originally, it might be correct in the first place. It may has to do
with given parameter of buffer class to be output.
2018-04-29 12:40:42 -05:00
RadWolfie 55661cd3d2 Include rtTimeStamp parameter support
This commit covers:
* FlushEx (DSound Stream only)
* PauseEx (DSound Buffer & Stream)

DSoundStream class should no longer cause audio problems this time for
any titles except for mixbin stuff.
2018-04-29 12:40:42 -05:00
RadWolfie 5bd4faba8e Fix DSound Stream's SetFormat
TODO: might need callback and context passdown as well?
2018-04-29 12:40:42 -05:00
RadWolfie 03d2f50d93 Buffer also has PauseEx, add member for it 2018-04-29 12:40:42 -05:00
RadWolfie be82e8ef4a Replace DSB_FLAG_XXXX to DSE_FLAG_XXXX
Doesn't make sense to use DSB since we are using emulated flag to
trigger events of what xbox would do.
2018-04-29 12:40:42 -05:00
RadWolfie 12b4a12f2e Stub support to have Flush process data too.
Need to implement ASYNC support via separate thread worker. <-- is a
requirement.

Confirmed Flush will perform busy-state until audio is stop.
2018-04-29 12:40:42 -05:00
RadWolfie 156ea1d73a Fix GetStatus since both Buffer and Stream are diff
Stream class has its own flags which is 100% different than Buffer
class.

However, it needs more implement support for Flush(Ex) in order to
prevent titles to loop base on Stream class' status output.

Coming Soon™
2018-04-29 12:40:42 -05:00
RadWolfie c6635f5261 Fix GeneratePCMFormat for 2+ channels mask
Confirmed my theory on 4 channels given with attempted 6 channel masks
cause invalid arg on DirectSound buffer creation.

Affected title:
* Ghost Recon 2 (Only happen after 3 or 4 FMVs)
2018-04-29 12:40:42 -05:00
RadWolfie 98daf26e40 Don't trigger/set values during release process
Untested, yet in theory is correct.
2018-04-29 12:40:42 -05:00
RadWolfie cc781826c3 Fix audio buffer allocation
Use prediction if do have enough buffer purpose before allow allocate.
This fixed Mafia title for loading "running man" mission.

Plus add log info for SetEvent failure.
2018-04-29 12:40:42 -05:00
RadWolfie d8246a0074 Remove SelectionT from DSound
Since region has been merged into one buffer usage. SelectionT no longer
a requirement to toggle between main and region buffers.
2018-04-29 12:40:42 -05:00
RadWolfie c5de8c2174 Introduce emulation of xbox audio managed memory
At least emulate xbox audio buffer limitation accurately.

TODO: Need to find max values for Free2DBuffers and Free3DBuffers from
GetCaps function. Then emulating HLE will become more accurate.

Improved title:
* Burnout (Both menu and in-game are now audible.)

Other titles does not appear affected by this change for now.
2018-04-29 12:40:42 -05:00
RadWolfie 20cf54aba1 Redo swap since it got revert somehow. 2018-04-29 12:40:42 -05:00
RadWolfie f6c1992865 Fix GetCaps host's var to initialize correctly
Verified with Burnout title, no longer output failure.
2018-04-29 12:40:42 -05:00
RadWolfie 6611340c51 Little improvement
Might not be 100% accurate, however it had been called in these area
base on RE.
2018-04-29 12:40:42 -05:00
RadWolfie 9a8c7031b2 Add notes 2018-04-29 12:40:42 -05:00
RadWolfie f7f11b9b88 Fixed DSound Stream class
EmuFlags was not set to 0 and GeneratePCMFormat function must be called
after DSoundBufferSetDefault.

Fixed title:
* Battlestar Galactica

Pretty sure it will fix other titles' crashes.
2018-04-29 12:40:42 -05:00
RadWolfie 21a6042e7f Adjustment to PatrickvL's code 2018-04-29 12:40:42 -05:00
RadWolfie 753917509b Fix alloc size for lpwfxFormat
WAVE_FORMAT_PCM always ignore cbSize, we need to manually set to 0 in
order to prevent any crash later on.
2018-04-29 12:40:42 -05:00
RadWolfie b77ecf35e3 Swap Flush/Discontinuity
What to do with Flush's function?

Also, really need to reset internal states in Discontinuity function? As
in like what?
2018-04-29 12:40:42 -05:00
RadWolfie 87beb542f5 Add a note 2018-04-29 12:40:41 -05:00
RadWolfie f830b1e150 Update region changes
Is not 100% verified, however JSRF skating, jump, etc has return to
normal volume.
2018-04-29 12:40:41 -05:00
RadWolfie 32ff268837 Add notes 2018-04-29 12:40:41 -05:00
RadWolfie d6ee5fc4ed Fixup StopEx function
Still not 100% sure if is accurate or not, just closer to accurate.
2018-04-29 12:40:41 -05:00
RadWolfie bdc3fa4fd6 Emulate audio region a bit better 2018-04-29 12:40:41 -05:00
RadWolfie 1fde463e1e Combo changes
* instead of calling malloc everytime, let's merge into class instead.
* Check size at play function (temporary, need to apply overall)
* Minimize duplicate code into simplier reuse inline functions.
* What else?

TODO: Need to update StopEx function.
2018-04-29 12:40:41 -05:00
RadWolfie 2343843098 Enable debug trace 2018-04-29 12:40:41 -05:00