Buffer notifications – Measurement Computing ADLIB WIN User Manual

Page 27

Advertising
background image

Chapter 6 Memory Buffer Allocation

6-3

DWORD

dwBufferType;

/* Data Buffer type. */

DWORD

dwBufferSize;

/* Size of each buffer in bytes. */

DWORD

dwBufferWrite;

/* Number of data samples in the buffer. */

DWORD

dwBufferRead;

/* Number of data samples obtained from the buffer. */

DWORD

dwTrigPoint;

/* App linear address of the trigger point. */

DWORD

dwTrigPointStart;

/* App linear starting address of the */

/*

pre-trigger

data.

*/

DWORD

dwDoneFlag;

/* Buffer complete flag */

DWORD

dwStatusFlags;

/* Current status */

long

lErrorFlags;

/* Buffer errors */


DWORD

dwBuffNum;

/* Buffer number ID */

}DATABUFFSTAT;
typedef DATABUFFSTAT FAR * LPDATABUFFSTATUS;

Visual Basic for Windows adlib.bas file

Type DATABUFFSTATUS

lBufferType As Long ' Data Buffer type.

lBufferSize As Long ' Size of each buffer in bytes.

lBufferWrite As Long ' Number of data samples in the buffer.
lBufferRead As Long ' Number of data samples obtained from the buffer.

lTrigPoint As Long ' App buffer position number of the trigger point.
lTrigPointStart As Long ' App buffer position number of the pre-trigger data.

lDoneFlag As Long ' Buffer complete flag
lStatusFlags As Long ' Current status
lErrorFlags As Long ' Buffer errors

lBuffNum As Long ' Buffer number ID
End Type

6.4 BUFFER NOTIFICATIONS

6.4.1 C\C++

The user application has three choices of obtaining a pointer to a buffer that has been completed
(BUFFER_DONE).

1. The first method involves calling the ADLIB function AL_GetDoneBuffPtr(LHLD), which will return

a pointer to the next completed buffer when available, otherwise this function returns NULL.

2. The second method uses Windows Post-message handler routine installed by the user application.

Each time a buffer is completed the user routine will be called, passing a pointer to the buffer in the
1Param parameter. See example program adlai01.

Example:

Advertising