none
How can I play wav files on Visual Studio 2019? RRS feed

  • Question

  • Hi,

    I would lile to play wav file using either SharpDX.XAudio or SharpDX.DirectSound.

    When I used Visual Studio 2010, I used Microsoft.DirectX.AudioVideoPlayback and it worked well.

     But since Microsoft.DirectX.AudioVideoPlayback seems no longer available on Visual Studio 2019, I am at loss what to do.Thanks.

    Friday, February 7, 2020 12:28 PM

All replies

  • There are plenty of simple ways to play wav files

    One of them is with WMP : Embedding the Windows Media Player Control in a C# Solution


    • Edited by Castorix31 Friday, February 7, 2020 12:44 PM
    Friday, February 7, 2020 12:40 PM
  • Hi hirohiro3750,

    Thank you for posting here.

    Based on my test, you can use the following code to play wav files.

     using System.Media;
    
    
    private void button1_Click(object sender, EventArgs e)
            {
                SoundPlayer snd = new SoundPlayer("1.wav");
                snd.Play();
            }

    Hope this could help you.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 10, 2020 7:08 AM
    Moderator