## IMemoryData Interface

The IMemoryData interface contains methods that set and retrieve memory data on audio data objects. Audio data objects provide the underlying data which stream samples access. This interface provides a way to initialize memory buffers and to set actual amounts of audio data in the objects. Additionally, the GetInfo method can be used to retrieve audio memory data.

When to Implement

Implement this interface on underlying audio data objects that audio stream sample objects will access.

When to Use

Typically these methods are called by the IAudioMediaStream or IAudioStreamSample object, rather than by the application.

Methods in Vtable Order

IUnknown methods | Description
QueryInterface | Retrieves pointers to supported interfaces.
AddRef | Increments the reference count.
Release | Decrements the reference count.

IMemoryData methods | Description
SetBuffer | Initializes a memory buffer with a pointer to memory and length.
GetInfo | Retrieves information describing an audio data object.
SetActual | Sets the amount of audio data currently in the object, in bytes.

###

IMemoryData::GetInfo

IMemoryData Interface

Retrieves information describing an audio data object.

HRESULT GetInfo(
DWORD *pdwLength,
BYTE **ppbData,
DWORD *pcbActualData );

##### Parameters

pdwLength
  [out] Length of memory in bytes, if non-NULL.
ppbData
  [out] Pointer to the memory, if non-NULL.
pcbActualData
  [out] Length of data in bytes, if non-NULL.

##### Return Values

Returns S_OK if successful.

##### Remarks

This method determines how much data is actually in the object at the moment as last set by SetActual.

###

IMemoryData::SetActual

IMemoryData Interface

Sets the amount of audio data currently in the object.

HRESULT SetActual(
DWORD cbDataValid
);

##### Parameters

cbDataValid
  [in] Amount of data, in bytes.

##### Return Values

Returns S_OK if successful or E_POINTER if the required parameter is NULL.

##### Remarks

This method is usually called by the IAudioMediaStream or IAudioStreamSample object, rather than by the application.

###

IMemoryData::SetBuffer

IMemoryData Interface

Initializes a memory buffer with a pointer to memory and length.

HRESULT SetBuffer(
DWORD cbSize,
BYTE *pbData,
DWORD dwFlags );

##### Parameters

cbSize
  [in] Size of memory pointed to by pbData, in bytes.
pbData
  [in] Pointer to memory that this object will use.
dwFlags
  [in] Reserved for flag data. Must be zero.

##### Return Values

Returns S_OK if successful or E_INVALIDARG if cbSize is zero or pbData is NULL.

##### Remarks

This method can be called more than once.

Do not call this method when the IStreamSample::Update method is processing a sample.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.