DxMidi - Receiving events | ||||||||||||
|
When you connect the INPUT port
of the Midi control, and valid the patch connection, you are declared able
to receive datas and the Midi In port of the control is keeping the datas
in the limits of its reserved memory (32k). When the memory is out, an automatic
procedure deletes the oldest datas and creates place for new ones. We encourage
you to read all packets when the connection is active, make periodic tasks
to the routine ReceiveDatas() or Flush(),
either, you are about to lose time processing with read data you dont
care at all ! On the other hand, if you want to receive Sysex datas for storage, you require no missing datas, because when receiving big flows of data, your Realbasic application get too much time to read the incoming datas (and analyze them), and you will lose important bytes. To prevent yourself from this kind of critical problem, take control of your user behaviour and get the datas only at end of reception, when you are sure that all datas are in the 32k buffer. Err = me.Flush () Err as Boolean By this command, you clear the data queue created for reception. This method could be called in an temporary idle for reading and loosing datas. Dont call this when you are not sure if notes are playing, because there will be times when you want to stop the notes on your Midi device. Err returns an error "False" if the flush failed. result = me.IsDatas () result as Integer Tests if datas are incoming to the plugin driver queue. result returns the length of the first data available in the queue. If result = 0, then no data is available. NOTE : Buffer can be full if you dont read infos in the queue. In these cases, the auto-clear procedure is actived and you will lose datas ! myString = me.ReceiveData () myString as String Use this method after IsDatas() to load datas into myString. for larger datas (eg. SysEx or controls), read the «info» property sent. Keep in mind that the packet is cleared from the data queue after this command (but you let some place to following packets). Err = DxMidiDataFilter ( SysExFlag, ControlFlag, NoteFlag ) Err as Boolean SysExFlag as Boolean ControlFlag as Boolean NoteFlag as Boolean This is the read filter function. Use this when you dont want to receive types of datas. |