/// <summary> /// Retrieves the WMA encoding bitrates available for a specified sample format. /// </summary> /// <param name="Frequency">The sample rate in Hz, or a BASS channel handle if the <see cref="WMAEncodeFlags.Source"/> flag is specified.</param> /// <param name="Channels">The number of channels (1=mono, 2=stereo, etc.).</param> /// <param name="Flags">A combination of <see cref="WMAEncodeFlags"/>.</param> /// <returns>If succesful, an array of the available bitrates is returned (int[], in bits per second), else <see langword="null" /> is returned. Use <see cref="Bass.LastError" /> to get the error code.</returns> /// <remarks> /// <para>When requesting VBR rates, the rates returned are quality settings. For example, 10 = 10% quality, 25 = 25% quality, etc... 100% quality is lossless.</para> /// <para> /// The WMA codec expects 16-bit or 24-bit sample data depending on the <see cref="WMAEncodeFlags.Encode24Bit"/> flag, but BassWma will accept 8-bit, 16-bit or floating-point data, and convert it to the appropriate format. /// Of course, it makes little sense to encode 8-bit or 16-bit data in 24-bit. /// </para> /// <para> /// The WMA codec currently supports the following sample rates: 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96000. /// And the following number of channels: 1, 2, 6, 8. /// But not all combinations of these are supported. /// To encode other sample formats, the data will first have to be resampled to a supported format. /// </para> /// </remarks> /// <exception cref="Errors.WM9">The Windows Media modules (v9 or above) are not installed.</exception> /// <exception cref="Errors.NotAvailable">No codec could be found to support the specified sample format.</exception> /// <exception cref="Errors.Unknown">Some other mystery problem!</exception> public static unsafe int[] EncodeGetRates(int Frequency, int Channels, WMAEncodeFlags Flags) { var list = new List <int>(); var rates = BASS_WMA_EncodeGetRates(Frequency, Channels, Flags); if (rates != null) { while (*rates != 0) { list.Add(*rates); rates++; } } else { return(null); } return(list.ToArray()); }
/// <summary> /// Initializes WMA encoding to a publishing point on a Windows Media server, using multiple bitrates. /// </summary> /// <param name="Frequency">The sample rate in Hz, or a BASS channel handle if the <see cref="WMAEncodeFlags.Source"/> flag is specified.</param> /// <param name="Channels">The number of channels (1=mono, 2=stereo, etc.).</param> /// <param name="Flags">A combination of <see cref="WMAEncodeFlags"/>.</param> /// <param name="Bitrates">Array of encoding bitrates to use, terminated with a 0 (in bits per second, e.g. 128000).</param> /// <param name="Url">URL of the publishing point on the Windows Media server.</param> /// <param name="UserName">Username to use in connecting to the server... if either this or Password is <see langword="null" />, then no username/password is sent to the server.</param> /// <param name="Password">Password to use in connecting to the server.</param> /// <returns>If succesful, the new encoder's handle is returned, else 0 is returned. Use <see cref="Bass.LastError" /> to get the error code.</returns> /// <remarks> /// This function is identical to <see cref="EncodeOpenPublish(int,int,WMAEncodeFlags,int,string,string,string)"/>, but with the additional ability to specify multiple bitrates. /// <para>When encoding/broadcasting in multiple bitrates, the user will automatically get the best available bitrate for their bandwidth.</para> /// <para> /// The WMA codec expects 16-bit or 24-bit sample data depending on the <see cref="WMAEncodeFlags.Encode24Bit"/> flag, but BASSWMA will accept 8-bit, 16-bit or floating-point data, and convert it to the appropriate format. /// VBR encoding is not recommended for network encoding.</para> /// </remarks> /// <exception cref="Errors.WM9">The Windows Media modules (v9 or above) are not installed.</exception> /// <exception cref="Errors.FileOpen">Could not connect to the server.</exception> /// <exception cref="Errors.NotAvailable">No codec could be found to support the specified sample format and bitrate.</exception> /// <exception cref="Errors.WmaAccesDenied">Access was denied. Check the <paramref name="UserName" /> and <paramref name="Password" />.</exception> /// <exception cref="Errors.Unknown">Some other mystery problem!</exception> public static int EncodeOpenPublish(int Frequency, int Channels, WMAEncodeFlags Flags, int[] Bitrates, string Url, string UserName, string Password) { return(BASS_WMA_EncodeOpenPublishMulti(Frequency, Channels, Flags | WMAEncodeFlags.Unicode, Bitrates, Url, UserName, Password)); }
static extern unsafe int *BASS_WMA_EncodeGetRates(int freq, int chans, WMAEncodeFlags Flags);
public static extern int EncodeOpenNetwork(int Frequency, int Channels, WMAEncodeFlags Flags, int[] Bitrates, int Port, int Clients);
static extern int BASS_WMA_EncodeOpenPublishMulti(int freq, int chans, WMAEncodeFlags flags, int[] bitrate, string url, string user, string pass);
static extern int BASS_WMA_EncodeOpenFile(int freq, int chans, WMAEncodeFlags flags, int bitrate, string file);
/// <summary> /// Initializes WMA encoding to a file. /// </summary> /// <param name="Frequency">The sample rate in Hz, or a BASS channel handle if the <see cref="WMAEncodeFlags.Source"/> flag is specified.</param> /// <param name="Channels">The number of channels (1=mono, 2=stereo, etc.).</param> /// <param name="Flags">A combination of <see cref="WMAEncodeFlags"/>.</param> /// <param name="Bitrate">The encoding bitrate (in bits per second, e.g. 128000), or VBR quality (100 or less).</param> /// <param name="File">The filename to write.</param> /// <returns>If succesful, the new encoder's handle is returned, else 0 is returned. Use <see cref="Bass.LastError" /> to get the error code.</returns> /// <remarks> /// The WMA codec expects 16-bit or 24-bit sample data depending on the <see cref="WMAEncodeFlags.Encode24Bit"/> flag, but BASSWMA will accept 8-bit, 16-bit or floating-point data, and convert it to the appropriate format. /// </remarks> /// <exception cref="Errors.WM9">The Windows Media modules (v9 or above) are not installed.</exception> /// <exception cref="Errors.NotAvailable">No codec could be found to support the specified sample format and bitrate.</exception> /// <exception cref="Errors.Create">Could not create the file to write the WMA stream.</exception> /// <exception cref="Errors.Unknown">Some other mystery problem!</exception> public static int EncodeOpenFile(int Frequency, int Channels, WMAEncodeFlags Flags, int Bitrate, string File) { return(BASS_WMA_EncodeOpenFile(Frequency, Channels, Flags | WMAEncodeFlags.Unicode, Bitrate, File)); }
public static extern int EncodeOpenPublish(int freq, int chans, WMAEncodeFlags flags, [MarshalAs(UnmanagedType.LPArray)] int[] bitrate, string url, string user, string pass);
public static extern int EncodeOpen(int Frequency, int Channels, WMAEncodeFlags Flags, int Bitrate, WMEncodeProcedure Procedure, IntPtr User = default(IntPtr));
public static extern int EncodeOpenPublish(int freq, int chans, WMAEncodeFlags flags, int bitrate, string url, string user, string pass);
public static extern int EncodeOpenNetwork(int freq, int chans, WMAEncodeFlags flags, [MarshalAs(UnmanagedType.LPArray)] int[] bitrate, int port, int clients);
public static extern int EncodeOpenNetwork(int freq, int chans, WMAEncodeFlags flags, int bitrate, int port, int clients);
public static extern int EncodeOpenFile(int freq, int chans, WMAEncodeFlags flags, int bitate, string file);
public static extern int EncodeOpen(int freq, int chans, WMAEncodeFlags flags, int bitrate, WMEncodeProcedure proc, IntPtr user);