-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
XAudio2: Add WMA support #46
Conversation
Project generation was on my mind at one point... I'm currently weighing options to get FAudio integrated into Wine and that would certainly be a major factor for this, so I'll get back to you on that. For now, VS isn't a big deal since this is basically for XnaToFna, Wine, and not much else. CC @aeikum who is the original author of the ffmpeg patches, and has experience with this in Wine's XAudio2 built-in. We're both going to try and review this, since I can test the XNA stuff and he can test the Wine stuff (we definitely need to run this against the existing tests). Also CC @0x0ade who needs this for XnaToFna. If you have time to try this out, let me know! |
I'm attempting to compile this via: source cpp/scripts/cross_compile_64 but I'm getting:
and
compiling master works as intended. |
The F3DAudio unit doesn’t change with this patch, so you’re looking at a different issue - this looks like stdint conflicts with crtbase, which I think isn’t us at all...? |
@GloriousEggroll: you're cross compiling, right? In that case, the FFmpeg binary you're using also needs to be cross compiled. I'm guessing yours is not because it would be weird for it to be installed to /usr. |
I gave it a real brief review and the general idea looks fine to me. I remember it being important that the buffer stuff is tracked in terms of bytes, unlike with PCM data which is tracked in frames. That was what I was working on when I stopped, I don't know if that got fixed already. |
utils/testxwma/testxwma.cpp
Outdated
/* process command line arguments. This is just a test program, didn't go too nuts with validation. */ | ||
if (argc < 2 || (argc > 4 && argc != 7)) { | ||
printf("Usage: %s filename [PlayBegin] [PlayLength] [LoopBegin LoopLength LoopCount]\n", argv[0]); | ||
printf(" - filename (required): can be either a WAV or XMWA audio file.\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"xWMA" instead of "XMWA"
src/FAudio_internal.c
Outdated
@@ -1277,3 +1277,4 @@ void FAudio_INTERNAL_DecodeStereoMSADPCM( | |||
|
|||
*samples = done; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra newline...?
The only broad thing I see is spaces instead of tabs for some parts of the files. At the moment I'm trying to wire up FACT to test this with WaveBank data but it's giving me a hard time; here's the patch I threw together to test:
Error message is |
Updated the test patch above after the shocking revelation that the Duration value in the WaveBank represents the duration of the wave: |
@aeikum Yes, but most of those changes were merged in a previous PR (#45). The decoder stores stores the current position in the encoded stream in bytes (https://github.com/JohanSmet/FACT/blob/8864fcae768b323704e1d81439e91500437a3120/src/FAudio_ffmpeg.c#L17). @flibitijibibo Those style errors should be fixed. I was just looking at FACT wavebanks when I saw your review remarks. I'll try out your patch shortly. |
Happy to report Voices in Skyrim SE now working as they should, and Warframe x64 bit no longer crashing in the usual mission loading locations due to wma decoding issues. Used winetricks xact (modified winetricks script to enable 64 bit xaudio dlls.), then ran the wine_setup_native afterwards (removed x3daudio section as instructed via email). |
Just a quick heads up that CustomAllocatorEXT just got pushed to master: Thankfully this doesn't appear to have introduced a conflict, so I think this can be rebased and fixed to use |
@flibitijibibo Your FACT patch looks good. Tested with the Murder Miners WaveBank, everything plays fine except the entries with sample rate 32000 and (coded) block align 194. Checked with MS XACT3 and it passes the same parameters as FACT. So that's looking good. Unfortunately when I extract a sample from the wavebank and run it through ffmpeg (or vlc for that matter) it gives the same error messages. So it would seem there's something about these files the FFmpeg WMA decoder does not like. (To verify the extracted file I tried it with xWMAEncode from the DirectX SDK and that decodes it without issues.) |
Oh, neat! I think I was testing the 32KHz samples, so a really dumb coincidence on my part. If you want you can throw that patch in and do a rebase, and once it's verified as working with |
Ok, the FACT patch and updates for CustomAllocatorEXT are in. |
src/FAudio.c
Outdated
i = FAudio_FFMPEG_init(*ppSourceVoice); | ||
if (i != 0) | ||
{ | ||
FAudio_free((*ppSourceVoice)->src.format); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
audio->pFree
for these two. Other than that, new changes LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, didn't see those. Fixed!
Just tried the patch and sure enough it works. I guess we'll need to talk to the FFmpeg developers about 32KHz support? In any case I'll merge this, thanks for digging into it so quickly! Never thought I'd see the day where FNA could work with WMA samples. |
Third PR for issue #32. This adds xWMA support to FAudio using FFmpeg.
AFAIK there isn't a nice way to add optional features to a Visual Studio project, so the support here is a bit, uhm, DIY. The only alternative I see is to add another project and unload the unwanted FAudio project from the solution depending if you want FFmpeg support or not. But that gets unmanageable really fast. Moving to a project generator seems to get more and more interesting :-)