BASS.NET API for the Un4seen BASS Audio LibraryBassWasapiBASS_WASAPI_PutData Method (IntPtr, Int32)BASS.NET API for the Un4seen BASS Audio Library
Adds sample data to an output device buffer ("push" device).

Namespace: Un4seen.BassWasapi
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

[DllImportAttribute("basswasapi.dll", CharSet = CharSet.Auto)]
public static int BASS_WASAPI_PutData(
	IntPtr buffer,
	int length
)

Parameters

buffer
Type: SystemIntPtr
The pointer to the sample data to provide.
length
Type: SystemInt32
The amount of data in bytes! (buffer.Length/4). BASS_WASAPI_GetData(IntPtr, Int32) with the BASS_DATA_AVAILABLE flag can be used to check how much data is queued.

Return Value

Type: Int32
If successful, the the amount of data copied from the provided buffer will be returned (which may be less than requested if it doesn't all fit in the device buffer, see the BASS_WASAPI_INFO "buflen" property), else -1 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

You must have initialized the device via BASS_WASAPI_Init(Int32, Int32, Int32, BASSWASAPIInit, Single, Single, WASAPIPROC, IntPtr) using for the WASAPIPROC.

As much data as possible will be placed in the device's buffer; this function will have to be called again for any remainder.

Data should be provided at a rate sufficent to sustain playback. If the buffer gets exhausted, ouput will stall until more data is provided. BASS_WASAPI_GetData(IntPtr, Int32) (BASS_DATA_AVAILABLE) can be used to check how much data is buffered.

ERROR CODEDescription
BASS_ERROR_INITBASS_WASAPI_Init(Int32, Int32, Int32, BASSWASAPIInit, Single, Single, WASAPIPROC, IntPtr) has not been successfully called.
BASS_ERROR_NOTAVAILThe device is being fed by a WASAPIPROC callback function, or it is an input device.
BASS_ERROR_ILLPARAMlength is not valid, it must equate to a whole number of samples.
BASS_ERROR_UNKNOWNSome other mystery problem!

See Also

Reference