mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
General cleanup and refactor.
This commit is contained in:
@@ -26,18 +26,16 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Compression;
|
||||
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using CUETools.Codecs;
|
||||
using CUETools.Codecs.Flake;
|
||||
|
||||
namespace Aaru.Compression;
|
||||
|
||||
public class FLAC
|
||||
{
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> if this algorithm is supported, <c>false</c> otherwise.
|
||||
/// </summary>
|
||||
/// <summary>Set to <c>true</c> if this algorithm is supported, <c>false</c> otherwise.</summary>
|
||||
public static bool IsSupported => true;
|
||||
|
||||
[DllImport("libAaru.Compression.Native", SetLastError = true)]
|
||||
@@ -48,9 +46,8 @@ public class FLAC
|
||||
static extern nuint AARU_flac_encode_redbook_buffer(byte[] dst_buffer, nuint dst_size, byte[] src_buffer,
|
||||
nuint src_size, uint blocksize, int do_mid_side_stereo,
|
||||
int loose_mid_side_stereo, string apodization,
|
||||
uint max_lpc_order,
|
||||
uint qlp_coeff_precision, int do_qlp_coeff_prec_search,
|
||||
int do_exhaustive_model_search,
|
||||
uint max_lpc_order, uint qlp_coeff_precision,
|
||||
int do_qlp_coeff_prec_search, int do_exhaustive_model_search,
|
||||
uint min_residual_partition_order,
|
||||
uint max_residual_partition_order, string application_id,
|
||||
uint application_id_len);
|
||||
@@ -81,19 +78,18 @@ public class FLAC
|
||||
/// <param name="destination">Buffer to store the compressed data</param>
|
||||
/// <returns></returns>
|
||||
public static int EncodeBuffer(byte[] source, byte[] destination, uint blockSize, bool doMidSideStereo,
|
||||
bool looseMidSideStereo, string apodization, uint max_lpc_order, uint qlpCoeffPrecision,
|
||||
bool doQlpCoeffPrecSearch, bool doExhaustiveModelSearch,
|
||||
uint minResidualPartitionOrder, uint maxResidualPartitionOrder,
|
||||
string applicationID)
|
||||
bool looseMidSideStereo, string apodization, uint max_lpc_order,
|
||||
uint qlpCoeffPrecision, bool doQlpCoeffPrecSearch, bool doExhaustiveModelSearch,
|
||||
uint minResidualPartitionOrder, uint maxResidualPartitionOrder, string applicationID)
|
||||
{
|
||||
if(Native.IsSupported)
|
||||
return (int)AARU_flac_encode_redbook_buffer(destination, (nuint)destination.Length, source,
|
||||
(nuint)source.Length, blockSize, doMidSideStereo ? 1 : 0,
|
||||
looseMidSideStereo ? 1 : 0, apodization, max_lpc_order, qlpCoeffPrecision,
|
||||
doQlpCoeffPrecSearch ? 1 : 0,
|
||||
doExhaustiveModelSearch ? 1 : 0,
|
||||
minResidualPartitionOrder, maxResidualPartitionOrder,
|
||||
applicationID, (uint)applicationID.Length);
|
||||
looseMidSideStereo ? 1 : 0, apodization, max_lpc_order,
|
||||
qlpCoeffPrecision, doQlpCoeffPrecSearch ? 1 : 0,
|
||||
doExhaustiveModelSearch ? 1 : 0, minResidualPartitionOrder,
|
||||
maxResidualPartitionOrder, applicationID,
|
||||
(uint)applicationID.Length);
|
||||
|
||||
var flakeWriterSettings = new EncoderSettings
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user