Results 1 to 2 of 2

Thread: Audiotomem.dsw

  1. #1

    Audiotomem.dsw

    Hi Fabrice
    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?

    thanks

    [ October 27, 2004: Message edited by: ehsan_kamrani ]

  2. #2
    Member
    Join Date
    Jul 2003
    Location
    Montreal
    Posts
    75

    Re: Audiotomem.dsw

    Hi Ehsan,

    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.

Similar Threads

  1. memtoaudio.dsw
    By ehsan2004 in forum OpenML Coding & Technical Issues
    Replies: 6
    Last Post: 10-30-2004, 05:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •