Sign in to follow this  
trinith_006

Found possible XAudio2 issue with fix -- Devs still active?

Recommended Posts

Hey,

So we use SlimDX to provide audio playback capability for our product and are currently exploring an issue a customer is reporting. While playing around with XAudio2, we discovered an issue where, after disposing of the XAudio2 device, we would get an InvalidOperationException (handle is not initialized) in EngineCallbackShim::OnProcessingPassStart.

Since this happens after Dispose has been called on the SlimDX XAudio2 object, the object m_WrappedInterface (in EngineCallbackShim::OnProcessingPassStart) is no longer valid.

I did a bunch of digging around and believe I have discovered a fix. I've changed XAudio2's destructor code to...

        XAudio2::~XAudio2()
        {
            if (callback != NULL)
            {
                IXAudio2* pointer = static_cast<IXAudio2*>(this->UnknownPointer);
                if (pointer != NULL)
                {
                    pointer->UnregisterForCallbacks(callback);
                }

                delete callback;
                callback = NULL;
            }
        }

By calling UnregisterForCallbacks, it doesn't appear that the issue happens. I will run this over the weekend, and probably a few more times on Monday, to confirm, but I'm thinking this might resolve the issue.

Having said that, I've noticed that at SlimDX.org, the last release is the release I took when I first developed the audio engine... January 2012. Are the devs still active? Is there a way to confirm this functionality with the devs and perhaps have this included in an official build? We are able to build our own SlimDX binaries, but we would prefer to continue to use something official :)

Anyway, if anybody has any info, that would be awesome!

 

Thanks,

Gary

Share this post


Link to post
Share on other sites

There are occasional bugfixes in GitHub but we haven't done a fully packaged release basically since MS stopped doing "DirectX" releases. I'm happy to merge this change, but at this stage we tend to encourage people to do their own builds. I've been thinking about doing a modernized version of the library (DX11/12, XA2, XI against current languages and libs) but it hasn't materialized yet.

Share this post


Link to post
Share on other sites
21 hours ago, Promit said:

... at this stage we tend to encourage people to do their own builds.

Sounds good, and thanks for pointing out GitHub as well. We'll likely just end up changing our deployment process to accommodate this.

Just wanna take the opportunity to say that I appreciate the work you guys did on SlimDX. We only use it for audio but for the most part we haven't had any issues... even this one only showed up when repeatedly creating/destroying a device/mastering voice in an attempt to speed up the diagnosis of another issue.

Thank you :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this