Re: Re: [madplay]:audio_win32.c::struct buffer.event_handle: Can not find the time that sets the event object to the signaled state (Rob Leslie)

cnmmd <[email protected]> Sat, 20 Aug 2005 09:04:04 +0800
Newsgroups gmane.comp.audio.mad.devel
Message-ID <[email protected]>
1'st

Init()
{
...
	  output[i].event_handle = CreateEvent(0, FALSE /* manual reset */,
		  FALSE /* initial state */, 0);
		----->the event object initial state is FALSE,--nonsignaled.
..
}
After this ,the event_handle is nonsignaled state.
                                 ~~~~~~~~~~~~



but in function:

int wait(struct buffer *buffer)
{
    MMRESULT error;
    DWORD tick;

    if (!buffer->playing)
      return 0;

    switch (WaitForSingleObject(buffer->event_handle, INFINITE)) { ..
}

why the event_handle is signaled state?


I only find this time to setevent:
void CALLBACK callback(HWAVEOUT handle, UINT message, DWORD data,
		       DWORD param1, DWORD param2)
{
    WAVEHDR *header;
    struct buffer *buffer;

    switch (message) {
    case WOM_DONE:
      header = (WAVEHDR *) param1;
      buffer = (struct buffer *) header->dwUser;
      if (SetEvent(buffer->event_handle) == 0) {
	...
	}
    case WOM_OPEN:
    case WOM_CLOSE:
	----->	nothing to do in this.
       break;
}

------------------------------

Message: 2
Date: Fri, 19 Aug 2005 11:39:24 -0700
From: Rob Leslie <[email protected]>
Subject: Re: [mad-dev] [madplay]:audio_win32.c::struct
	buffer.event_handle:	Can not find the time that sets the event object
	to the signaled state
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

On Aug 18, 2005, at 10:26 PM, cnmmd wrote:
> why the event_handle is signaled state?
>
> I only find this time to setevent:
> void CALLBACK callback(HWAVEOUT handle, UINT message, DWORD data,
>                DWORD param1, DWORD param2)
> {
>   WAVEHDR *header;
>   struct buffer *buffer;
>
>   switch (message) {
>   case WOM_DONE:
>     header = (WAVEHDR *) param1;
>     buffer = (struct buffer *) header->dwUser;
>     if (SetEvent(buffer->event_handle) == 0) {
>
> ...
> }

That's it. This callback routine is passed to waveOutOpen(), which
allows it to be called asynchronously after each data block sent via
waveOutWrite() has finished playing.


-------->yes, This callback routine will to be called  after each data  
block sent via

[waveOutWrite()] has finished playing. but after waveOutOpen(),the  
callback do nothing.the event object is nonsignaled also.

-- 
Rob Leslie
[email protected]



End of mad-dev Digest, Vol 3, Issue 5
*************************************

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/