我在visual c++上做midi文件的播放,要用midi函数,求助midiStreamOut函数第二个参数LPMIDIHDR lpMidiHdr, 要怎么获取。
2 回答
aluckdog
TA贡献1847条经验 获得超7个赞
自己定一个变量。
MIDIHDR midiHdr;
midiOutPrepareHeader(handle, &midiHdr, sizeof(MIDIHDR));
midiStreamOut(handle, &midiHdr, sizeof(MIDIHDR));
弑天下
TA贡献1818条经验 获得超8个赞
那是MIDI文件里的数据了,你需要分析MIDI文件结构,读出它的数据,把数据缓冲区赋给lpData。有个例子是自己写数据的: unsigned long Phrase[] = {0, 0, ((unsigned long)MEVT_LONGMSG<<24) | 8, 0x047F7FF0, 0xF77F7F01, 0, 0, ((unsigned long)MEVT_TEMPO<<24) | 0x0007A120, 0, 0, 0x007F3C90, 48, 0, 0x00003C90, 0, 0, 0x007F3C90, 48, 0, 0x00003C90, 0, 0, 0x007F4390, 48, 0, 0x00004390, 0, 0, 0x007F4390, 48, 0, 0x00004390, 0, 0, 0x007F4590, 48, 0, 0x00004590, 0, 0, 0x007F4590, 48, 0, 0x00004590, 0, 0, 0x007F4390, 86, 0, 0x00004390, 10, 0, 0x007F4190, 48, 0, 0x00004190, 0, 0, 0x007F4190, 48, 0, 0x00004190, 0, 0, 0x007F4090, 48, 0, 0x00004090, 0, 0, 0x007F4090, 48, 0, 0x00004090, 0, 0, 0x007F3E90, 48, 0, 0x00003E90, 0, 0, 0x007F3E90, 48, 0, 0x00003E90, 0, 0, 0x007F3C90, 96, 0, 0x00003C90}; midiHdr.lpData = (LPBYTE)&Phrase[0]; midiHdr.dwBufferLength = midiHdr.dwBytesRecorded = sizeof(Phrase); midiHdr.dwFlags = 0;
- 2 回答
- 0 关注
- 94 浏览
添加回答
举报
0/150
提交
取消