This overload implements UNICODE options. The BASS_UNICODE flag will be added automatically, since all .Net strings are always unicode.
Namespace: Un4seen.Bass.AddOn.EncOpus
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
public static int BASS_Encode_OPUS_Start( int handle, string options, BASSEncode flags, ENCODEPROC proc, IntPtr user )
Parameters
- handle
- Type: SystemInt32
The channel handle... a HSTREAM, HMUSIC, or HRECORD. - options
- Type: SystemString
Encoder options... =use defaults. The following OPUSENC style options are supported:--bitrate, --vbr, --cvbr, --hard-cbr, --comp / --complexity, --framesize, --expect-loss, --max-delay, --comment, --artist, --title, --album, --tracknumber, --date, --genre, --picture, --padding, --serial, --set-ctl-int. Anything else that is included will be ignored. See the OPUSENC documentation for details on the aforementioned options and defaults.
- flags
- Type: Un4seen.Bass.AddOn.EncBASSEncode
A combination of these flags (see BASSEncode):BASS_ENCODE_QUEUE Queue data to feed the encoder asynchronously. This prevents the data source (DSP system or BASS_Encode_Write call) getting blocked by the encoder, but if data is queud more quickly than the encoder can process it, that could result in lost data. BASS_ENCODE_LIMIT Limit the data rate to real-time speed, by introducing a delay when the rate is too high. With BASS 2.4.6 or above, this flag is ignored when the encoder is fed in a playback buffer update cycle (including BASS_Update(Int32) and BASS_ChannelUpdate(Int32, Int32) calls), to avoid possibly causing playback buffer underruns. Except for in those instances, this flag is applied automatically when the encoder is feeding a Shoutcast or Icecast server. BASS_ENCODE_CAST_NOLIMIT Don't limit the data rate (to real-time speed) when sending to a Shoutcast or Icecast server. BASS_ENCODE_PAUSE Start the encoder paused. BASS_ENCODE_AUTOFREE Automatically free the encoder when the source channel is freed. BASS_UNICODE options is in UTF-16 form. Otherwise it should be UTF-8. (not needed here, since the overloads already take care of it). - proc
- Type: Un4seen.Bass.AddOn.EncENCODEPROC
Callback function to receive the sample data and return the encoded data. - user
- Type: SystemIntPtr
User instance data to pass to the callback function.
Return Value
Type: Int32The encoder handle is returned if the encoder is successfully started, else 0 is returned (use BASS_ErrorGetCode to get the error code).
BASS_Encode_StartUser(Int32, String, BASSEncode, ENCODERPROC, IntPtr) is used internally to apply the encoder to the source channel, so the remarks in its documentation also apply to this function.
Tags/comments should be in UTF-8 form. This function will take care of that when the BASS_UNICODE flag is used, but otherwise you will need to make sure that any tags included in options are UTF-8 (not ISO-8859-1/etc).
On Windows and Linux, an SSE supporting CPU is required for sample rates other than 48000/24000/16000/12000/8000 Hz.
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not valid. |
BASS_ERROR_FORMAT | The channel's sample format is not supported by the encoder. |
BASS_ERROR_ILLPARAM | options contains an invalid setting. |
BASS_ERROR_FILEOPEN | A '--picture' option file could not be opened. |
BASS_ERROR_FILEFORM | A '--picture' option file has an invalid format. It needs to be JPEG, PNG, or GIF. |
BASS_ERROR_MEM | There is insufficient memory. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |