日期:2012-12-30  浏览次数:20414 次


研究了xaudio的sdk包,发现vb6能很方便的调用它,所以写了这个例程,只使用了xaudio.dll的一部分函数,同理可以使用其它的。调用dsound控制发声。

以下代码,原c代码部分保留用以对照。



frmMain.frm

VERSION 5.00
Begin VB.Form frmMain
   Caption         =   "Form1"
   ClientHeight    =   3675
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3675
   ScaleWidth      =   4680
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdGetInfo
      Caption         =   "GetInfo"
      Height          =   495
      Left            =   360
      TabIndex        =   5
      Top             =   3060
      Width           =   1215
   End
   Begin VB.CommandButton cmdGetTag
      Caption         =   "GetTag"
      Height          =   495
      Left            =   1740
      TabIndex        =   4
      Top             =   3060
      Width           =   1215
   End
   Begin VB.CommandButton cmdEnum
      Caption         =   "Enum"
      Height          =   495
      Left            =   3120
      TabIndex        =   3
      Top             =   2400
      Width           =   1215
   End
   Begin VB.CommandButton cmdPlay
      Caption         =   "Play"
      Height          =   495
      Left            =   1740
      TabIndex        =   2
      Top             =   2400
      Width           =   1215