[Prev][Next][Index][Thread]

Re: Here's a midi question for you....



"selena" <smd7@cs.waikato.ac.nz> writes:

> Thanks for the pointer-cast tip, I'd been using c-type-cast(<LPSTR>,
> event); (although I think this has the same effect) and thought it
> was this causing the problem but with pointer-cast, I'm still
> getting the same error so perhaps it's something else.....

c-type-cast is similar to pointer-cast except it can be used in more
situations. pointer-cast will only convert from one pointer type to
another. c-type-cast can convert other c types as well (for example, a
long to a pointer, etc).

> I get an error when calling midiStreamOut after this :
> 
>  result := midiOutPrepareHeader(outHandle, LPmidiheader,
> size-of(<MIDIHDR>));
>  result := midiStreamOut(outHandle, LPmidiheader, size-of(<MIDIHDR>));
> 
> result stores the error value 11 giving the message (in
> midiOutGetErrorText) 'An invalid parameter was passed to a system
> function'

I've had similar problems when using API calls with structures without
clearing out the structure to zero first. Try using clear-memory!
after creating the structures:

  let event = make(<LPMIDIEVENT>);
  clear-memory!(event, size-of(<MIDIEVENT>));
  let header = make(<LPMIDIHDR>);
  clear-memory!(header, size-of(<MIDIHDR>));

I think this is likely to be the problem if you haven't already
explicity set each element of the structure to a valid value (like
0).

Chris.
-- 
http://www.double.co.nz/dylan

  



References: