如何在 winmm 的 qb64 中正确声明此函数?我正在使用这段代码,它一直给我错误 2。有人知道我做错了什么吗?我正在使用 Windows 7 和 qb64。
TYPE WAVEFORMAT
wFormatTag AS INTEGER
nChannels AS INTEGER
nSamplesPerSec AS LONG
nAvgBytesPerSec AS LONG
nBlockAlign AS INTEGER
wBitsPerSample AS INTEGER
cbSize AS INTEGER
END TYPE
DECLARE DYNAMIC LIBRARY "WINMM"
FUNCTION waveInOpen& ALIAS "waveInOpen" (lphWaveIn AS INTEGER, uDeviceID AS INTEGER, lpFormat AS WAVEFORMAT, dwCallback AS INTEGER, dwInstance AS INTEGER, dwFlags AS INTEGER)
END DECLARE
DIM WAVE_FORMAT_PCM AS INTEGER
DIM CALLBACK_NULL AS INTEGER
DIM DevHandleID AS INTEGER
DIM DevHandle AS INTEGER
DevHandleID = 1
WAVE_FORMAT_PCM = 1
CALLBACK_NULL = 0
DIM SHARED InwaveFormat AS WAVEFORMAT
waveFormat.wFormatTag = WAVE_FORMAT_PCM
waveFormat.nChannels = 2
waveFormat.nSamplesPerSec = 44100
waveFormat.nAvgBytesPerSec = 44100 * 4
waveFormat.nBlockAlign = 4
waveFormat.wBitsPerSample = 16
waveFormat.cbSize = 0
c = waveInOpen(DevHandle, DevHandleID, InwaveFormat, 0, 0, CALLBACK_NULL)
PRINT c