Managed XAudio2 - Do you want it?

Last post 04-13-2008, 6:54 PM by Björn Graf. 19 replies.
Sort Posts: Previous Next
  •  04-03-2008, 7:26 PM

    Time [O] Managed XAudio2 - Do you want it?

    Hi guys (and gals),

    I'm getting close to releasing a beta release of Managed XAudio2 for Windows; allowing any .NET language access to the XAudio2 COM interfaces and their respective methods. What I would like to know is 'Who would be interested?', 'You?'. Obviously it can be used as an alternative to XACT within XNA Game Studio. In fact because it's a .NET assembly it is accessible through any .NET language and therefore implementable in Windows applications, etc. I don't believe it will work on the XBox 360 and as I do not have access to one I can't guarantee it's functionality but future versions will be targeted at both platforms.

    I am aware that XACT3 uses XAudio2 and I'm not a fan of XACT. I have heard many arguments for and against it so I am also simultaneously writing an editor tool but thats going to be a few months away at least.

    I eagerly await your replies...

    The Lumnious Aardvark
  •  04-03-2008, 7:28 PM

    Re: Managed XAudio2 - Do you want it?

    The Luminous Aardvark:
    I don't believe it will work on the XBox 360 and as I do not have access to one I can't guarantee it's functionality but future versions will be targeted at both platforms.

    If there's any COM or native interop it won't work on the Xbox 360. You have to be 100% managed on Xbox.

    I would be all about testing things, but my audio needs are simple. I don't even know what I'd gain from using this over XACT.

    Nick Gravelyn -- Microsoft XNA MVP
    XNA Wiki | Zune Games
  •  04-04-2008, 1:14 AM

    Re: Managed XAudio2 - Do you want it?

    XAudio2 has better multi-channel audio support, better compression support (WMA anyone?) and better DSP, among other things.
    However, on Windows, what would a managed wrapper give you that COM interop doesn't?
    And on Xbox, we have to wait for XACT 3 support, which supports XAudio 2. We're hoping XNA GS will dare to upgrade to XACT 3 by 3.0, but they have been mum on specifics so far.


    --
    Jon Watte, Direct3D MVP
    kW X-port 3ds Max .X exporter
    14 days after getting my RROD box back, it's going back for service again. Grr.
  •  04-04-2008, 12:18 PM

    Re: Managed XAudio2 - Do you want it?

    Ok fair points made by both of you but take the following for example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    void InitializeAudioEngine()
    {
    // Create the manager
      _xAudio2Manager = gcnew XAudio2Manager();

    // Use default Engine Settings
      EngineSettings^ es = gcnew EngineSettings();
      _xAudio2Manager->CreateDevice(es);

    // Load wave
      WaveDataContainer^ wdc = _xAudio2Manager->LoadWave("foobar.wav");

    // Create Source Voice from WAVEFORMATEX of wdc
      XAudio2SourceVoice^ source = _xAudio2Manager->CreateSourceVoice(wdc);

    // play the source
    source->Play();
    }

    I appreciate it's using C++ and I'm not demonstrating error trapping, cleanup, etc. but how many lines of code would it take (as in the XAudio2BasicSound example)? There is far more to it than this too.

    If you or anyone else believe that there is truly no need for this then please let me know as I could be doing something else. Perhaps more useful too!

    :)
  •  04-04-2008, 3:32 PM

    Re: Managed XAudio2 - Do you want it?

    The problem is that managed development of games almost only makes sense when you want to target the Xbox. Else you might as well develop in the native C++, that all the SDK and examples support. And when targeting the Xbox, an XAudio2 wrapper will not work; we'll have to wait for GSE 3 and hope they support XACT 3. At least, that's my opinion -- others may have different opinions.

    --
    Jon Watte, Direct3D MVP
    kW X-port 3ds Max .X exporter
    14 days after getting my RROD box back, it's going back for service again. Grr.
  •  04-04-2008, 4:23 PM

    Re: Managed XAudio2 - Do you want it?

    Thanks for your input.

    Could you or someone explain to me, why a managed wrapper won't work on the Xbox or direct me to the information please. Does the Xbox not have the XAudio2 dll?

    Thanks again.
  •  04-05-2008, 12:33 PM

    Re: Managed XAudio2 - Do you want it?

    The only managed DLLs on the Xbox are the DLLs provided by XNA Game Studio Express. Any other Xbox development has to be done with the XDK, which is only available under NDA with Microsoft. And to get to sign that NDA, you pretty much need to have relations with some publisher that is already working on Xbox games.

    --
    Jon Watte, Direct3D MVP
    kW X-port 3ds Max .X exporter
    14 days after getting my RROD box back, it's going back for service again. Grr.
  •  04-08-2008, 11:14 AM

    Re: Managed XAudio2 - Do you want it?

    I hope that XNA Game Studio 3.0 would come with some support for XAudio2...but till then....
    It would be REALLY nice to have a managed wrapper of XAudio2!
    Good idea dude, I'm interested!
  •  04-08-2008, 5:44 PM

    Re: Managed XAudio2 - Do you want it?

    Well as I'm sure you are aware XACT3 utilises XAudio2 so you can expect it to be there with GSE 3.0. I'll be making the Managed XAudio2 available shortly and will post a message on the forum accordingly.

    See following post.
  •  04-08-2008, 5:51 PM

    Re: Managed XAudio2 - Do you want it?

    The Luminous Aardvark:
    Well as I'm sure you are aware XACT3 utilises XAudio2 so It'll be there with GSE 3.0.


    That has neither been confirmed nor denied. While it is logical and likely that they will support XACT3, there is no confirmation from the XNA team that it will be used for XNA GS 3.0.


    Nick Gravelyn -- Microsoft XNA MVP
    XNA Wiki | Zune Games
  •  04-10-2008, 5:33 PM

    Re: Managed XAudio2 - Do you want it?

    I stand corrected.
  •  04-10-2008, 5:35 PM

    Re: Managed XAudio2 - Do you want it?

    The Luminous Aardvark:
    I stand corrected.


    It's not a big deal, but I want to make sure others reading the forums in the future know that this isn't a confirmed feature yet. It's important to distinguish between speculation/assumptions and confirmed features.


    Nick Gravelyn -- Microsoft XNA MVP
    XNA Wiki | Zune Games
  •  04-10-2008, 5:43 PM

    Re: Managed XAudio2 - Do you want it?

    Nick Gravelyn:


    It's not a big deal, but I want to make sure others reading the forums in the future know that this isn't a confirmed feature yet. It's important to distinguish between speculation/assumptions and confirmed features.


    Quite right, I should not have speculated. But surely with the XACT3 COM interfaces being available through the March 2008 DirectX SDK, then one would imagine that XACT3 would be implemented within the release of XNA GSE 3.0.

        As you have said previously though, this has not been confirmed. So fingers crossed for all those that want it.
  •  04-10-2008, 8:33 PM

    Re: Managed XAudio2 - Do you want it?

    surely with the XACT3 COM interfaces being available through the March 2008 DirectX SDK, then one would imagine that XACT3 would be implemented within the release of XNA GSE 3.0


    With that thinking, then because Direct3D 10 has a COM interface, it, too, will be available in the XNA Framework.

    The XNA Framework provides a managed, cross-platform framework for game development, but the features they include have to be supported on both Xbox and PC -- and they have to be prioritized high enough to make it onto the agenda for the XNA Framework team. The fact that it's COM, vs C-style functions, is probably not going to matter one way or another.

    I, too, would very much like XACT 3 to be in XNA Framework 3.0, and I think that upgrading with the times is the right thing to do, but wishful thinking don't make it so.

    --
    Jon Watte, Direct3D MVP
    kW X-port 3ds Max .X exporter
    14 days after getting my RROD box back, it's going back for service again. Grr.
  •  04-10-2008, 9:54 PM

    Re: Managed XAudio2 - Do you want it?

    jwatte:

    With that thinking, then because Direct3D 10 has a COM interface, it, too, will be available in the XNA Framework.


        But XAudio2 requires no special hardware requirements!?

    jwatte:

    The fact that it's COM, vs C-style functions, is probably not going to matter one way or another.


        The point I was trying to make was that the XACT3 API is available to some and not to XNA developers.

        Anyhow my mistake, I thought that XAudio2 was going to be the replacement for DirectSound as the standard for multimedia apps, games, etc. and that developers would have to implement it as DirectSound would be deprecated. Seeing as XACT3 implements a layer on top of XAudio2 then Microsoft would want developers to be using it ASAP, surely?

  •  04-11-2008, 6:41 AM

    Re: Managed XAudio2 - Do you want it?

    The Luminous Aardvark:
    The point I was trying to make was that the XACT3 API is available to some and not to XNA developers.

    Anyhow my mistake, I thought that XAudio2 was going to be the replacement for DirectSound as the standard for multimedia apps, games, etc. and that developers would have to implement it as DirectSound would be deprecated. Seeing as XACT3 implements a layer on top of XAudio2 then Microsoft would want developers to be using it ASAP, surely?

    The XNA FX team has to ensure that audio will work on the Zune, which will be available (in some way or another) on the 360 and Windows, too - IIRC at least. If that something will utilize XACT3/XAudio2 is yet a subject for an announcement; while it can (and probably will) be based on either or both it might be something completly different. And if all XACT3/XAudio2 interface will be exposed to XNA FX developers is another question - see the current exposure of XACT interface...

    I, for one, would like to see at least XACT3 support (I won't include a link to Bnoerj.Audio here :]) to be able to compress background music and friends in WMA to reduce the distribution size on Windows.


    We are boki. The rest is known.
    The not so known part of the rest: It is Björn or Bjoern, but never Bjorn.
  •  04-11-2008, 7:58 PM

    Re: Managed XAudio2 - Do you want it?

    Microsoft would want developers to be using it ASAP, surely?


    You seem to have the illusion that one side of Microsoft knows what the other is doing, and would be willing to fund some larger, all-encompassing goal. Aside from the big push for secure code, Microsoft doesn't work like that. The XNA group has a finite number of developers, and can only implement the features they have time for. They have a long list of known bugs, and an even longer list of desired features, and only X amount of people times Y months to design, implement, develop, test and deliver the new version of XNA/GSE and XNA/FW.

    Right now, when you're using XACT from XNA, you're already using XAudio, which is also a replacement for DirectSound. (Actually, the "real" replacement for DirectSound is further down, in the kernel mixer and driver layer) The XNA team doesn't get brownie points, or extra resources, from Microsoft Headquarters if they decide to upgrade to XACT 3. However, they may (and should!) still choose to do it, because it is "probably" (I'm guessing here) not that hard, and it will "quite likely" (again, I'm estimating) give us a number of desirable features, such as better compressed support on PC, audio stream access, and likely a fix for the access violation bug when disposing playing cues.

    And, honestly, the number of developers that use XNA to ship real games to real customers on the PC is probably countable on the fingers of one hand. Meanwhile, most developers are using the native API, and choose XACT3 or XAudio2 (or some earlier version) as they see fit, so they are not constrained. There are two reasons why XNA makes sense at all:
    1) It allows for a "safe" sandbox where amateurs and indies can run code on the Xbox
    2) It gets people coming into the business used to using Microsoft tools, which is a benefit for the MS platform in the long run

    And, evenso, some days I think 2) is the real gain, and 1) is just the hook they use to get you to use it. But if that were 100% true, then the XNA group would actually be fully funded by the Microsoft marketing department, and I don't think that's actually the case :-)



    --
    Jon Watte, Direct3D MVP
    kW X-port 3ds Max .X exporter
    14 days after getting my RROD box back, it's going back for service again. Grr.
  •  04-13-2008, 4:17 PM

    Re: Managed XAudio2 - Do you want it?

    jwatte:

    You seem to have the illusion that one side of Microsoft knows what the other is doing...


        I thought that the XNA and DirectX teams were interlinked?

        And I, coming from a background of DirectX programming, am aware of the benefits of native code. I am a relative newcomer to the world of .NET and as you are aware the amount of code to enumerate device and retrieve device capabilities within Direct3D for example, is very long winded compared to, say the XNA framework. So the XNA framework does most of the laborious work allowing "amateurs" to get on with productive coding. Good move Microsoft!!!

        But, someone please correct me if I am wrong, if I understand you correctly, the XNA framework cannot be extended on the XBox 360 unless one is using the XDK?

        While I understand that there are reasons for this, such as security, standardisation (sorry I'm English), etc., it would be a good idea if MS would allow the people who use the product to extend it, with Microsoft screening all additional code and yes I accept your point that there are only so many people on the XNA team and only so many months to complete implementations. Instead we are limited to the offerings, which while quite plentiful, are at the same time somewhat er... limited. While this is good enough and indeed should be for the beginner, there are features that could be added and that's what the Microsoft Connect is for. Okay so now I'm even losing the argument with myself! Lol. Hmmm.

        But there are features Microsoft aren't ever going to implement and while these features may not be required by everyone, why deny it's availability. I'm not talking specifically about my Managed XAudio2 which at the moment has been suspended, but take for example Björn Graf's XACT3 library, which if Microsoft doesn't implement XACT3 with the new XNA framework would be useful to some.

        Or have I got it all wrong again?

        So now I sit here staring at my screen wait for inspiration as the sun rises and falls again.

        :)

  •  04-13-2008, 4:35 PM

    Re: Managed XAudio2 - Do you want it?

    The Luminous Aardvark:
    But, someone please correct me if I am wrong, if I understand you correctly, the XNA framework cannot be extended on the XBox 360 unless one is using the XDK?


    Correct. If you get a full publishing agreement with Microsoft you can get an XDK and the XNA LIVE Arcade Extensions to add more to your game in terms of LIVE presence, achievements, and so on. At that point, I'm really not sure what details there are about native interop with your XNA game. It's been said that the native interop on Xbox is more complicated than the PInvoke used on Windows, so I'm not sure what the options there are. Those details have not been (and probably won't ever be) publicly released.

    While I understand that there are reasons for this, such as security, standardisation (sorry I'm English), etc., it would be a good idea if MS would allow the people who use the product to extend it, with Microsoft screening all additional code and yes I accept your point that there are only so many people on the XNA team and only so many months to complete implementations. Instead we are limited to the offerings, which while quite plentiful, are at the same time somewhat er... limited. While this is good enough and indeed should be for the beginner, there are features that could be added and that's what the Microsoft Connect is for. Okay so now I'm even losing the argument with myself! Lol. Hmmm.

        But there are features Microsoft aren't ever going to implement and while these features may not be required by everyone, why deny it's availability. I'm not talking specifically about my Managed XAudio2 which at the moment has been suspended, but take for example Björn Graf's XACT3 library, which if Microsoft doesn't implement XACT3 with the new XNA framework would be useful to some.


    Besides the technical difficulties of the native interop on Xbox mentioned by some of the team, the security is likely the main reason why you don't get to extend the Xbox libraries. To do this would open up a whole world of security holes to deal with. You could move over all sorts of malicious native code that would be able to do all sorts of harm to the Xbox 360. This is a huge issue for Microsoft. Another smaller point is that the Xbox 360 processor is PPC so the instruction set is different from Windows PCs. You would have to find a way to specially compile libraries to match the Xbox 360 processors instruction set. I presume this is the compiler that you can get with an XDK, another reason why you won't see it publicly released.


    Nick Gravelyn -- Microsoft XNA MVP
    XNA Wiki | Zune Games
  •  04-13-2008, 6:54 PM

    Re: Managed XAudio2 - Do you want it?

    Nick Gravelyn:
    Besides the technical difficulties of the native interop on Xbox mentioned by some of the team, the security is likely the main reason why you don't get to extend the Xbox libraries.

    Clickerty to the someone (AKA Shawn, who else) and another link to something else but related (esp. the 3rd paragraph).


    We are boki. The rest is known.
    The not so known part of the rest: It is Björn or Bjoern, but never Bjorn.
View as RSS news feed in XML
©2007 Microsoft Corporation. All rights reserved. Privacy Statement Terms of Use Code of Conduct Feedback