🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
3 messages
3 total messages Started by George Mitchell Sat, 26 Jul 2003 21:36
Closing a MIDI device
#564
Author: George Mitchell
Date: Sat, 26 Jul 2003 21:36
29 lines
1822 bytes
I've got a program that uses the midi multimedia functions to 
communicate with external MIDI instruments. I can open a device
and receive data, but I can't close the device when I'm done.
My first code looked like:

	midiInStop(hMidiIn);
	midiInUnprepareHeader(...);
	midiInClose(hMidiIn);

When I called midiInClose() I got a MIDIERR_STILLPLAYING return
code. A bit of research in the help files revealed that any
input buffers added to the device would cause this return error,
so I modified my code to:

	midiInStop(hMidiIn);
	midiInReset(hMidiIn);

		... wait for my 3 buffers to be returned

	midiInClose(hMidiIn);

If I step through the code, all my buffers are returned, but now
when I call midiInClose() it never returns, and I have to reset
the program. Anyone got any ideas what is going wrong?

Thanks in advance

George
Re: Closing a MIDI device
#565
Author: Maynard Philbrook
Date: Sun, 27 Jul 2003 03:43
39 lines
2278 bytes
Try to use the Disconnect.


George Mitchell wrote:

> I've got a program that uses the midi multimedia functions to
> communicate with external MIDI instruments. I can open a device
> and receive data, but I can't close the device when I'm done.
> My first code looked like:
>
>         midiInStop(hMidiIn);
>         midiInUnprepareHeader(...);
>         midiInClose(hMidiIn);
>
> When I called midiInClose() I got a MIDIERR_STILLPLAYING return
> code. A bit of research in the help files revealed that any
> input buffers added to the device would cause this return error,
> so I modified my code to:
>
>         midiInStop(hMidiIn);
>         midiInReset(hMidiIn);
>
>                 ... wait for my 3 buffers to be returned
>
>         midiInClose(hMidiIn);
>
> If I step through the code, all my buffers are returned, but now
> when I call midiInClose() it never returns, and I have to reset
> the program. Anyone got any ideas what is going wrong?
>
> Thanks in advance
>
> George

--
To See what real programmers do in their spare time visit
http://jamie12.home.mindspring.com
home of PC bit software ..
    Please send comments about my work .
Re: Closing a MIDI device
#566
Author: Ted Lyngmo
Date: Thu, 31 Jul 2003 09:28
15 lines
1506 bytes
George Mitchell wrote:
 >
 > If I step through the code, all my buffers are returned, but now
 > when I call midiInClose() it never returns, and I have to reset
 > the program. Anyone got any ideas what is going wrong?

Please post more of your code. Are you using a callback function? You are not 
calling midiInClose() in that, are you?

Kind regards,
Ted Lyngmo

-- 
Replace MY_FIRST_NAME in my email address with my first name to send a private
email to me.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads