Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Custom MP3 or OGG playback from music folder despite added dll files and correct naming #49

Open
blam666 opened this issue Dec 14, 2024 · 17 comments

Comments

@blam666
Copy link

blam666 commented Dec 14, 2024

I wanted to add high bitrate (320) MP3 of my German game CD audio to use with TR2main v0.9.0.

I was following the instructions for using different audio made in this thread:

https://www.tombraiderforums.com/showthread.php?t=225217.

So I deleted the audio folder, created a folder "music" inside my tr2main folder and added the ripped MP3 files named 02.mp3, 03.mp3... 60.mp3. Additionally, I put the dll files from the TRII music fix for mp3 inside the root directory (winmm.dll and fmodex.dll).

But there is no background music (or voice audio) playing at all.
I also tried using oggs named track02, track03... track60 and added the according dll files from the Music Fix for ogg files, but that didn't work either, Tr2main simply ignores the tracks in the music folder.

Does this method to make Tr2main use different audio tracks fail to work with the new 0.9.0 version of TR2main?

@noisecode3
Copy link

Have you tried this one? https://github.com/ayuanx/ogg-winmm it was working really good with wine. As long as the track numbers are not mix up it should work right?

@blam666
Copy link
Author

blam666 commented Dec 15, 2024

@noisecode3:

Hello and thanks a lot for your tip!

Unfortunately, I just tested it and using the winmm wrapper from ayuanx doesn't work either. I have the proper ogg files named track02.ogg ... track60.ogg in a folder "music" and the ayuanx winmm.dll in the root folder but everything stays cd audio - free.

I also tried yet another ogg-winmm fork that usually works on my system and that also didn't do the trick. No Lara voice, no background music.

@blam666
Copy link
Author

blam666 commented Dec 15, 2024

The only way at the moment to make ripped cd audio work for me is the default method of having an "audio" folder and the cd content inside of that in a single file cdaudio.mp3 alongside the additional cdaudio.dat.

There is one version of the German CD audio dub floating around:

https://steamcommunity.com/sharedfiles/filedetails/?id=377249769

which also works fine on my system at the moment.

But the bitrate could be a bit higher for my taste (it's only 128). And ripping my original CD audio to a single mp3 file of higher bitrate, renaming it to cdaudio.mp3 and exchanging it with the mp3 from that download does sort of work, but the cdaudio.dat has quite different timecodes that don't fit my rip (the downloaded version starts with 5 second of silence while my mp3 file starts the audio immeditately on that single track, for instance).

So I do hear the sounds from my own rip with the "audio" folder and the cdaudio.mp3/cdaudio.dat method, but they are all messed up (Lara voiceout start at the wrong point in the track and stop within the next audio track from the soundtrack and so on).

Now I think it would work if I would edit the cdaudio.dat file according to my different OST track rip, but it looks like I would have to find out and manually edit the proper miliseconds for each single one of the 60 tracks.

This seems a bit overcomplicated to me. If anyone knows how to make a single file rip that automatizes the creation of the cdaudio.dat file and which program to use to rip CD Audio in that way, I would be very glad to hear that.

@noisecode3
Copy link

Yes look at how he/she hacked it
https://www.trle.net/sc/levelfeatures.php?lid=3621
he/she is using the same TR2Main.dll and Tomb2.exe from there you should be able to use
audio tracks from dll's like ogg-winmm it worked on wine should work on windows :)

@blam666
Copy link
Author

blam666 commented Dec 15, 2024

Thanks a lot for the link!

Hmm, I downloaded the custom level from the site you linked and took all of the dll files and the Tomb2.exe and her music folder (which contains wma files) and injected it into my TR2main directory.

But there is still no music in the main menu or lara voice sounds in the training level.

Even if I just extract his/her custom level freshly and seperately into a different new folder, I'm able to start and play her Hidden Dagger II custom level, but there is no background music to be heard in his/her menu either. It seems he/she exchanged the 60 OG tracks through some other tracks - but it doesn't matter, shouldn't I hear some music in that menu, too?. But it's silent on my system.

EDIT: Yes, there should be music in the very first scene of that custom level at least. I found this walkthrough on youtuibe
https://www.youtube.com/watch?v=Dz8HxH6D9BE

But there is no music/voiceout on my system in that very first scene. My system doesn't seem to like the dll and wrappers involved. But that's weird, as I'm using ogg-winmm in this fork and different forks for other games and it usually works...

@noisecode3
Copy link

You're not using windows 10?
if you run from the shell will it output an error about device not found or something do you you need to select sound card again in the setup?
Do you use the steam version of the game?

@blam666
Copy link
Author

blam666 commented Dec 15, 2024

I'm on Win 10 64. Sound in setup is usual "primary device". I reselected it in setup anew, but no change. Usual game sounds work, too. It's just the digitized OST which doesn't work with the winmm and the material from the "music" folder
I use gog version of TR2.

As I wrote, I get sound and also bg music and voice over cdaudio.mp3 and cdaudio.dat in "audio" folder in my Tr2main folder. Getting the cdaudio.mp3 in German and high bitrate is all I'm looking for at the moment. So I wouldn't even care if alternative custom tracks wouldn't work right now But then I would have to know how to rip my original cd and create a new cdaudio.dat for that...

"Run from the shell" I don't understand. How would I do that?

@noisecode3
Copy link

but there is dsound and winmm, I think you have a problem with just winmm

The Import Tables (interpreted .idata section contents)
 vma:            Hint    Time      Forward  DLL       First
                 Table   Stamp     Chain    Name      Thunk
 00128000	0012810c 00000000 00000000 0012869a 001283e0

	DLL Name: DINPUT.dll
	vma:     Ordinal  Hint  Member-Name  Bound-To
	001283e0  <none>  0000  DirectInputCreateA

 00128014	00128114 00000000 00000000 001286d2 001283e8

	DLL Name: DSOUND.dll
	vma:     Ordinal  Hint  Member-Name  Bound-To
	001283e8  <none>  0003  DirectSoundCreate
	001283ec  <none>  0004  DirectSoundEnumerateA

 00128028	00128100 00000000 00000000 0012870a 001283d4

	DLL Name: DDRAW.dll
	vma:     Ordinal  Hint  Member-Name  Bound-To
	001283d4  <none>  0005  DirectDrawCreate
	001283d8  <none>  0007  DirectDrawEnumerateA

 0012803c	00128324 00000000 00000000 00128786 001285f8

	DLL Name: WINMM.dll
	vma:     Ordinal  Hint  Member-Name  Bound-To
	001285f8  <none>  0097  timeGetTime
	001285fc  <none>  0014  auxGetNumDevs
	00128600  <none>  0012  auxGetDevCapsA
	00128604  <none>  0017  auxSetVolume
	00128608  <none>  0032  mciSendCommandA
	0012860c  <none>  001e  joyGetPosEx
	00128610  <none>  001a  joyGetDevCapsA

 00128050	00128254 00000000 00000000 00128abc 00128528

	DLL Name: USER32.dll
	vma:     Ordinal  Hint  Member-Name  Bound-To
	00128528  <none>  0264  wsprintfA
	0012852c  <none>  0002  AdjustWindowRectEx
	00128530  <none>  013a  GetWindowLongA
	00128534  <none>  00cd  FindWindowA
	00128538  <none>  0090  DispatchMessageA
	0012853c  <none>  0245  TranslateMessage
	00128540  <none>  01af  PeekMessageA
	00128544  <none>  025d  WaitMessage
	00128548  <none>  0251  UpdateWindow
	0012854c  <none>  022d  ShowWindow
	00128550  <none>  021e  SetWindowPos
	00128554  <none>  013f  GetWindowTextA
	00128558  <none>  00a0  DrawEdge
	0012855c  <none>  019d  MoveWindow
	00128560  <none>  01be  RegisterClassA
	00128564  <none>  00b4  EndDialog
	00128568  <none>  008e  DialogBoxParamA
	0012856c  <none>  0183  LoadStringA
	00128570  <none>  0234  SystemParametersInfoA
	00128574  <none>  002f  CheckDlgButton
	00128578  <none>  00b2  EnableWindow
	0012857c  <none>  00f3  GetDlgItem
	00128580  <none>  01da  SendMessageA
	00128584  <none>  011d  GetParent
	00128588  <none>  0178  LoadImageA
	0012858c  <none>  0012  CallWindowProcA
	00128590  <none>  021b  SetWindowLongA
	00128594  <none>  01f2  SetDlgItemTextA
	00128598  <none>  0195  MessageBoxA
	0012859c  <none>  01f6  SetForegroundWindow
	001285a0  <none>  0229  ShowCursor
	001285a4  <none>  0167  IsWindow
	001285a8  <none>  01b1  PostMessageA
	001285ac  <none>  024d  UnregisterClassA
	001285b0  <none>  0055  CreateWindowExA
	001285b4  <none>  00ee  GetDC
	001285b8  <none>  01cd  ReleaseDC
	001285bc  <none>  00d7  GetAsyncKeyState
	001285c0  <none>  0080  DefWindowProcA
	001285c4  <none>  01b3  PostQuitMessage
	001285c8  <none>  0009  BeginPaint
	001285cc  <none>  00cc  FillRect
	001285d0  <none>  00b6  EndPaint
	001285d4  <none>  01ec  SetCursor
	001285d8  <none>  0152  InvalidateRect
	001285dc  <none>  0176  LoadIconA
	001285e0  <none>  0172  LoadCursorA
	001285e4  <none>  01bf  RegisterClassExA
	001285e8  <none>  00e4  GetClientRect
	001285ec  <none>  0190  MapWindowPoints
	001285f0  <none>  013d  GetWindowRect

 00128064	001280f4 00000000 00000000 00128ada 001283c8

	DLL Name: COMCTL32.dll
	vma:     Ordinal  Hint  Member-Name  Bound-To
	001283c8     17  <none> <none>
	001283cc  <none>  003b  PropertySheetA

 00128078	001280dc 00000000 00000000 00128b40 001283b0

	DLL Name: ADVAPI32.dll
	vma:     Ordinal  Hint  Member-Name  Bound-To
	001283b0  <none>  011b  RegCreateKeyExA
	001283b4  <none>  0117  RegCloseKey
	001283b8  <none>  0141  RegSetValueExA
	001283bc  <none>  0120  RegDeleteValueA
	001283c0  <none>  0136  RegQueryValueExA

 0012808c	00128120 00000000 00000000 00128be2 001283f4

	DLL Name: GDI32.dll
	vma:     Ordinal  Hint  Member-Name  Bound-To
	001283f4  <none>  014b  SelectPalette
	001283f8  <none>  00fa  GetStockObject
	001283fc  <none>  0035  CreatePalette
	00128400  <none>  0187  UnrealizeObject
	00128404  <none>  00fc  GetSystemPaletteEntries
	00128408  <none>  0046  DeleteObject
	0012840c  <none>  0137  RealizePalette
	00128410  <none>  0158  SetDIBitsToDevice

 001280a0	00128344 00000000 00000000 00128e4a 00128618

	DLL Name: TR2Main.dll
	vma:     Ordinal  Hint  Member-Name  Bound-To
	00128618  <none>  0000  DummyFunction

 001280b4	00128144 00000000 00000000 001292e8 00128418

	DLL Name: KERNEL32.dll
	vma:     Ordinal  Hint  Member-Name  Bound-To
	00128418  <none>  0229  SetStdHandle
	0012841c  <none>  0190  LoadLibraryA
	00128420  <none>  0172  HeapSize
	00128424  <none>  0171  HeapReAlloc
	00128428  <none>  0236  SetUnhandledExceptionFilter
	0012842c  <none>  0116  GetProcAddress
	00128430  <none>  014c  GetVersion
	00128434  <none>  00aa  GetCommandLineA
	00128438  <none>  0128  GetStartupInfoA
	0012843c  <none>  00fe  GetModuleHandleA
	00128440  <none>  0168  HeapAlloc
	00128444  <none>  016e  HeapFree
	00128448  <none>  00d3  GetCurrentProcess
	0012844c  <none>  0246  TerminateProcess
	00128450  <none>  006b  ExitProcess
	00128454  <none>  00f5  GetLocalTime
	00128458  <none>  0135  GetSystemTime
	0012845c  <none>  0148  GetTimeZoneInformation
	00128460  <none>  01e5  RtlUnwind
	00128464  <none>  01c9  RaiseException
	00128468  <none>  0089  FindResourceA
	0012846c  <none>  0195  LoadResource
	00128470  <none>  01a3  LockResource
	00128474  <none>  01c6  QueryPerformanceFrequency
	00128478  <none>  01c5  QueryPerformanceCounter
	0012847c  <none>  027b  WriteFile
	00128480  <none>  00ed  GetFileSize
	00128484  <none>  00fa  GetLogicalDrives
	00128488  <none>  00df  GetDriveTypeA
	0012848c  <none>  0031  CreateFileA
	00128490  <none>  0018  CloseHandle
	00128494  <none>  029b  lstrcpyA
	00128498  <none>  0219  SetFilePointer
	0012849c  <none>  0155  GlobalAlloc
	001284a0  <none>  015c  GlobalFree
	001284a4  <none>  01d6  ReadFile
	001284a8  <none>  00f4  GetLastError
	001284ac  <none>  012a  GetStdHandle
	001284b0  <none>  00fc  GetModuleFileNameA
	001284b4  <none>  016c  HeapDestroy
	001284b8  <none>  016a  HeapCreate
	001284bc  <none>  025e  VirtualFree
	001284c0  <none>  025b  VirtualAlloc
	001284c4  <none>  0250  UnhandledExceptionFilter
	001284c8  <none>  001f  CompareStringW
	001284cc  <none>  0096  FreeEnvironmentStringsA
	001284d0  <none>  01ab  MultiByteToWideChar
	001284d4  <none>  0097  FreeEnvironmentStringsW
	001284d8  <none>  00e1  GetEnvironmentStrings
	001284dc  <none>  00e3  GetEnvironmentStringsW
	001284e0  <none>  026e  WideCharToMultiByte
	001284e4  <none>  001e  CompareStringA
	001284e8  <none>  0210  SetEndOfFile
	001284ec  <none>  018e  LCMapStringW
	001284f0  <none>  018d  LCMapStringA
	001284f4  <none>  012e  GetStringTypeW
	001284f8  <none>  012b  GetStringTypeA
	001284fc  <none>  008e  FlushFileBuffers
	00128500  <none>  009d  GetACP
	00128504  <none>  00a3  GetCPInfo
	00128508  <none>  0180  IsBadCodePtr
	0012850c  <none>  0186  IsBadWritePtr
	00128510  <none>  0211  SetEnvironmentVariableA
	00128514  <none>  0183  IsBadReadPtr
	00128518  <none>  00ef  GetFileType
	0012851c  <none>  021b  SetHandleCount
	00128520  <none>  0109  GetOEMCP

Open Command Prompt:

Press the Start button (or click the Windows icon in the bottom-left corner of the screen).
Type cmd and press Enter to open the Command Prompt.

Change to the directory where Tomb2.exe is located:

Use the cd command to navigate to the folder containing Tomb2.exe.
For example, if Tomb2.exe is in C:\Games\TombRaider, type:

cd C:\Games\TombRaider

Then press Enter.

Run Tomb2.exe:

Once you're in the correct directory, type:

Tomb2.exe

Then press Enter to run the program.

Check for error messages:

Any errors or messages generated by the program will appear in the Command Prompt window.

@blam666
Copy link
Author

blam666 commented Dec 15, 2024

Ok, I get it now.

So i reinserted the ayuanx winmm.dll, deleted the audio folder and reinserted a music folder containing 256 bitrate ogg files called track02.ogg.. track60.ogg.

And then started from shell/command prompt.

But there is nothing interesting to be found in the command window. The game starts all right and still refuses to play any background music from the "music" folder. After i quit again, there is no error message. I attached a screenshot of the process:

tr2shell

@blam666
Copy link
Author

blam666 commented Dec 15, 2024

You mentioned dsound. I don't think this has anything to do with TR2main and its refusal to play sound from the ogg files in the music folder on my system. But I'll just mention it just in case:

My Win10 system is modded slightly for using dsoal for 3dsound and EAX restore. To make that work, I had to change my Windows registry a bit.

There are four entries like this:

HKEY_LOCAL_MACHINE\Software\Classes\CLSID{47D4D946-62E8-11CF-93BC-444553540000}\InprocServer32

which are changed to have only dsound.dll as value. Before it was %SystemRoot%\System32\dsound.dll

But as I wrote, I don't think this has anything to do with the problem I described here.

@noisecode3
Copy link

Dsound dont have anything to do with that. You can try WinDbgX and try to run with it. Then type lm and enter . Maybe with notpad is easier. Hail Satan!

@blam666
Copy link
Author

blam666 commented Dec 16, 2024

Just came back home and tested TR2main on my alternative desktop system. Copy/Pasted my Tr2Main folder from my notebook to this other system of mine and everything works out of the box there with personally ripped hq ogg files from "music" folder and the ayuanx ogg-winmm wrapper. The fanmod level Hidden Dagger II also works there with its dll files and the music/voice out in the menu and game. This desktop system is also Windows 10 64. Clearly, Tr2Main 9.0 is able to play alternative music files from "music" folder just fine if the system it runs on allows it.

So it's clearly some (probably complicated) system setup problem on that notebook system I encountered the problem on. Will investigate this further when I find the time.

Also, some hints how to rip an audio cd to a single file and automatically generate a cdaudio.dat file with the correct timecode (and which ripper to use for that) would still be greatly appreciated.

@noisecode3
Copy link

noisecode3 commented Dec 16, 2024

WinMM relies on older, more generic audio drivers, and many modern sound cards may not fully support or prioritize this older API. Some sound cards may not have robust driver support for the older Windows Multimedia API, which could cause issues with playback or functionality when using winmm.dll. So what sound card did you use on the other computer that did not work? I'm interested. Maybe also how did just not ogg-winmm work?

@noisecode3
Copy link

yes I think it could indeed be this
dsoal modification you did sorry Im stupid. try without it on the other computer.

@blam666
Copy link
Author

blam666 commented Dec 16, 2024

The soundcard of the notebook TR2main has the problem on is just some generic Realtek onboard driver. It's generally quite a dated notebook that was sold still with Windows 7 and updated to Win 10.

EDIT: I actually do have an external soundcard from Creative for 3d Sound attached to it via usb (Creative Omni Surround). I can choose in my taskbar which soundcard does the output, though. I actually had the idea before it could have something to do with that. But there was no change to that missing music problem regardless if I used onboard sound or that external card. As for now, that seemed to turn out to be a red herring for the problem.

But (I think I already wrote this) I use ogg-winmm in different forks quite often on that system and it usually works fine.
I just a minute ago tested another installed game on that notebook that restores cd audio using a different fork of ogg-winmm and it's ok. It plays music, loops as it should and so on. I tested that version of ogg-winmm that works with that other game already on TR2main, but there it messes up.

Right now I'm out of ideas. I may try renaming winmm.dll there to winmx and hex editing the Tomb2.exe to point it to that as next attempt. This is something others with similar weird ogg-winmm problems often write about in other cases. Maybe it's worth a shot. But I won't have time for any more messing around with this naggy little problem until Thursday or so.

@blam666
Copy link
Author

blam666 commented Dec 16, 2024

The DSOAL modification could be it, you think? This would be the first time that modification causes problems, but thanks for the idea, I'll be looking into it.

That will require some finnicky messing around with the registry again, though. I'll try in some days.

@noisecode3
Copy link

yes I am stupid I forgot this. I had this happen to me.
When an application calls winmm.dll functions (e.g., waveOutWrite), the Windows audio subsystem may route these calls through the WASAPI layer, and in some cases, WASAPI might utilize DirectSound (via dsound.dll) to handle certain playback tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants