BASS.NET API for the Un4seen BASS Audio LibraryBassEncBASS_Encode_GetACMFormat Method (Int32, String, BASSACMFormat, WAVEFormatTag)BASS.NET API for the Un4seen BASS Audio Library
Presents the user with a list of available ACM (Audio Compression Manager) codec output formats to choose from.

This overload returns the generic codec format ACMFORMAT and handles all the rest already for you.

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

public static ACMFORMAT BASS_Encode_GetACMFormat(
	int handle,
	string title,
	BASSACMFormat flags,
	WAVEFormatTag format
)

Parameters

handle
Type: SystemInt32
The channel handle... a HSTREAM, HMUSIC, or HRECORD.
title
Type: SystemString
Window title for the selector... = "Choose the output format".
flags
Type: Un4seen.Bass.AddOn.EncBASSACMFormat
A combination of these flags BASSACMFormat:
BASS_ACM_DEFAULTUse the format buffer (form) contents as the default choice in the codec selector.
BASS_ACM_RATEOnly include formats with the same sample rate as the source.
BASS_ACM_CHANSOnly include formats with the same number of channels (mono/stereo) as the source.
BASS_ACM_SUGGESTSuggest a format without letting the user choose. The wanted format tag (eg. WAVE_FORMAT_ADPCM) should be specified in the HIWORD.
The HighWord - use MakeLong(Int16, Int16)(flags,format) - can be used to restrict the choice to a particular format tag (eg. WAVE_FORMAT_ADPCM). This is required with BASS_ACM_SUGGEST, and is optional otherwise. See WAVEFormatTag for a list of typical formats being used.
format
Type: Un4seen.BassWAVEFormatTag
The wanted codec format (use one of the WAVEFormatTag flags, or see the MMREG.H file for more).

Return Value

Type: ACMFORMAT
If successful, an instance of the generic codec format ACMFORMAT is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

This function presents the user with a list of available ACM codecs to choose from, given the sample format of the channel. The details of the chosen codec's output are returned as a generic codec format ACMFORMAT, which can then be used with BASS_Encode_StartACM(Int32, ACMFORMAT, BASSEncode, ENCODEPROC, IntPtr) or BASS_Encode_StartACMFile(Int32, IntPtr, BASSEncode, String) to begin encoding.

If writing the encoder output to a WAVE file, the codec format's WAVEFORMATEX contents would be the format chunk ("fmt") of the file.

To not let the user choose a codec, but automatically suggest a codec you might also use the BASS_Encode_GetACMFormatSuggest(Int32, BASSACMFormat, WAVEFormatTag) method.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILThere are no codecs available that will accept the channel's format.
BASS_ERROR_ACM_CANCELThe user pressed the "cancel" button.
BASS_ERROR_UNKNOWNSome other mystery problem!

Examples

Let the user choose a codec, and setup an encoder on a channel using the chosen codec:
VB
Dim codec As ACMFORMAT = BassEnc.BASS_Encode_GetACMFormat(channel, "Select your encoder", 
                                 BASSACMFormat.BASS_ACM_DEFAULT, 
                                 WAVEFormatTag.UNKNOWN)
If Not (codec Is Nothing) Then
  ' begin encoding using the codec
  BassEnc.BASS_Encode_StartACMFile(channel, codec, BASSEncode.BASS_ENCODE_DEFAULT, "acm.wav")
End If
ACMFORMAT codec = BassEnc.BASS_Encode_GetACMFormat(channel, "Select your encoder", 
                          BASSACMFormat.BASS_ACM_DEFAULT, 
                          WAVEFormatTag.UNKNOWN);
if ( codec != null )
{
    // begin encoding using the codec
    BassEnc.BASS_Encode_StartACMFile( channel, codec, BASSEncode.BASS_ENCODE_DEFAULT, "acm.wav");
}
See Also

Reference