Direct Sound issues RRS feed

  • Question

  • I'm trying to add audio streaming functionality to my app, where the program takes input from the selected input source, and then outputs it through the speakers. So obviously I need to use Direct Sound. However whenever I try to run my method I get to the point:

    WaveFormat format = new WaveFormat()
         SamplesPerSecond = 96000,
         BitsPerSample = 16,
         Channels = 2,
         FormatTag = WaveFormatTag.Pcm,
    and it's here that I get the error "BadImageFormatException" followed by the usual "is not a valid win32 application" message for the exception.

    Presumably it's because this is when I'm making the first real reference to the DirectX libs. This all worked in WinForms, and as WPF is built to run on DirectX anyway, Im unsure what to do to resolve this and why it's happening in the first place. Is there some sort of initialisation procedure I need to call, or can it simply not be done in WPF?

    Any help appreciated

    The Admin Jr
    Languages: Visual Basic, C, C++, Python,HTML, XML, C#, JavaScript, XAML
    • Moved by Linda Liu Wednesday, February 24, 2010 7:18 AM (From:Windows Presentation Foundation (WPF))
    Thursday, February 18, 2010 2:28 AM