mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Build system cleanup. Platform dependent plugins moved to "plugins" subdirectories.
This commit is contained in:
@@ -20,8 +20,8 @@ namespace CUERipper
|
|||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
string arch = Marshal.SizeOf(typeof(IntPtr)) == 8 ? "x64" : "Win32";
|
string arch = Marshal.SizeOf(typeof(IntPtr)) == 8 ? "x64" : "win32";
|
||||||
GetSatelliteAssemblies("Plugins (" + arch + ")");
|
GetSatelliteAssemblies(System.IO.Path.Combine("plugins", arch));
|
||||||
|
|
||||||
CUEConfig config = new CUEConfig();
|
CUEConfig config = new CUEConfig();
|
||||||
config.Load(new SettingsReader("CUERipper", "settings.txt", Application.ExecutablePath));
|
config.Load(new SettingsReader("CUERipper", "settings.txt", Application.ExecutablePath));
|
||||||
|
|||||||
@@ -70,16 +70,16 @@
|
|||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
@@ -103,7 +103,6 @@
|
|||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<BrowseInformation>true</BrowseInformation>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<Copyright>Copyright (c) 2008-2018 Grigory Chudov</Copyright>
|
<Copyright>Copyright (c) 2008-2018 Grigory Chudov</Copyright>
|
||||||
<Authors>Grigory Chudov</Authors>
|
<Authors>Grigory Chudov</Authors>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<OutputPath>..\bin\$(Configuration)\plugins (Win32)</OutputPath>
|
<OutputPath>..\bin\$(Configuration)\plugins\</OutputPath>
|
||||||
<RepositoryUrl>https://github.com/gchudov/cuetools.net</RepositoryUrl>
|
<RepositoryUrl>https://github.com/gchudov/cuetools.net</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<Company />
|
<Company />
|
||||||
|
|||||||
126
CUETools.Codecs.HDCD/HDCDDLL.cs
Normal file
126
CUETools.Codecs.HDCD/HDCDDLL.cs
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace CUETools.Codecs.HDCD
|
||||||
|
{
|
||||||
|
internal static class HDCDDLL
|
||||||
|
{
|
||||||
|
internal const string DllName = "hdcd";
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll")]
|
||||||
|
private static extern IntPtr LoadLibrary(string dllToLoad);
|
||||||
|
[DllImport("kernel32.dll")]
|
||||||
|
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
|
||||||
|
|
||||||
|
internal delegate bool hdcd_decoder_write_callback(IntPtr decoder, IntPtr buffer, int samples, IntPtr client_data);
|
||||||
|
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern IntPtr hdcd_decoder_new();
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern void hdcd_decoder_delete(IntPtr decoder);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern hdcd_decoder_state hdcd_decoder_get_state(IntPtr decoder);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern bool hdcd_decoder_set_num_channels(IntPtr decoder, Int16 num_channels);
|
||||||
|
//HDCD_API uint16_t hdcd_decoder_get_num_channels(const hdcd_decoder *const _decoder);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern bool hdcd_decoder_set_sample_rate(IntPtr decoder, Int32 sample_rate);
|
||||||
|
//HDCD_API uint32_t hdcd_decoder_get_sample_rate(const hdcd_decoder *const _decoder);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern bool hdcd_decoder_set_input_bps(IntPtr decoder, Int16 input_bps);
|
||||||
|
//HDCD_API uint16_t hdcd_decoder_get_input_bps(const hdcd_decoder *const _decoder);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern bool hdcd_decoder_set_output_bps(IntPtr decoder, Int16 output_bps);
|
||||||
|
//HDCD_API uint16_t hdcd_decoder_get_output_bps(const hdcd_decoder *const _decoder);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern hdcd_decoder_init_status hdcd_decoder_init(IntPtr decoder, IntPtr unused, hdcd_decoder_write_callback write_callback, IntPtr client_data);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern bool hdcd_decoder_finish(IntPtr decoder);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern bool hdcd_decoder_process_buffer_interleaved(IntPtr decoder, [In, Out] int[,] input_buffer, Int32 samples);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern bool hdcd_decoder_flush_buffer(IntPtr decoder);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern bool hdcd_decoder_reset(IntPtr decoder);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern bool hdcd_decoder_detected_hdcd(IntPtr decoder);
|
||||||
|
[DllImport(DllName)]
|
||||||
|
internal static extern IntPtr hdcd_decoder_get_statistics(IntPtr decoder);
|
||||||
|
|
||||||
|
static HDCDDLL()
|
||||||
|
{
|
||||||
|
var myPath = new Uri(typeof(HDCDDLL).Assembly.CodeBase).LocalPath;
|
||||||
|
var myFolder = System.IO.Path.GetDirectoryName(myPath);
|
||||||
|
var is64 = IntPtr.Size == 8;
|
||||||
|
var subfolder = is64 ? "x64" : "win32";
|
||||||
|
#if NET40
|
||||||
|
IntPtr Dll = LoadLibrary(System.IO.Path.Combine(myFolder, subfolder, DllName + ".dll"));
|
||||||
|
#else
|
||||||
|
IntPtr Dll = LoadLibrary(System.IO.Path.Combine(System.IO.Path.Combine(myFolder, subfolder), DllName + ".dll"));
|
||||||
|
#endif
|
||||||
|
if (Dll == IntPtr.Zero)
|
||||||
|
Dll = LoadLibrary(DllName + ".dll");
|
||||||
|
if (Dll == IntPtr.Zero)
|
||||||
|
throw new DllNotFoundException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Statistics for decoding. */
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct hdcd_decoder_statistics
|
||||||
|
{
|
||||||
|
public UInt32 num_packets;
|
||||||
|
/**<Total number of samples processed. */
|
||||||
|
public bool enabled_peak_extend;
|
||||||
|
/**< True if peak extend was enabled during decoding. */
|
||||||
|
public bool disabled_peak_extend;
|
||||||
|
/**< True if peak extend was disabled during decoding. */
|
||||||
|
public double min_gain_adjustment;
|
||||||
|
/**< Minimum dynamic gain used during decoding. */
|
||||||
|
public double max_gain_adjustment;
|
||||||
|
/**< Maximum dynamic gain used during decoding. */
|
||||||
|
public bool enabled_transient_filter;
|
||||||
|
/**< True if the transient filter was enabled during decoding. */
|
||||||
|
public bool disabled_transient_filter;
|
||||||
|
/**< True if the transient filter was disabled during decoding. */
|
||||||
|
};
|
||||||
|
|
||||||
|
/** \brief Return values from hdcd_decoder_init. */
|
||||||
|
internal enum hdcd_decoder_init_status
|
||||||
|
{
|
||||||
|
HDCD_DECODER_INIT_STATUS_OK = 0,
|
||||||
|
/**< Initialization was successful. */
|
||||||
|
HDCD_DECODER_INIT_STATUS_INVALID_STATE,
|
||||||
|
/**< The _decoder was already initialised. */
|
||||||
|
HDCD_DECODER_INIT_STATUS_MEMORY_ALOCATION_ERROR,
|
||||||
|
/**< Initialization failed due to a memory allocation error. */
|
||||||
|
HDCD_DECODER_INIT_STATUS_INVALID_NUM_CHANNELS,
|
||||||
|
/**< Initialization failed because the configured number of channels was invalid. */
|
||||||
|
HDCD_DECODER_INIT_STATUS_INVALID_SAMPLE_RATE,
|
||||||
|
/**< Initialization failed because the configured sample rate was invalid. */
|
||||||
|
HDCD_DECODER_INIT_STATUS_INVALID_INPUT_BPS,
|
||||||
|
/**< Initialization failed because the configured input bits per sample was invalid. */
|
||||||
|
HDCD_DECODER_INIT_STATUS_INVALID_OUTPUT_BPS
|
||||||
|
/**< Initialization failed because the configured output bits per sample was invalid. */
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief State values for a decoder.
|
||||||
|
*
|
||||||
|
* The decoder's state can be obtained by calling hdcd_decoder_get_state().
|
||||||
|
*/
|
||||||
|
internal enum hdcd_decoder_state
|
||||||
|
{
|
||||||
|
HDCD_DECODER_STATE_UNINITIALISED = 1,
|
||||||
|
/**< The decoder is uninitialised. */
|
||||||
|
HDCD_DECODER_STATE_READY,
|
||||||
|
/**< The decoder is initialised and ready to process data. */
|
||||||
|
HDCD_DECODER_STATE_DIRTY,
|
||||||
|
/**< The decoder has processed data, but has not yet been flushed. */
|
||||||
|
HDCD_DECODER_STATE_FLUSHED,
|
||||||
|
/**< The decoder has been flushed. */
|
||||||
|
HDCD_DECODER_STATE_WRITE_ERROR,
|
||||||
|
/**< An error was returned by the write callback. */
|
||||||
|
HDCD_DECODER_STATE_MEMORY_ALOCATION_ERROR
|
||||||
|
/**< Processing failed due to a memory allocation error. */
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,31 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using CUETools.Codecs;
|
|
||||||
|
|
||||||
namespace HDCDDotNet
|
namespace CUETools.Codecs.HDCD
|
||||||
{
|
{
|
||||||
/** \brief Statistics for decoding. */
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct hdcd_decoder_statistics
|
|
||||||
{
|
|
||||||
public UInt32 num_packets;
|
|
||||||
/**<Total number of samples processed. */
|
|
||||||
public bool enabled_peak_extend;
|
|
||||||
/**< True if peak extend was enabled during decoding. */
|
|
||||||
public bool disabled_peak_extend;
|
|
||||||
/**< True if peak extend was disabled during decoding. */
|
|
||||||
public double min_gain_adjustment;
|
|
||||||
/**< Minimum dynamic gain used during decoding. */
|
|
||||||
public double max_gain_adjustment;
|
|
||||||
/**< Maximum dynamic gain used during decoding. */
|
|
||||||
public bool enabled_transient_filter;
|
|
||||||
/**< True if the transient filter was enabled during decoding. */
|
|
||||||
public bool disabled_transient_filter;
|
|
||||||
/**< True if the transient filter was disabled during decoding. */
|
|
||||||
};
|
|
||||||
|
|
||||||
public class HDCDDotNet : IAudioDest, IAudioFilter, IFormattable
|
public class HDCDDotNet : IAudioDest, IAudioFilter, IFormattable
|
||||||
{
|
{
|
||||||
public HDCDDotNet (int channels, int sample_rate, int output_bps, bool decode)
|
public HDCDDotNet (int channels, int sample_rate, int output_bps, bool decode)
|
||||||
@@ -34,21 +11,21 @@ namespace HDCDDotNet
|
|||||||
#if !MONO
|
#if !MONO
|
||||||
if (decode)
|
if (decode)
|
||||||
_audioBuffer = new AudioBuffer(new AudioPCMConfig(output_bps, channels, 44100), 256);
|
_audioBuffer = new AudioBuffer(new AudioPCMConfig(output_bps, channels, 44100), 256);
|
||||||
_decoder = hdcd_decoder_new();
|
_decoder = HDCDDLL.hdcd_decoder_new();
|
||||||
_channelCount = channels;
|
_channelCount = channels;
|
||||||
_bitsPerSample = output_bps;
|
_bitsPerSample = output_bps;
|
||||||
if (_decoder == IntPtr.Zero)
|
if (_decoder == IntPtr.Zero)
|
||||||
throw new Exception("Failed to initialize HDCD decoder.");
|
throw new Exception("Failed to initialize HDCD decoder.");
|
||||||
bool b = true;
|
bool b = true;
|
||||||
b &= hdcd_decoder_set_num_channels(_decoder, (short) _channelCount);
|
b &= HDCDDLL.hdcd_decoder_set_num_channels(_decoder, (short) _channelCount);
|
||||||
b &= hdcd_decoder_set_sample_rate(_decoder, sample_rate);
|
b &= HDCDDLL.hdcd_decoder_set_sample_rate(_decoder, sample_rate);
|
||||||
b &= hdcd_decoder_set_input_bps(_decoder, 16);
|
b &= HDCDDLL.hdcd_decoder_set_input_bps(_decoder, 16);
|
||||||
b &= hdcd_decoder_set_output_bps(_decoder, (short)_bitsPerSample);
|
b &= HDCDDLL.hdcd_decoder_set_output_bps(_decoder, (short)_bitsPerSample);
|
||||||
if (!b)
|
if (!b)
|
||||||
throw new Exception("Failed to set up HDCD _decoder parameters.");
|
throw new Exception("Failed to set up HDCD _decoder parameters.");
|
||||||
_decoderCallback = decode ? new hdcd_decoder_write_callback(DecoderCallback) : null;
|
_decoderCallback = decode ? new HDCDDLL.hdcd_decoder_write_callback(DecoderCallback) : null;
|
||||||
_gch = GCHandle.Alloc(this);
|
_gch = GCHandle.Alloc(this);
|
||||||
hdcd_decoder_init_status status = hdcd_decoder_init(_decoder, IntPtr.Zero, _decoderCallback, (IntPtr) _gch);
|
hdcd_decoder_init_status status = HDCDDLL.hdcd_decoder_init(_decoder, IntPtr.Zero, _decoderCallback, (IntPtr) _gch);
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
case hdcd_decoder_init_status.HDCD_DECODER_INIT_STATUS_OK:
|
case hdcd_decoder_init_status.HDCD_DECODER_INIT_STATUS_OK:
|
||||||
@@ -72,7 +49,7 @@ namespace HDCDDotNet
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if !MONO
|
#if !MONO
|
||||||
return hdcd_decoder_detected_hdcd(_decoder);
|
return HDCDDLL.hdcd_decoder_detected_hdcd(_decoder);
|
||||||
#else
|
#else
|
||||||
throw new Exception("HDCD unsupported.");
|
throw new Exception("HDCD unsupported.");
|
||||||
#endif
|
#endif
|
||||||
@@ -142,7 +119,7 @@ namespace HDCDDotNet
|
|||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
#if !MONO
|
#if !MONO
|
||||||
if (!hdcd_decoder_reset(_decoder))
|
if (!HDCDDLL.hdcd_decoder_reset(_decoder))
|
||||||
#endif
|
#endif
|
||||||
throw new Exception("error resetting decoder.");
|
throw new Exception("error resetting decoder.");
|
||||||
}
|
}
|
||||||
@@ -150,7 +127,7 @@ namespace HDCDDotNet
|
|||||||
public void GetStatistics(out hdcd_decoder_statistics stats)
|
public void GetStatistics(out hdcd_decoder_statistics stats)
|
||||||
{
|
{
|
||||||
#if !MONO
|
#if !MONO
|
||||||
IntPtr _statsPtr = hdcd_decoder_get_statistics(_decoder);
|
IntPtr _statsPtr = HDCDDLL.hdcd_decoder_get_statistics(_decoder);
|
||||||
#else
|
#else
|
||||||
IntPtr _statsPtr = IntPtr.Zero;
|
IntPtr _statsPtr = IntPtr.Zero;
|
||||||
#endif
|
#endif
|
||||||
@@ -162,7 +139,7 @@ namespace HDCDDotNet
|
|||||||
public void Write(AudioBuffer buff)
|
public void Write(AudioBuffer buff)
|
||||||
{
|
{
|
||||||
#if !MONO
|
#if !MONO
|
||||||
if (!hdcd_decoder_process_buffer_interleaved(_decoder, buff.Samples, buff.Length))
|
if (!HDCDDLL.hdcd_decoder_process_buffer_interleaved(_decoder, buff.Samples, buff.Length))
|
||||||
throw new Exception("HDCD processing error.");
|
throw new Exception("HDCD processing error.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -170,7 +147,7 @@ namespace HDCDDotNet
|
|||||||
public void Flush ()
|
public void Flush ()
|
||||||
{
|
{
|
||||||
#if !MONO
|
#if !MONO
|
||||||
if (!hdcd_decoder_flush_buffer(_decoder))
|
if (!HDCDDLL.hdcd_decoder_flush_buffer(_decoder))
|
||||||
#endif
|
#endif
|
||||||
throw new Exception("error flushing buffer.");
|
throw new Exception("error flushing buffer.");
|
||||||
}
|
}
|
||||||
@@ -179,7 +156,7 @@ namespace HDCDDotNet
|
|||||||
{
|
{
|
||||||
#if !MONO
|
#if !MONO
|
||||||
if (_decoder != IntPtr.Zero)
|
if (_decoder != IntPtr.Zero)
|
||||||
hdcd_decoder_delete(_decoder);
|
HDCDDLL.hdcd_decoder_delete(_decoder);
|
||||||
_decoder = IntPtr.Zero;
|
_decoder = IntPtr.Zero;
|
||||||
if (_gch.IsAllocated)
|
if (_gch.IsAllocated)
|
||||||
_gch.Free();
|
_gch.Free();
|
||||||
@@ -205,51 +182,12 @@ namespace HDCDDotNet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Return values from hdcd_decoder_init. */
|
|
||||||
private enum hdcd_decoder_init_status
|
|
||||||
{
|
|
||||||
HDCD_DECODER_INIT_STATUS_OK = 0,
|
|
||||||
/**< Initialization was successful. */
|
|
||||||
HDCD_DECODER_INIT_STATUS_INVALID_STATE,
|
|
||||||
/**< The _decoder was already initialised. */
|
|
||||||
HDCD_DECODER_INIT_STATUS_MEMORY_ALOCATION_ERROR,
|
|
||||||
/**< Initialization failed due to a memory allocation error. */
|
|
||||||
HDCD_DECODER_INIT_STATUS_INVALID_NUM_CHANNELS,
|
|
||||||
/**< Initialization failed because the configured number of channels was invalid. */
|
|
||||||
HDCD_DECODER_INIT_STATUS_INVALID_SAMPLE_RATE,
|
|
||||||
/**< Initialization failed because the configured sample rate was invalid. */
|
|
||||||
HDCD_DECODER_INIT_STATUS_INVALID_INPUT_BPS,
|
|
||||||
/**< Initialization failed because the configured input bits per sample was invalid. */
|
|
||||||
HDCD_DECODER_INIT_STATUS_INVALID_OUTPUT_BPS
|
|
||||||
/**< Initialization failed because the configured output bits per sample was invalid. */
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief State values for a decoder.
|
|
||||||
*
|
|
||||||
* The decoder's state can be obtained by calling hdcd_decoder_get_state().
|
|
||||||
*/
|
|
||||||
private enum hdcd_decoder_state
|
|
||||||
{
|
|
||||||
HDCD_DECODER_STATE_UNINITIALISED = 1,
|
|
||||||
/**< The decoder is uninitialised. */
|
|
||||||
HDCD_DECODER_STATE_READY,
|
|
||||||
/**< The decoder is initialised and ready to process data. */
|
|
||||||
HDCD_DECODER_STATE_DIRTY,
|
|
||||||
/**< The decoder has processed data, but has not yet been flushed. */
|
|
||||||
HDCD_DECODER_STATE_FLUSHED,
|
|
||||||
/**< The decoder has been flushed. */
|
|
||||||
HDCD_DECODER_STATE_WRITE_ERROR,
|
|
||||||
/**< An error was returned by the write callback. */
|
|
||||||
HDCD_DECODER_STATE_MEMORY_ALOCATION_ERROR
|
|
||||||
/**< Processing failed due to a memory allocation error. */
|
|
||||||
};
|
|
||||||
|
|
||||||
private AudioBuffer _audioBuffer;
|
private AudioBuffer _audioBuffer;
|
||||||
private IntPtr _decoder;
|
private IntPtr _decoder;
|
||||||
//private int[,] _inSampleBuffer;
|
//private int[,] _inSampleBuffer;
|
||||||
private int[,] _outSampleBuffer;
|
private int[,] _outSampleBuffer;
|
||||||
private int _channelCount, _bitsPerSample;
|
private int _channelCount, _bitsPerSample;
|
||||||
hdcd_decoder_write_callback _decoderCallback;
|
HDCDDLL.hdcd_decoder_write_callback _decoderCallback;
|
||||||
IAudioDest _audioDest;
|
IAudioDest _audioDest;
|
||||||
GCHandle _gch;
|
GCHandle _gch;
|
||||||
|
|
||||||
@@ -258,8 +196,6 @@ namespace HDCDDotNet
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private delegate bool hdcd_decoder_write_callback(IntPtr decoder, IntPtr buffer, int samples, IntPtr client_data);
|
|
||||||
|
|
||||||
private unsafe bool Output(IntPtr buffer, int samples)
|
private unsafe bool Output(IntPtr buffer, int samples)
|
||||||
{
|
{
|
||||||
if (AudioDest == null)
|
if (AudioDest == null)
|
||||||
@@ -287,40 +223,5 @@ namespace HDCDDotNet
|
|||||||
HDCDDotNet hdcd = (HDCDDotNet)gch.Target;
|
HDCDDotNet hdcd = (HDCDDotNet)gch.Target;
|
||||||
return hdcd.Output(buffer, samples);
|
return hdcd.Output(buffer, samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !MONO
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern IntPtr hdcd_decoder_new ();
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern void hdcd_decoder_delete(IntPtr decoder);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern hdcd_decoder_state hdcd_decoder_get_state(IntPtr decoder);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern bool hdcd_decoder_set_num_channels (IntPtr decoder, Int16 num_channels);
|
|
||||||
//HDCD_API uint16_t hdcd_decoder_get_num_channels(const hdcd_decoder *const _decoder);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern bool hdcd_decoder_set_sample_rate(IntPtr decoder, Int32 sample_rate);
|
|
||||||
//HDCD_API uint32_t hdcd_decoder_get_sample_rate(const hdcd_decoder *const _decoder);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern bool hdcd_decoder_set_input_bps(IntPtr decoder, Int16 input_bps);
|
|
||||||
//HDCD_API uint16_t hdcd_decoder_get_input_bps(const hdcd_decoder *const _decoder);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern bool hdcd_decoder_set_output_bps(IntPtr decoder, Int16 output_bps);
|
|
||||||
//HDCD_API uint16_t hdcd_decoder_get_output_bps(const hdcd_decoder *const _decoder);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern hdcd_decoder_init_status hdcd_decoder_init (IntPtr decoder, IntPtr unused, hdcd_decoder_write_callback write_callback, IntPtr client_data);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern bool hdcd_decoder_finish(IntPtr decoder);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern bool hdcd_decoder_process_buffer_interleaved(IntPtr decoder, [In, Out] int [,] input_buffer, Int32 samples);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern bool hdcd_decoder_flush_buffer(IntPtr decoder);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern bool hdcd_decoder_reset(IntPtr decoder);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern bool hdcd_decoder_detected_hdcd(IntPtr decoder);
|
|
||||||
[DllImport("hdcd.dll")]
|
|
||||||
private static extern IntPtr hdcd_decoder_get_statistics(IntPtr decoder);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<Copyright>Copyright (c) 2008-2018 Grigory Chudov</Copyright>
|
<Copyright>Copyright (c) 2008-2018 Grigory Chudov</Copyright>
|
||||||
<Authors>Grigory Chudov</Authors>
|
<Authors>Grigory Chudov</Authors>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<OutputPath>..\bin\$(Configuration)\plugins (Win32)</OutputPath>
|
<OutputPath>..\bin\$(Configuration)\plugins\win32</OutputPath>
|
||||||
<RepositoryUrl>https://github.com/gchudov/cuetools.net</RepositoryUrl>
|
<RepositoryUrl>https://github.com/gchudov/cuetools.net</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<Company />
|
<Company />
|
||||||
|
|||||||
@@ -70,16 +70,16 @@
|
|||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\obj\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\obj\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\obj\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\obj\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
|||||||
@@ -70,16 +70,16 @@
|
|||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\bin\$(Configuration)\net40\plugins ($(Platform))\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\bin\$(Configuration)\plugins\$(Platform)\net40\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace CUETools.Codecs.libFLAC
|
|||||||
{
|
{
|
||||||
internal unsafe static class FLACDLL
|
internal unsafe static class FLACDLL
|
||||||
{
|
{
|
||||||
internal const string libFLACDll = "libFLAC_dynamic";
|
internal const string DllName = "libFLAC_dynamic";
|
||||||
internal const CallingConvention libFLACCallingConvention = CallingConvention.Cdecl;
|
internal const CallingConvention libFLACCallingConvention = CallingConvention.Cdecl;
|
||||||
internal const int FLAC__MAX_CHANNELS = 8;
|
internal const int FLAC__MAX_CHANNELS = 8;
|
||||||
private static string version;
|
private static string version;
|
||||||
@@ -43,16 +43,16 @@ namespace CUETools.Codecs.libFLAC
|
|||||||
internal delegate void FLAC__StreamDecoderErrorCallback(IntPtr decoder, FLAC__StreamDecoderErrorStatus status, void* client_data);
|
internal delegate void FLAC__StreamDecoderErrorCallback(IntPtr decoder, FLAC__StreamDecoderErrorStatus status, void* client_data);
|
||||||
|
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern IntPtr FLAC__stream_decoder_new();
|
internal static extern IntPtr FLAC__stream_decoder_new();
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_decoder_set_metadata_respond(IntPtr decoder, FLAC__MetadataType type);
|
internal static extern int FLAC__stream_decoder_set_metadata_respond(IntPtr decoder, FLAC__MetadataType type);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_decoder_process_until_end_of_metadata(IntPtr decoder);
|
internal static extern int FLAC__stream_decoder_process_until_end_of_metadata(IntPtr decoder);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(
|
internal static extern FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(
|
||||||
IntPtr decoder,
|
IntPtr decoder,
|
||||||
FLAC__StreamDecoderReadCallback read_callback,
|
FLAC__StreamDecoderReadCallback read_callback,
|
||||||
@@ -66,75 +66,75 @@ namespace CUETools.Codecs.libFLAC
|
|||||||
void* client_data
|
void* client_data
|
||||||
);
|
);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_decoder_finish(IntPtr decoder);
|
internal static extern int FLAC__stream_decoder_finish(IntPtr decoder);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_decoder_delete(IntPtr decoder);
|
internal static extern int FLAC__stream_decoder_delete(IntPtr decoder);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_decoder_seek_absolute(IntPtr decoder, long sample);
|
internal static extern int FLAC__stream_decoder_seek_absolute(IntPtr decoder, long sample);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern FLAC__StreamDecoderState FLAC__stream_decoder_get_state(IntPtr decoder);
|
internal static extern FLAC__StreamDecoderState FLAC__stream_decoder_get_state(IntPtr decoder);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_decoder_process_single(IntPtr decoder);
|
internal static extern int FLAC__stream_decoder_process_single(IntPtr decoder);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern IntPtr FLAC__stream_encoder_new();
|
internal static extern IntPtr FLAC__stream_encoder_new();
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_set_bits_per_sample(IntPtr encoder, uint value);
|
internal static extern int FLAC__stream_encoder_set_bits_per_sample(IntPtr encoder, uint value);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_set_sample_rate(IntPtr encoder, uint value);
|
internal static extern int FLAC__stream_encoder_set_sample_rate(IntPtr encoder, uint value);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_set_channels(IntPtr encoder, uint value);
|
internal static extern int FLAC__stream_encoder_set_channels(IntPtr encoder, uint value);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_finish(IntPtr encoder);
|
internal static extern int FLAC__stream_encoder_finish(IntPtr encoder);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_delete(IntPtr encoder);
|
internal static extern int FLAC__stream_encoder_delete(IntPtr encoder);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_process_interleaved(IntPtr encoder, int* buffer, int samples);
|
internal static extern int FLAC__stream_encoder_process_interleaved(IntPtr encoder, int* buffer, int samples);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern FLAC__StreamEncoderState FLAC__stream_encoder_get_state(IntPtr encoder);
|
internal static extern FLAC__StreamEncoderState FLAC__stream_encoder_get_state(IntPtr encoder);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern void FLAC__stream_encoder_get_verify_decoder_error_stats(IntPtr encoder, out ulong absolute_sample, out uint frame_number, out uint channel, out uint sample, out int expected, out int got);
|
internal static extern void FLAC__stream_encoder_get_verify_decoder_error_stats(IntPtr encoder, out ulong absolute_sample, out uint frame_number, out uint channel, out uint sample, out int expected, out int got);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern FLAC__StreamMetadata* FLAC__metadata_object_new(FLAC__MetadataType type);
|
internal static extern FLAC__StreamMetadata* FLAC__metadata_object_new(FLAC__MetadataType type);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata* metadata, int samples, long total_samples);
|
internal static extern int FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata* metadata, int samples, long total_samples);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata* metadata, int compact);
|
internal static extern int FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata* metadata, int compact);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_set_metadata(IntPtr encoder, FLAC__StreamMetadata** metadata, int num_blocks);
|
internal static extern int FLAC__stream_encoder_set_metadata(IntPtr encoder, FLAC__StreamMetadata** metadata, int num_blocks);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_set_verify(IntPtr encoder, int value);
|
internal static extern int FLAC__stream_encoder_set_verify(IntPtr encoder, int value);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_set_do_md5(IntPtr encoder, int value);
|
internal static extern int FLAC__stream_encoder_set_do_md5(IntPtr encoder, int value);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_set_total_samples_estimate(IntPtr encoder, long value);
|
internal static extern int FLAC__stream_encoder_set_total_samples_estimate(IntPtr encoder, long value);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_set_compression_level(IntPtr encoder, int value);
|
internal static extern int FLAC__stream_encoder_set_compression_level(IntPtr encoder, int value);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern int FLAC__stream_encoder_set_blocksize(IntPtr encoder, int value);
|
internal static extern int FLAC__stream_encoder_set_blocksize(IntPtr encoder, int value);
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
@@ -149,7 +149,7 @@ namespace CUETools.Codecs.libFLAC
|
|||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
internal delegate void FLAC__StreamEncoderMetadataCallback(IntPtr encoder, FLAC__StreamMetadata* metadata, void* client_data);
|
internal delegate void FLAC__StreamEncoderMetadataCallback(IntPtr encoder, FLAC__StreamMetadata* metadata, void* client_data);
|
||||||
|
|
||||||
[DllImport(libFLACDll, CallingConvention = libFLACCallingConvention)]
|
[DllImport(DllName, CallingConvention = libFLACCallingConvention)]
|
||||||
internal static extern FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream(IntPtr encoder,
|
internal static extern FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream(IntPtr encoder,
|
||||||
FLAC__StreamEncoderWriteCallback write_callback,
|
FLAC__StreamEncoderWriteCallback write_callback,
|
||||||
FLAC__StreamEncoderSeekCallback seek_callback,
|
FLAC__StreamEncoderSeekCallback seek_callback,
|
||||||
@@ -162,14 +162,14 @@ namespace CUETools.Codecs.libFLAC
|
|||||||
var myPath = new Uri(typeof(FLACDLL).Assembly.CodeBase).LocalPath;
|
var myPath = new Uri(typeof(FLACDLL).Assembly.CodeBase).LocalPath;
|
||||||
var myFolder = System.IO.Path.GetDirectoryName(myPath);
|
var myFolder = System.IO.Path.GetDirectoryName(myPath);
|
||||||
var is64 = IntPtr.Size == 8;
|
var is64 = IntPtr.Size == 8;
|
||||||
var subfolder = is64 ? "plugins (x64)" : "plugins (win32)";
|
var subfolder = is64 ? "x64" : "win32";
|
||||||
#if NET40
|
#if NET40
|
||||||
IntPtr Dll = LoadLibrary(System.IO.Path.Combine(myFolder, "..", subfolder, libFLACDll + ".dll"));
|
IntPtr Dll = LoadLibrary(System.IO.Path.Combine(myFolder, subfolder, DllName + ".dll"));
|
||||||
#else
|
#else
|
||||||
IntPtr Dll = LoadLibrary(System.IO.Path.Combine(System.IO.Path.Combine(System.IO.Path.Combine(myFolder, ".."), subfolder), libFLACDll + ".dll"));
|
IntPtr Dll = LoadLibrary(System.IO.Path.Combine(System.IO.Path.Combine(myFolder, subfolder), DllName + ".dll"));
|
||||||
#endif
|
#endif
|
||||||
if (Dll == IntPtr.Zero)
|
if (Dll == IntPtr.Zero)
|
||||||
Dll = LoadLibrary(libFLACDll + ".dll");
|
Dll = LoadLibrary(DllName + ".dll");
|
||||||
if (Dll == IntPtr.Zero)
|
if (Dll == IntPtr.Zero)
|
||||||
throw new DllNotFoundException();
|
throw new DllNotFoundException();
|
||||||
IntPtr addr = GetProcAddress(Dll, "FLAC__VERSION_STRING");
|
IntPtr addr = GetProcAddress(Dll, "FLAC__VERSION_STRING");
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<Copyright>Copyright (c) 2008-2018 Grigory Chudov, Michael A. McCloskey</Copyright>
|
<Copyright>Copyright (c) 2008-2018 Grigory Chudov, Michael A. McCloskey</Copyright>
|
||||||
<Authors>Grigory Chudov, Michael A. McCloskey</Authors>
|
<Authors>Grigory Chudov, Michael A. McCloskey</Authors>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<OutputPath>..\bin\$(Configuration)\plugins (Win32)</OutputPath>
|
<OutputPath>..\bin\$(Configuration)\plugins\win32</OutputPath>
|
||||||
<RepositoryUrl>https://github.com/gchudov/cuetools.net</RepositoryUrl>
|
<RepositoryUrl>https://github.com/gchudov/cuetools.net</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<Company />
|
<Company />
|
||||||
|
|||||||
@@ -32,14 +32,16 @@ namespace CUETools.Processor
|
|||||||
//string arch = asi.ApplicationId.ProcessorArchitecture;
|
//string arch = asi.ApplicationId.ProcessorArchitecture;
|
||||||
//ActivationContext is null most of the time :(
|
//ActivationContext is null most of the time :(
|
||||||
|
|
||||||
string arch = Type.GetType("Mono.Runtime", false) != null ? "mono" : Marshal.SizeOf(typeof(IntPtr)) == 8 ? "x64" : "Win32";
|
string plugins_path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "plugins");
|
||||||
string plugins_path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Plugins (" + arch + ")");
|
if (Directory.Exists(plugins_path))
|
||||||
if (Directory.Exists(plugins_path))
|
{
|
||||||
AddPluginDirectory(plugins_path);
|
AddPluginDirectory(plugins_path);
|
||||||
plugins_path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Plugins");
|
string arch = Type.GetType("Mono.Runtime", false) != null ? "mono" : Marshal.SizeOf(typeof(IntPtr)) == 8 ? "x64" : "win32";
|
||||||
|
plugins_path = Path.Combine(plugins_path, arch);
|
||||||
if (Directory.Exists(plugins_path))
|
if (Directory.Exists(plugins_path))
|
||||||
AddPluginDirectory(plugins_path);
|
AddPluginDirectory(plugins_path);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void AddPluginDirectory(string plugins_path)
|
private static void AddPluginDirectory(string plugins_path)
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -20,7 +20,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{0B9C97D4-61B8-4294-A1DF-BA90752A1779}</ProjectGuid>
|
<ProjectGuid>{0B9C97D4-61B8-4294-A1DF-BA90752A1779}</ProjectGuid>
|
||||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
|
||||||
<RootNamespace>MACLib</RootNamespace>
|
<RootNamespace>MACLib</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -573,6 +572,7 @@ nasmw -d WIN32 -f win64 -o Assembly64.obj Assembly64.nas
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Object Include="Assembly\Assembly.obj">
|
<Object Include="Assembly\Assembly.obj">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
</Object>
|
</Object>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
|||||||
Reference in New Issue
Block a user