转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> VB.NET程序 >> 正文
VB.NET 实现DirectSound9 (5) DS3D2         ★★★★

VB.NET 实现DirectSound9 (5) DS3D2

作者:闵涛 文章来源:闵涛的学习笔记 点击数:2352 更新时间:2009/4/23 19:00:43

关键字: VB .NET  DirectX DirectSound 3D                 作者:董含君

经过一下午的奋战,走了若干弯路,终于可以播放3D声音效果了

感动 ~ ~

大体按照下列的步骤来:

1 关联设备 SetCooperativeLevel
2 设置3D硬件效果  DSoundHelper.Guid3DAlgorithmHrtfFull
3 格式要求 SoundFormat 必须是单声道,不能是立体声
4 主要缓冲区描述
5 创建Listenner
6 辅助缓冲区读取wav
7 创建3D缓冲区
8 播放
9 控制空间位置,以及设置多普勒效应因子,衰减因子
10 停止播放

以下代码注释比较全,顺序比微软的例子简单不少

由于CSDN的Blog不能上传贴图以及RAR,只能帖代码了,有两个Button 一个Picturebox,还有若干Label


==================================================================================

Imports Microsoft.DirectX
Imports Microsoft.DirectX.DirectSound
Imports System.Drawing
Imports System.Drawing.Graphics


Public Class Form1
    Inherits System.Windows.Forms.Form

    Dim Dev As Device                           ''''设备
    Dim Buff As Buffer                          ''''主要缓冲
    Dim SBuff As SecondaryBuffer                ''''二级缓冲
    Dim Buff3D As Buffer3D                      ''''3D缓冲
    Dim descBuff As BufferDescription           ''''缓冲区描述
    Dim Buff3DSet As Buffer3DSettings           ''''3D缓冲设置
    Dim Listenner As Listener3D                 ''''听众
    Dim ListennerSet As Listener3DSettings      ''''听众设置
    Dim Pic As Graphics
    Dim BMP As Bitmap
    Const FN = "g:\media\wav\rod2m.wav"         ''''要播放的文件,必须是单声道
#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        ''''该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        ''''在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    ''''窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    ''''Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    ''''注意: 以下过程是 Windows 窗体设计器所必需的
    ''''可以使用 Windows 窗体设计器修改此过程。
    ''''不要使用代码编辑器修改它。
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.TextBox2 = New System.Windows.Forms.TextBox
        Me.TextBox3 = New System.Windows.Forms.TextBox
        Me.TextBox4 = New System.Windows.Forms.TextBox
        Me.Label5 = New System.Windows.Forms.Label
        Me.TextBox5 = New System.Windows.Forms.TextBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.SuspendLayout()
        ''''
        ''''Button1
        ''''
        Me.Button1.Location = New System.Drawing.Point(24, 8)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(88, 32)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "初始化"
        ''''
        ''''Button2
        ''''
        Me.Button2.Location = New System.Drawing.Point(24, 48)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(88, 32)
        Me.Button2.TabIndex = 1
        Me.Button2.Text = "播放"
        ''''
        ''''PictureBox1
        ''''
        Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.PictureBox1.Location = New System.Drawing.Point(152, 48)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(552, 432)
        Me.PictureBox1.TabIndex = 2
        Me.PictureBox1.TabStop = False
        ''''
        ''''Label1
        ''''
        Me.Label1.Location = New System.Drawing.Point(8, 104)
        Me.Label1.Name = "Label1"
        Me.Label1.TabIndex = 3
        Me.Label1.Text = "多普勒效应0~10"
        ''''
        ''''Label2
        ''''
        Me.Label2.Location = New System.Drawing.Point(8, 160)
        Me.Label2.Name = "Label2"
        Me.Label2.TabIndex = 4
        Me.Label2.Text = "衰减因子 0~10"
        ''''
        ''''Label3
        ''''
        Me.Label3.Location = New System.Drawing.Point(8, 216)
        Me.Label3.Name = "Label3"
        Me.Label3.TabIndex = 5
        Me.Label3.Text = "最大距离 0~100"
        ''''
        ''''Label4
        ''''
        Me.Label4.Location = New System.Drawing.Point(8, 272)
        Me.Label4.Name = "Label4"
        Me.Label4.TabIndex = 6
        Me.Label4.Text = "最小距离

[1] [2] [3]  下一页


[Web开发]VS2005+SQL2005之.NET2.0数据库连接  [常用软件]公共场所慎用Foxmail5 以防泄露隐私
[VB.NET程序]定制VB.NET控件编程之拦截击键动作  [VB.NET程序]VB.NET VS C#.
[VB.NET程序]VB.NET 中调用浏览目录对话框  [VB.NET程序]VB.NET and C# 语法比较手册
[VB.NET程序]VB.NET 拖动无边框的窗体  [VB.NET程序]C# to VB.NET 翻译器
[VB.NET程序]101 VB.NET Applications 读书笔记(1)  [VB.NET程序]vb.net 程序设计规范(1)
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台