BASS.NET API for the Un4seen BASS Audio LibraryBassEncBASS_Encode_GetACMFormatSuggest Method BASS.NET API for the Un4seen BASS Audio Library
Returns a suggested ACM (Audio Compression Manager) codec output format without displaying a user dialog.

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

public static ACMFORMAT BASS_Encode_GetACMFormatSuggest(
	int handle,
	BASSACMFormat flags,
	WAVEFormatTag format


Type: SystemInt32
The channel handle... a HSTREAM, HMUSIC, or HRECORD.
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_SUGGESTThis flag will be added automatically.
Type: Un4seen.BassWAVEFormatTag
The wanted codec format (use one of the WAVEFormatTag flags, or see the MMREG.H file for more).

Return Value

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

This function does NOT presents the user with a list of available ACM codecs to choose from, instead an automatic suggested codec will be returned, which matches the given format. 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.

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!


Without letting the user choose, setup an MP3 encoder on a channel:
Dim codec As ACMFORMAT = BassEnc.BASS_Encode_GetACMFormatSuggest(channel, 
                                 BASSACMFormat.BASS_ACM_CHANS Or BASSACMFormat.BASS_ACM_RATE,
If Not (codec Is Nothing) Then
  ' begin encoding using the codec
  BassEnc.BASS_Encode_StartACMFile(channel, codec, BASSEncode.BASS_ENCODE_DEFAULT, "acm.mp3")
End If
ACMFORMAT codec = BassEnc.BASS_Encode_GetACMFormatSuggest(channel, 
                          BASSACMFormat.BASS_ACM_CHANS | BASSACMFormat.BASS_ACM_RATE,
if ( codec != null )
  // begin encoding using the codec
  BassEnc.BASS_Encode_StartACMFile( channel, codec, BASSEncode.BASS_ENCODE_DEFAULT, "acm.mp3");
See Also