BASS.NET API for the Un4seen BASS Audio LibraryBassEncBASS_Encode_AddChunk Method (Int32, String, Byte, Int32)BASS.NET API for the Un4seen BASS Audio Library
Sends a RIFF chunk to an encoder.

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

[DllImportAttribute("bassenc.dll", CharSet = CharSet.Auto)]
public static bool BASS_Encode_AddChunk(
	int handle,
	string id,
	byte[] buffer,
	int length
)

Parameters

handle
Type: SystemInt32
The encoder handle... a HENCODE.
id
Type: SystemString
The 4 character chunk id (e.g. 'bext').
buffer
Type: SystemByte
The buffer containing the chunk data (without the id).
length
Type: SystemInt32
The number of bytes in the buffer.

Return Value

Type: Boolean
If successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

BASSenc writes the minimum chunks required of a WAV file: "fmt" and "data", and "ds64" and "fact" when appropriate. This function can be used to add other chunks. For example, a BWF "bext" chunk or "INFO" tags.

Chunks can only be added prior to sample data being sent to the encoder. The BASS_ENCODE_PAUSE flag can be used when starting the encoder to ensure that no sample data is sent before additional chunks have been set.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILNo RIFF headers/chunks are being sent to the encoder (due to the BASS_ENCODE_NOHEAD flag being in effect), or sample data encoding has started.
BASS_ERROR_ENDEDThe encoder has died.

Examples

Adding a BEXT chunk:
BASS_TAG_BEXT bext = new BASS_TAG_BEXT();
... set the bext member here
string codingHistory = "...";
byte[] bextData = bext.AsByteArray(codingHistory);
bool ok = BassEnc.BASS_Encode_AddChunk(handle, "bext", bextData, bextData.Length);
See Also

Reference