资源简介

解决同一台电脑多张usb声卡,可同时播放不一样的声音文件;实现简单的ip网络广播的效果。这类资源很少,特此上传供需要者下载学习。

资源截图

代码片段和文件信息

using Microsoft.DirectX.DirectSound;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        private DevicesCollection myDevices = null;
        private struct myDeviceDescription
        {
            public DeviceInformation info;
            public override string ToString()
            {
                return info.Description;
            }
            public myDeviceDescription(DeviceInformation di)
            {
                info = di;
            }
        }

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender EventArgs e)
        {

        }

        private void button1_Click(object sender EventArgs e)
        {
            myDevices = new DevicesCollection();
            Guid driverGuid = Guid.Empty;
            foreach (DeviceInformation deviceInfo in myDevices)
            {
                if (!string.IsNullOrEmpty(deviceInfo.ModuleName))
                {
                    driverGuid = deviceInfo.DriverGuid;
break;
                }
            }

            Device dv = new Device(driverGuid);
            dv.SetCooperativeLevel(this CooperativeLevel.Normal);
            SecondaryBuffer buf = new SecondaryBuffer(“nopayhint.wav“ dv);
            buf.Play(0 BufferPlayFlags.Default);
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1147  2018-05-16 13:22  WindowsFormsApp1.sln

     文件        231  2018-05-16 13:29  WindowsFormsApp1\App.config

     文件     178176  2005-03-18 16:23  WindowsFormsApp1\bin\Debug\Microsoft.DirectX.DirectSound.dll

     文件     348085  2006-03-07 22:46  WindowsFormsApp1\bin\Debug\Microsoft.DirectX.DirectSound.xml

     文件     223232  2005-03-18 16:23  WindowsFormsApp1\bin\Debug\Microsoft.DirectX.dll

     文件     265390  2006-03-07 22:46  WindowsFormsApp1\bin\Debug\Microsoft.DirectX.xml

    I.A....    818990  2018-05-16 13:52  WindowsFormsApp1\bin\Debug\nopayhint.wav

     文件       9728  2018-05-22 15:29  WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe

     文件        231  2018-05-16 13:29  WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe.config

     文件      22016  2018-05-22 15:29  WindowsFormsApp1\bin\Debug\WindowsFormsApp1.pdb

     文件       1624  2018-05-23 16:11  WindowsFormsApp1\Form1.cs

     文件       2103  2018-05-16 13:05  WindowsFormsApp1\Form1.Designer.cs

     文件       5817  2018-05-16 13:05  WindowsFormsApp1\Form1.resx

     文件       1464  2018-05-16 12:53  WindowsFormsApp1\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7464  2018-05-16 13:29  WindowsFormsApp1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2018-05-15 14:08  WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2018-05-15 14:08  WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2018-05-15 14:08  WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件          0  2018-05-22 15:29  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CopyComplete

     文件         42  2018-05-16 13:08  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache

     文件       1588  2018-05-16 13:09  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.FileListAbsolute.txt

     文件       1012  2018-05-16 13:05  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.GenerateResource.Cache

     文件      12652  2018-05-16 13:04  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csprojResolveAssemblyReference.cache

     文件       9728  2018-05-22 15:29  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe

     文件        180  2018-05-16 13:29  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Form1.resources

     文件      22016  2018-05-22 15:29  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.pdb

     文件        180  2018-05-16 13:29  WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Properties.Resources.resources

     文件        528  2018-05-15 14:08  WindowsFormsApp1\Program.cs

     文件       1348  2018-05-15 14:08  WindowsFormsApp1\Properties\AssemblyInfo.cs

     文件       2845  2018-05-15 14:08  WindowsFormsApp1\Properties\Resources.Designer.cs

............此处省略14个文件信息

评论

共有 条评论