Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / error "Failed to create XAudio2 mastering voice"

Author
Message
Greenwich
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location:
Posted: 25th Dec 2014 22:45
Forgive me if this is discussed elsewhere already; I've searched through the forum posts and didn't see anything.

I use AGK2 Tier 1, AGK2's IDE. I've been receiving this error, sometimes, when I run my .exe after my program compiles successfully:

Quote: "Uncaught exception:

Failed to create XAudio2 mastering voice"


It's confusing because it's so intermittent -- I'll write 100 lines of code, compile a program that runs successfully, add 20 lines and recompile and run, get the exception error, remove the 20 lines and recompile and run, still get the exception error.

I get it even with the simplest possible code:


The weird thing is, I don't ~always~ get this exception. In fact, it's pretty uncommon; most of the time my code compiles just fine. And there's no correlation with using particular commands, definitions, functions, etc -- in fact, the most common way for me to cause this exception happens when I'm only adding comments to my code.

The only comprehensible trend I've noticed is that if I do get the exception error, no further editing of the main.agc file will fix it, and no .exe that was ever compiled by AGK2 will work thereafter (not even an unedited new project just printing FPS, not even exe files that worked just fine an hour ago and haven't been changed since).

Google just gives me a github link that's incomprehensible to me.

Anyone have any idea what might be going on?

Many thanks (and Merry Christmas!)

It's mean time. *averages*
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 26th Dec 2014 09:33
Check which versions of XAudio2 DLLs you have installed. Run a search on C: for XAudio2 and you should see a lot of versions - they look like XAudio2_7.dll. I have versions 0 to 7 in system32 and system/WOW64. These are 64-bit and 32-bit DLLs.

AGK produces 32-bit EXEs, so you MUST have the 32-bit DLL versions. You cannot use a 64-bit DLL from a 32-bit EXE.

-- Jim - When is there going to be a release?
KultiVator
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: Sunny Northamptonshire
Posted: 2nd Jan 2015 01:05
I was getting similar XAudio2 errors too, on a recently purchased Windows 8.1 tablet device, with only the default Direct X components installed.

The solution, for me, was to download the latest DirectX Redist from Microsoft, as some prior Googling had indicated that the XAudio V2.7 engine needed by AGK2 was included.

Tested AGK2 immediately after applying the DirectX refresh and have not seen a single XAudio2 error message since.

( Aggravated > Constipated > Mutilated ) < KultiVated
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 2nd Jan 2015 18:58
To retain XP support, AppGameKit uses XAudio 2.7 for their audio which is not included in the latest DirectX runtimes that ship with Windows 8+. If you install the June 2010 runtimes you won't receive that error any more.

I guess the AppGameKit installer does not properly install the required cab files which is something TGC needs to revise. It's a simple fix and one I have done myself when redistributing desktop applications to ensure the end user has the necessary components. It has about a 2MB overhead to silently install the needed DirectX components (DSETUP.dll, dsetup32.dll, DXSETUP.exe, dxupdate.cab, Jun2010_XAudio_x86.cab).

In my opinion retaining support for Windows XP is becoming unnecessary and causes more problems and compatibility quirks for the vast majority of users who have long moved on. Stats indicate no more than 5-15% of users are still on XP, and with Microsoft cutting all support a year or so ago it makes little sense to keep developing apps compatible with it.
Greenwich
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location:
Posted: 5th Jan 2015 18:40
Thanks, everybody who has commented.

Jim Hawkins: Thanks for letting me know where to check! As it turns out, I did have a list of XAudio2 files in system32, including the XAudio2_7.dll file.

xcept: Thanks for the download link! The extractor asks, "Please type the location where you want to place the extracted files."

I used C:\TempDirectX and it unpacked several dozen .cab files to that location. Obviously that's not going to help a whole lot... where would AGK2 expect to find these .cab files?

(My workstation runs Windows 7 Ultimate 64-bit.)

It's mean time. *averages*
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 6th Jan 2015 04:24
If the error is intermittent then it sounds like you have the necessary files. The error message you got happens when CreateMasteringVoice() fails and apparently that can happen if no audio device could be found.
Greenwich
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location:
Posted: 8th Jan 2015 06:06
Is there any way for me to prevent calls to CreateMasteringVoice in order to dodge the error? My app projects don't even have sound/audio at present...

It's mean time. *averages*
Greenwich
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location:
Posted: 8th Jan 2015 18:21
By trial and error I've found the underlying problem appears to be the unholy alliance between Microsoft Visual C++ 2010 Redistributables, the complete DirectX SDK, and Microsoft Visual Studio. If installed in the wrong order, you get the same problem that people with Windows 8+ were having. However, the method above doesn't work unless you uninstall some things first.

What finally worked for me: Uninstall each C++ Redistributable from 2010; then install the DirectX SDK from here; then install Microsoft Visual Studio Community 2013 with Update 4 from here (and let Visual Studio reinstall the C++ redistributables).

Hopefully the problem does not reoccur, and hopefully this thread helps if anybody experiences the same weird error at some point. Thanks everybody for all the help with this.

It's mean time. *averages*
zxretrosoft
AGK Developer
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location: Prague, Czech Republic
Posted: 24th Mar 2015 13:43
To KultiVator:
Quote: "I was getting similar XAudio2 errors too, on a recently purchased Windows 8.1 tablet device, with only the default Direct X components installed.
The solution, for me, was to download the latest DirectX Redist from Microsoft, as some prior Googling had indicated that the XAudio V2.7 engine needed by AGK2 was included."

Thank you! Yes, it working right!

I am sorry for poor English

Login to post a reply

Server time is: 2024-04-24 22:34:28
Your offset time is: 2024-04-24 22:34:28