1)IN the line 256 of the file audiotomem.c, what does the function *event_wait* do?
We have the following information:
bufferSize = 1024 byte, each fram containes of one channel and each channel-audio sample- containes of 2 bytes-ML_AUDIO_FORMAT_S16.
2)So with each buffer we can process 512 samples( 1024/2 )(?)
3)the value of ML_AUDIO_SAMPLE_RATE_REAL64 is 44100.0. so in each second, OpenML need to receive almost 86 buffers( 44100.0/512 ) and fill these buffers to do the requested job.(?)
Is these two interpreation true?
[ October 27, 2004: Message edited by: ehsan_kamrani ]
1) event_wait is used to block until "something interesting" happens. In this case, we are waiting on the 'pathWaitHandle' -- this event is triggered when the message queue for the path becomes non-empty. Basically, we are waiting for messages to arrive.
2) in my version of the code, starting at line 164, I have:
/* We will read 1024 samples per buffer, so calculate size of that
* buffer in bytes. This will also be the length passed in for the
* ML_AUDIO_BUFFER_POINTER param.
bufferSize = 1024 * sizeof( short );
So in fact, the buffer is 1024 samples, and is actually 1024*2=2048 bytes (sizeof short is 2).
3) Your understanding is correct, the only difference is that you should be dividing by 1024 rather than 512. So you'll need 44 buffers per second.