Description: I refer to the official example of a simple package of a BSoundPlayer class, the characteristics of this WAV playback class:
1, easy to use, declare an object, specify the file path, Play (), Stop () on it, support to adjust the volume, and can output audio file total time, the current playback time
2, the same object can not be played again before playing (or manually stopped)
3, different objects can play at the same time
4, each time the playback is completed, the automatic release of resources
The biggest drawback of this class is that it can not be played again before the end of the play. The demand for a quick click on the button can not be met, but it can be used to play a long background music, and the SoundPlayer class under the System.Media namespace can be played at the same time , With the System.Media namespace under the SoundPlayer class used to do fast and short play, the basic can meet the needs of the game sound playback.
To Search:
File list (Check if you may need any files):
NAudioPractice1
...............\NAudioPractice1
...............\NAudioPractice1.sln
...............\NAudioPractice1.suo
...............\...............\bin
...............\...............\...\Debug
...............\...............\...\.....\ClickSound1.wav
...............\...............\...\.....\NAudio.dll
...............\...............\...\.....\NAudioPractice1.exe
...............\...............\...\.....\NAudioPractice1.pdb
...............\...............\...\.....\NAudioPractice1.vshost.exe
...............\...............\...\.....\NAudioPractice1.vshost.exe.manifest
...............\...............\...\.....\OpenDoorSound.wav
...............\...............\BSoundPlayer.cs
...............\...............\Form1.cs
...............\...............\Form1.Designer.cs
...............\...............\Form1.resx
...............\...............\NAudioPractice1.csproj
...............\...............\obj
...............\...............\...\x86
...............\...............\...\...\Debug
...............\...............\...\...\.....\DesignTimeResolveAssemblyReferences.cache
...............\...............\...\...\.....\DesignTimeResolveAssemblyReferencesInput.cache
...............\...............\...\...\.....\NAudioPractice1.csproj.FileListAbsolute.txt
...............\...............\...\...\.....\NAudioPractice1.csproj.GenerateResource.Cache
...............\...............\...\...\.....\NAudioPractice1.csprojResolveAssemblyReference.cache
...............\...............\...\...\.....\NAudioPractice1.exe
...............\...............\...\...\.....\NAudioPractice1.Form1.resources
...............\...............\...\...\.....\NAudioPractice1.pdb
...............\...............\...\...\.....\NAudioPractice1.Properties.Resources.resources
...............\...............\...\...\.....\TempPE
...............\...............\Program.cs
...............\...............\Properties
...............\...............\..........\AssemblyInfo.cs
...............\...............\..........\Resources.Designer.cs
...............\...............\..........\Resources.resx
...............\...............\..........\Settings.Designer.cs
...............\...............\..........\Settings.settings