XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

XACT3 (XAUDIO2) and Unimodem device problem.

Last post 1/15/2009 5:45 PM by Dugan. 3 replies.
  • 12/31/2008 1:26 PM

    XACT3 (XAUDIO2) and Unimodem device problem.

    Hi guys,

    I am experiencing a quite strange XACT3 problem I so far
    can't find a way to fix.

    The problem happens in the following conditions :

    - XACT3 ( November 2008 DirectX SDK )

    - machine having a "SoundMAX Integrated Digital Audio" sound chip
    with the presence of the "Unimodem Half-Duplex Audio Device"

    - device above when listed seems to look as

    Device name : WaveOut 1
    Description : Modem #0 Line Playback (emulated)
    GUID : c2ad1800 - b243 - 11ce - a8a4 - 00aa006c4501

    - project simply trying to initialize the XACT engine with
    "standard default parameters" ( most important pRendererID = NULL ).

    The situation that happens is the following :

    - this "Unimodem" device is erroneously taken as the "GlobalDefaultDevice"
    - m_pXACT3Engine->Initialize() fails

    If run in DEBUG mode we can see this happening :

    XAUDIO2: Thread 3e4: 5935.578ms: x2engine.cpp:352: IXAudio2::GetDeviceCount: API call: Entry (this=0x00AE0768)
    XAUDIO2: Thread 3e4: 5935.959ms: x2engine.cpp:1647: CX2Engine::CreateLeapIfNeeded: Entry (this=0x00AE0768)
    XAUDIO2: Thread 3e4: 5936.239ms: x2engine.cpp:1647: CX2Engine::CreateLeapIfNeeded: Exit (S_OK)
    XAUDIO2: Thread 3e4: 5936.492ms: system.cpp:494: ILeap::GetRendererCount: API call: Entry (this=0x00AE8A38)
    XAUDIO2: Thread 3e4: 5936.784ms: system.cpp:2379: CLeapSystem::GetRendererCountDS: Entry (this=0x00AE8A38)
    XAUDIO2: Thread 3e4: 5937.077ms: dsoundrendererconnection.cpp:320: CDSoundDeviceList::Initialize: Entry (this=0x00AE8A50)
    XAUDIO2: Thread 3e4: 6565.864ms: dsoundrendererconnection.cpp:476: CDSoundDeviceList::DSoundEnumerateCallBack: Entry
    XAUDIO2: Thread 3e4: 6566.210ms: dsoundrendererconnection.cpp:476: CDSoundDeviceList::DSoundEnumerateCallBack: Exit (S_OK)
    XAUDIO2: Thread 3e4: 6567.064ms: dsoundrendererconnection.cpp:476: CDSoundDeviceList::DSoundEnumerateCallBack: Entry
    XAUDIO2: Thread 3e4: 6621.139ms: dsoundrendererconnection.cpp:135: CreateOptimalDSoundBuffer: Entry
    XAUDIO2: Thread 3e4: 6621.622ms: dsoundrendererconnection.cpp:58: TryToCreateDSoundBuffer: Entry
    XAUDIO2: Thread 3e4: 6623.343ms: dsoundrendererconnection.cpp:58: TryToCreateDSoundBuffer: Exit (S_OK)
    XAUDIO2: Thread 3e4: 6623.753ms: dsoundrendererconnection.cpp:135: CreateOptimalDSoundBuffer: Exit (S_OK)
    XAUDIO2: Thread 3e4: 6629.259ms: dsoundrendererconnection.cpp:476: CDSoundDeviceList::DSoundEnumerateCallBack: Exit (S_OK)
    XAUDIO2: Thread 3e4: 6629.647ms: dsoundrendererconnection.cpp:476: CDSoundDeviceList::DSoundEnumerateCallBack: Entry

    XAUDIO2: Thread 3e4: 6656.591ms: dsoundrendererconnection.cpp:476: CDSoundDeviceList::DSoundEnumerateCallBack: FAILED (DSERR_ALLOCATED: DirectSound call failed because resources were already in use)

    XAUDIO2: Thread 3e4: 6657.090ms: dsoundrendererconnection.cpp:320: CDSoundDeviceList::Initialize: Exit (S_OK)
    XAUDIO2: Thread 3e4: 6657.401ms: system.cpp:2379: CLeapSystem::GetRendererCountDS: Exit (S_OK)
    XAUDIO2: Thread 3e4: 6657.680ms: system.cpp:494: ILeap::GetRendererCount: API call: Exit (S_OK)
    XAUDIO2: Thread 3e4: 6657.946ms: x2engine.cpp:352: IXAudio2::GetDeviceCount: API call: Exit (S_OK)

    You can see the problem happening at 6656.591 ms the FAILure.

    At this point we tried various things to overcome the problem, first of all was to try
    to use GetDeviceID ( &DSDEVID_DefaultPlayback, &DevPlayGUID ); and the convert the
    obtained DevPlayGUID into a string simply with that :

    swprintf (pguid,L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
        pGUID->Data1,pGUID->Data2,pGUID->Data3,
        pGUID->Data4[0],
        pGUID->Data4[1],
        pGUID->Data4[2],
        pGUID->Data4[3],
        pGUID->Data4[4],
        pGUID->Data4[5],
        pGUID->Data4[6],
        pGUID->Data4[7] );

     

    finally converting all uppercase and passing it to pRendererID

    The GUID obtained with this method seems to be correct, it correctly gets the other device, not the Unimodem
    one as "Default Playback".

    However it seems not to be working, like if the XACT3 does not care at all about the passed GUID, actually I
    found out that if the GUID is not exactly in the format {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxx} it gives an error
    but even when I pass a correct one it seems it still tries to initialise "something else" rather than the
    GUID of the device I am passing by.

    The only workaround so far we found is to go in control panel and disable such device.

    Has anyone else seen/had the same problem and knows about how to solve it ?

    We are having quite some troubles here, this device unfortunately seems to be quite
    popular among some kind of Dell laptops and our recently made game does not work because of
    this silly thing.

    Any help will be greatly appreciated, thanks in advance.

    Ivan Z.

  • 1/14/2009 1:46 AM In reply to

    Re: XACT3 (XAUDIO2) and Unimodem device problem.

    Thanks for the great problem report.  I just replied to a similar question elsewhere in the forum, so I'm copying the same response here.

    XAudio2 gets confused if it finds a DirectSound device on the system that can't actually be used (because it fails DirectSoundCreate or CreateSoundBuffer).  It seems that these modems fall in that category.  Perhaps the modem vendor ships some tool (a virtual speakerphone?) that knows the magic incantation to make them work, but I tried any number of formats and options and couldn't discover it.  Luckily the modem doesn't register itself as the default audio device, but even so it seems odd to give people the option to kill all sound on their system simply by choosing the wrong device in mmsys.cpl... But I digress.

    Essentially the problem is that XAudio2's GetDeviceCount() and GetDeviceDetails() methods (on XP) run through all available DirectSound devices, instantiating them and fiddling with them in various ways to discover information about them.  If this fails for any one device, the entire process is interrupted and XAudio2 is left in an unusable state, due to a separate problem.

    This will be fixed in the next XAudio2 release.  Meanwhile, here are some workarounds:

    1. Run devmgmt.msc and disable the Modem Line Playback device (*).  [If this breaks anything, please let me know - it might explain why these devices exist in the first place, and I'm curious.]
    2. At the XAudio2 level:
      1. If you just want to use the default device, avoid calling GetDeviceCount/Details at all (*).  CreateMasteringVoice will work (at least once).
      2. If you absolutely need to call GetDeviceCount/Details, it's possible, though fiendish: you'll need to destroy and recreate the XAudio2 object after each call.
    3. At the XACT level, the techniques above are roughly applicable, and you can create an XAudio2 object yourself and pass it to XACT in the Initialize() call (in XACT_RUNTIME_PARAMETERS.pXAudio2).  You also need to provide the mastering voice pointer in this case.

    (*) These are the methods I've tried personally and know to work.  I can't guarantee that the others will, but they should.

  • 1/15/2009 3:40 PM In reply to

    Re: XACT3 (XAUDIO2) and Unimodem device problem.

    Dear Dugan,

    this is a terrific reply finally I can put my mind "at a rest" :)

    A friend of mine tried "deeply" to track/debug this stuff but concluded "there's no easy way to fix that".

    So we found all this only because/when we started to have a number of people playing our game on some Dell laptops ( not sure which models )
    that seems to have this quite strange device.

    This device, I did not totally understood what is for but appearently is something that allows to have an audio stream/conversation when using
    a POTS modem connection .. some kind of "virtual speakerphone" as you say but that I really don't know who ever is going to use/when.

    The problem is, the device is there and causes the problem, it also causes the problem cause XAUDIO/XACT picks it up as "default playback device"
    and there is where all crashes.

    Yes "disable it" is the first thing we found out, it definitely works and it's what we told people to do.

    You may also want to know that we found out ( again with some Dell laptops and some sound devices ) that when you pass NULL to the pRendererID
    sometime XAUDIO seems to pick up as playback device "something else" that it's not really the one with the default playback role, to get that is
    really necessary to identify the proper ID and pass it to pRendererID and that's why you have to enumerate and get the details.

    I was assuming that "NULL" was in some way enumerating and picking up the correct ID for you but that seems not to be exactly the case.

    Anyway I think "we can wait for the fix" and meanwhile tell people that "yes there's this problem, if you have it disable that device".

    Thanks a lot for help, it's been really a relief to see this answer and finally understand what's going on :)

     

  • 1/15/2009 5:45 PM In reply to

    Re: XACT3 (XAUDIO2) and Unimodem device problem.

    You're welcome!  I only wish I'd seen these postings earlier and saved everyone a lot of research work.  I fell a little behind on the forum due to all the work we're doing for the March XAudio2 release.

    Perhaps these strange devices magically start working when you are actually in a modem call... I have no idea.  I do think the vendors should make sure that the devices don't show up in the enumeration when they're in a useless state.

    > when you pass NULL to the pRendererID sometimes XAUDIO2 seems to pick up as playback device "something else"

    I assume you mean passing uDeviceIndex=0 to CreateMasteringVoice?  Hmm, that's not good.  It should always use the default device, as specified in mmsys.cpl's Audio tab.  If you'd like to send us enough information to repro the problem on our end we'll take a look.

    But like I say, you should be OK enumerating the devices as long as you release and recreate your XAudio2 object afterwards.  I'm not sure that you'll see all the devices available (if you have multiple "true" audio devices as well as the funky modem device), but that's a fairly rare situation.

    Good luck with your project, and let us know if you have any other XAudio2 feedback / suggestions / problem reports...
Page 1 of 1 (4 items) Previous Next