游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2006|回复: 3

API系列:一些有关MIDI的API实例

[复制链接]

187

主题

6490

帖子

6491

积分

论坛元老

团长

Rank: 8Rank: 8

积分
6491
发表于 2006-9-28 17:55:00 | 显示全部楼层 |阅读模式
用到的函数有:
Declare Function midiOutClose Lib "winmm.dll" (ByVal hMidiOut As Long) As Long

Declare Function midiOutGetDevCaps Lib "winmm.dll" Alias "midiOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As MIDIOUTCAPS, ByVal uSize As Long) As Long

Declare Function midiOutGetNumDevs Lib "winmm" Alias "midiOutGetNumDevs" () As Integer

Declare Function midiOutOpen Lib "winmm.dll" (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long

Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long

187

主题

6490

帖子

6491

积分

论坛元老

团长

Rank: 8Rank: 8

积分
6491
 楼主| 发表于 2006-9-28 17:55:00 | 显示全部楼层

Play Note

Private Declare Function midiOutClose Lib "winmm.dll" (ByVal hMidiOut As Long) As Long
Private Declare Function midiOutOpen Lib "winmm.dll" (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Private Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long
Dim hMidiOut As Long
Private Sub Form_Load()
    Dim T As Long
    midiOutOpen hMidiOut, 0, 0, 0, 0
    midiOutShortMsg hMidiOut, 6567325
    T = Timer
    Do:  DoEvents: Loop Until Timer > T + 4
    midiOutClose hMidiOut
End Sub

187

主题

6490

帖子

6491

积分

论坛元老

团长

Rank: 8Rank: 8

积分
6491
 楼主| 发表于 2006-9-28 17:56:00 | 显示全部楼层

midiOut

Const MAXPNAMELEN = 32
Private Type MIDIOUTCAPS
    wMid As Integer
    wPid As Integer
    vDriverVersion As Long
    szPname As String * MAXPNAMELEN
    wTechnology As Integer
    wVoices As Integer
    wNotes As Integer
    wChannelMask As Integer
    dwSupport As Long
End Type
Private Declare Function midiOutGetDevCaps Lib "winmm.dll" Alias "midiOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As MIDIOUTCAPS, ByVal uSize As Long) As Long
Private Declare Function midiOutGetNumDevs Lib "winmm" () As Integer
Private Sub Form_Paint()
    Dim MidiCaps As MIDIOUTCAPS, Cnt As Long
    'Clear the form
    Me.Cls
    'Get the number of installed MIDI devices
    Me.Print "Available midi devices:" + Str$(midiOutGetNumDevs)
    For Cnt = 0 To midiOutGetNumDevs - 1
        'Get the device name and capabilities
        midiOutGetDevCaps Cnt, MidiCaps, Len(MidiCaps)
        Me.Print "Device name" + Str$(Cnt + 1) + ": " + MidiCaps.szPname
    Next Cnt
End Sub

187

主题

6490

帖子

6491

积分

论坛元老

团长

Rank: 8Rank: 8

积分
6491
 楼主| 发表于 2006-9-28 17:57:00 | 显示全部楼层

Re:API系列:一些有关MIDI的API实例

就是这些。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-25 12:43

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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