游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1389|回复: 1

为何我的代码播放不了MID?

[复制链接]

22

主题

30

帖子

32

积分

注册会员

Rank: 2

积分
32
发表于 2004-11-1 14:44:00 | 显示全部楼层 |阅读模式
如下:
Private Dx As New DirectX7

Private Ds As DirectSound
Private Dm As DirectMusicPerformance
Private Dl As DirectMusicLoader
Private DmSegment As DirectMusicSegment

Private w As WAVEFORMATEX

Private Sub Command1_Click()
  Set Ds = Dx.DirectSoundCreate(vbNullString)
  Ds.SetCooperativeLevel Me.hWnd, DSSCL_PRIORITY
   
  Set Dm = Dx.DirectMusicPerformanceCreate
  Dm.Init Ds, Me.hWnd
  Dm.SetPort 0, 0
  
  Set Dl = Dx.DirectMusicLoaderCreate
  Set DmSegment = Dl.LoadSegment("C:\back1.mid")
  Dm.PlaySegment DmSegment, 0, 0
End Sub

多谢了。
[em5]

9

主题

106

帖子

106

积分

注册会员

Rank: 2

积分
106
QQ
发表于 2004-11-1 21:28:00 | 显示全部楼层

Re:为何我的代码播放不了MID?

Dm.SetPort 0, 0这个好象不对,端口不可以为零(我用列举时,用0出错,从1开始才对)!如果使用默认端口,是-1。后面的通道组也好象不可以是零,是零的话,那不是无通道吗?至少是1吧?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-23 02:11

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表