/// <summary> /// Encodes a chunk of samples. Please note that if you have set the output to /// generate mono MP3 files you must feed beEncodeChunk() with mono samples /// </summary> /// <param name="hbeStream">Handle of the stream.</param> /// <param name="nSamples">Number of samples to be encoded for this call. /// This should be identical to what is returned by beInitStream(), /// unless you are encoding the last chunk, which might be smaller.</param> /// <param name="pSamples">Pointer at the 16-bit signed samples to be encoded. /// InPtr is used to pass any type of array without need of make memory copy, /// then gaining in performance. Note that nSamples is not the number of bytes, /// but samples (is sample is a SHORT)</param> /// <param name="pOutput">Buffer where to write the encoded data. /// This buffer should be at least of the minimum size returned by beInitStream().</param> /// <param name="pdwOutput">Returns the number of bytes of encoded data written. /// The amount of data written might vary from chunk to chunk</param> /// <returns>On success: BE_ERR_SUCCESSFUL</returns> protected static uint beEncodeChunk(uint hbeStream, uint nSamples, IntPtr pSamples, [In, Out] byte[] pOutput, ref uint pdwOutput) { return(is32bit ? Lame86.beEncodeChunk(hbeStream, nSamples, pSamples, pOutput, ref pdwOutput) : Lame64.beEncodeChunk(hbeStream, nSamples, pSamples, pOutput, ref pdwOutput)); }
/// <summary> /// Encodes a chunk of samples. Please note that if you have set the output to /// generate mono MP3 files you must feed beEncodeChunk() with mono samples /// </summary> /// <param name="hbeStream">Handle of the stream.</param> /// <param name="nSamples">Number of samples to be encoded for this call. /// This should be identical to what is returned by beInitStream(), /// unless you are encoding the last chunk, which might be smaller.</param> /// <param name="pInSamples">Array of 16-bit signed samples to be encoded. /// These should be in stereo when encoding a stereo MP3 /// and mono when encoding a mono MP3</param> /// <param name="pOutput">Buffer where to write the encoded data. /// This buffer should be at least of the minimum size returned by beInitStream().</param> /// <param name="pdwOutput">Returns the number of bytes of encoded data written. /// The amount of data written might vary from chunk to chunk</param> /// <returns>On success: BE_ERR_SUCCESSFUL</returns> public static uint beEncodeChunk(uint hbeStream, uint nSamples, short[] pInSamples, [In, Out] byte[] pOutput, ref uint pdwOutput) { return(is32bit ? Lame86.beEncodeChunk(hbeStream, nSamples, pInSamples, pOutput, ref pdwOutput) : Lame64.beEncodeChunk(hbeStream, nSamples, pInSamples, pOutput, ref pdwOutput)); }