Winapi: midiinaddbuffer-sends an input buffer to the MIDI input device

Source: Internet
Author: User
Tip:
Return the application when the buffer is full Program ;
The input buffer is only used for mutually exclusive messages;

Before the buffer is transmitted to midiinaddbuffer, call midiinprepareheader preparation and globalalloc to allocate memory to the tmidihdr and the buffer directed by lpdata (gmem_moveable and gmem_share are used) and use globallock to lock the buffer.

 // Declaration: midiinaddbuffer (hmidiin: hmidiin; {input device handle} lpmidiinhdr: pmidihdr; {tmidihdr structure pointer} usize: uint {size of the tmidihdr structure}): mmresult; {0 is returned successfully; possible error values:} mmsyserr_invalhandle = 5; {the device handle is invalid} midierr_unprepared = 64; {No buffer prepared} // tmidihdr is the redefinition of the midihdr_tag structure: midihdr_tag = record lpdata: pchar; {pointer to the dedicated buffer} dwbufferlength: DWORD; {specify the buffer length} dwbytesrecorded: DWORD; {specify the data volume in the buffer during input} dwuser: DWORD; {specify user data} dwflags: DWORD; {specify the buffer information flag} lpnext: pmidihdr; {reserved (to device)} Reserved: DWORD; {reserved (to device)} dwoffset: DWORD; {buffer offset at callback start} dwreserved: array [0 .. 7] of DWORD; {reserved (to the system)} end; // optional value of dwflags: mhdr_done = $00000001; {the device has returned the buffer to the program} mhdr_prepared = $00000002; {buffer has been prepared for midiinprepareheader or midioutprepareheader} mhdr_inqueue = $00000004; {reserved (to the device)} mhdr_isstrm = $00000008; {stream buffer}

   // example:

   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.