How to play WAV audio file from Resources?

后端 未结 7 2032
面向向阳花
面向向阳花 2020-12-02 10:10

How can I play a WAV audio file in from my project\'s Resources? My project is a Windows Forms application in C#.

相关标签:
7条回答
  • 2020-12-02 10:44

    You need to be cautious about the garbage collector freeing up memory used by your sound while the sound is still playing. While it rarely happens, when it does, you will just be playing some random memory. There is a solution to this, complete with source code for achieving what you want here: http://msdn.microsoft.com/en-us/library/dd743680(VS.85).aspx

    Scroll to the very bottom, in the "Community Content" section.

    0 讨论(0)
提交回复
热议问题