我尝试使用MIDI事件BASS.NET创建和播放,但它播放不正常(没声音),想要帮助,谢谢你们! [来自Google的翻译]
public void build_MIDI() {
BASS_MIDI_EVENT[] events ={
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_TEMPO, 500000, 0, 0,0),
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_PROGRAM, 1, 0, 0,0),
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_NOTE, 60, 100, 0,0),
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_END, 0, 0, 0,0),
};
int build_play_midi_steam = BassMidi.BASS_MIDI_StreamCreateEvents(events,96, BASSFlag.BASS_SAMPLE_LOOP, 0);
Bass.BASS_ChannelPlay(build_play_midi_steam, false);
}
答案 0 :(得分:1)
我已经解决了这个问题,代码演示了在steamEvent中播放的两个音符。如果你想获得有关API推荐阅读的更多信息
public void build_MIDI()
{
BASS_MIDI_EVENT[] events ={
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_TEMPO, 500000, 0, 0,0),
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_PROGRAM, 0, 0, 0,0),
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_NOTE, MAKEWORD(91,100), 0, 0 ,0),
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_NOTE, MAKEWORD(60,100), 0, 0 ,0),
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_NOTE, 91, 0, 48,0 ),
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_NOTE, 60, 0, 96,0 ),
new BASS_MIDI_EVENT(BASSMIDIEvent.MIDI_EVENT_END, 0, 0, 2000,0),
};
int build_play_midi_steam = BassMidi.BASS_MIDI_StreamCreateEvents(events,100, BASSFlag.BASS_MIDI_DECAYEND | BASSFlag.BASS_MIDI_DECAYSEEK | BASSFlag.BASS_MIDI_NOFX, 1);
Bass.BASS_ChannelPlay(build_play_midi_steam, false);
}
ushort MAKEWORD(byte a, byte b)
{
return (ushort)(a | (b << 8));
}