/* ============================================================================= buffer handling ============================================================================= */ static MIDIHDR *allocate_buffer(long data_size) { LPMIDIHDR hdr = (LPMIDIHDR) pm_alloc(MIDIHDR_SYSEX_SIZE(data_size)); MIDIEVENT *evt; if (!hdr) return NULL; evt = (MIDIEVENT *) (hdr + 1); /* place MIDIEVENT after header */ hdr->lpData = (LPSTR) evt; hdr->dwBufferLength = MIDIHDR_SYSEX_BUFFER_LENGTH(data_size); hdr->dwBytesRecorded = 0; hdr->dwFlags = 0; hdr->dwUser = hdr->dwBufferLength; return hdr; }
static MIDIHDR *allocate_sysex_buffer(long data_size) { /* we're actually allocating more than data_size because the buffer * will include the MIDIEVENT header in addition to the data */ LPMIDIHDR hdr = (LPMIDIHDR) pm_alloc(MIDIHDR_SYSEX_SIZE(data_size)); MIDIEVENT *evt; if (!hdr) return NULL; evt = (MIDIEVENT *) (hdr + 1); /* place MIDIEVENT after header */ hdr->lpData = (LPSTR) evt; hdr->dwFlags = 0; hdr->dwUser = 0; return hdr; }