Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
msavo authored and msavo committed Sep 16, 2024
1 parent 97c59c0 commit 121aa4b
Show file tree
Hide file tree
Showing 41 changed files with 2,459 additions and 0 deletions.
25 changes: 25 additions & 0 deletions libsndfile.NET8.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libsndfile.NET8", "libsndfile.NET8\libsndfile.NET8.csproj", "{51C581C4-63AB-4D49-9F53-DFAB2B8E83F7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{51C581C4-63AB-4D49-9F53-DFAB2B8E83F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51C581C4-63AB-4D49-9F53-DFAB2B8E83F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51C581C4-63AB-4D49-9F53-DFAB2B8E83F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51C581C4-63AB-4D49-9F53-DFAB2B8E83F7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1F643DFF-29F5-4478-B0A4-2A587DA68541}
EndGlobalSection
EndGlobal
50 changes: 50 additions & 0 deletions libsndfile.NET8/Marshaller/Marshaller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using System.Runtime.InteropServices;


namespace libsndfile.NET8
{

internal struct Marshaller<T> : IDisposable where T : struct
{
public T Data { get; }
public int Size { get; }
public IntPtr Address { get; }

public Marshaller(T data, MarshallerBehavior behavior = MarshallerBehavior.Push)
{
Data = data;
Size = Marshal.SizeOf(data);
Address = Marshal.AllocHGlobal(Size);

switch (behavior)
{
case MarshallerBehavior.None:
break;
case MarshallerBehavior.Push:
Push();
break;
case MarshallerBehavior.PushDeleteOld:
Push(true);
break;
default:
throw new ArgumentOutOfRangeException(nameof(behavior), behavior, null);
}
}

public void Push(bool deleteOld = false)
{
Marshal.StructureToPtr(Data, Address, deleteOld);
}

public T Pop()
{
return Marshal.PtrToStructure<T>(Address);
}

public void Dispose()
{
Marshal.FreeHGlobal(Address);
}
}
}
9 changes: 9 additions & 0 deletions libsndfile.NET8/Marshaller/MarshallerBehavior.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace libsndfile.NET8
{
internal enum MarshallerBehavior
{
None,
Push,
PushDeleteOld
}
}
11 changes: 11 additions & 0 deletions libsndfile.NET8/SfAmbisonic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


namespace libsndfile.NET8
{

public enum SfAmbisonic
{
None = 0x40,
BFormat = 0x41
}
}
53 changes: 53 additions & 0 deletions libsndfile.NET8/SfBroadcastInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System.Runtime.InteropServices;


namespace libsndfile.NET8
{

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct SfBroadcastInfo
{
public const int DescriptionSize = 256;
public const int OriginatorSize = 32;
public const int OriginatorReferenceSize = 32;
public const int OriginationDateSize = 10;
public const int OriginationTimeSize = 8;
public const int UmidSize = 64;
public const int ReservedSize = 190;
public const int CodingHistorySizeDefault = 256;

public static SfBroadcastInfo Empty { get; }

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = DescriptionSize)]
public readonly string Description;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = OriginatorSize)]
public readonly string Originator;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = OriginatorReferenceSize)]
public readonly string OriginatorReference;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = OriginationDateSize)]
public readonly string OriginationDate;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = OriginationTimeSize)]
public readonly string OriginationTime;

public readonly uint TimeReferenceLow;

public readonly uint TimeReferenceHigh;

public readonly short Version;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = UmidSize)]
public readonly string Umid;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ReservedSize)]
public readonly string Reserved;

public readonly uint CodingHistorySize;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = CodingHistorySizeDefault)]
public readonly string CodingHistory;
}
}
93 changes: 93 additions & 0 deletions libsndfile.NET8/SfCartInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System.Runtime.InteropServices;


namespace libsndfile.NET8
{

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct SfCartInfo
{
public const int VersionSize = 4;
public const int TitleSize = 64;
public const int ArtistSize = 64;
public const int CutIdSize = 64;
public const int ClientIdSize = 64;
public const int CategorySize = 64;
public const int ClassificationSize = 64;
public const int OutCueSize = 64;
public const int StartDateSize = 10;
public const int StartTimeSize = 8;
public const int EndDateSize = 10;
public const int EndTimeSize = 8;
public const int ProducerAppIdSize = 64;
public const int ProducerAppVersionSize = 64;
public const int UserDefSize = 64;
public const int PostTimersSize = 8;
public const int ReservedSize = 276;
public const int UrlSize = 1024;
public const int TagTextSizeDefault = 256;

public static SfCartInfo Empty { get; } = new SfCartInfo {PostTimers = new SfCartTimer[PostTimersSize]};

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = VersionSize)]
public string Version;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TitleSize)]
public string Title;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ArtistSize)]
public string Artist;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = CutIdSize)]
public string CutId;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ClientIdSize)]
public string ClientId;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = CategorySize)]
public string Category;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ClassificationSize)]
public string Classification;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = OutCueSize)]
public string OutCue;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = StartDateSize)]
public string StartDate;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = StartTimeSize)]
public string StartTime;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = EndDateSize)]
public string EndDate;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = EndTimeSize)]
public string EndTime;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ProducerAppIdSize)]
public string ProducerAppId;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ProducerAppVersionSize)]
public string ProducerAppVersion;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = UserDefSize)]
public string UserDef;

public int LevelReference;

[MarshalAs(UnmanagedType.ByValArray, SizeConst = PostTimersSize, ArraySubType = UnmanagedType.Struct)]
public SfCartTimer[] PostTimers;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ReservedSize)]
public string Reserved;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = UrlSize)]
public string Url;

public uint TagTextSize;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = TagTextSizeDefault)]
public string TagText;
}
}
17 changes: 17 additions & 0 deletions libsndfile.NET8/SfCartTimer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Runtime.InteropServices;


namespace libsndfile.NET8
{

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct SfCartTimer
{
public const int UsageSize = 4;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = UsageSize)]
public string Usage;

public int Value;
}
}
102 changes: 102 additions & 0 deletions libsndfile.NET8/SfCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
namespace libsndfile.NET8
{
internal enum SfCommand
{
GetLibVersion = 0x1000,
GetLogInfo = 0x1001,
SFC_GET_CURRENT_SF_INFO = 0x1002,


GetNormDouble = 0x1010,
GetNormFloat = 0x1011,
SetNormDouble = 0x1012,
SetNormFloat = 0x1013,
SetScaleFloatIntRead = 0x1014,
SetScaleIntFloatWrite = 0x1015,

GetSimpleFormatCount = 0x1020,
GetSimpleFormat = 0x1021,

GetFormatInfo = 0x1028,

GetFormatMajorCount = 0x1030,
GetFormatMajor = 0x1031,
GetFormatSubtypeCount = 0x1032,
GetFormatSubtype = 0x1033,

CalcSignalMax = 0x1040,
CalcNormSignalMax = 0x1041,
CalcMaxAllChannels = 0x1042,
CalcNormMaxAllChannels = 0x1043,
GetSignalMax = 0x1044,
GetMaxAllChannels = 0x1045,

SetAddPeakChunk = 0x1050,
SFC_SET_ADD_HEADER_PAD_CHUNK = 0x1051,

UpdateHeaderNow = 0x1060,
SetUpdateHeaderAuto = 0x1061,

FileTruncate = 0x1080,

SetRawStartOffset = 0x1090,

SFC_SET_DITHER_ON_WRITE = 0x10A0,
SFC_SET_DITHER_ON_READ = 0x10A1,

SFC_GET_DITHER_INFO_COUNT = 0x10A2,
SFC_GET_DITHER_INFO = 0x10A3,

GetEmbedFileInfo = 0x10B0,

SetClipping = 0x10C0,
GetClipping = 0x10C1,

GetCueCount = 0x10CD,
GetCue = 0x10CE,
SetCue = 0x10CF,

GetInstrument = 0x10D0,
SetInstrument = 0x10D1,

GetLoopInfo = 0x10E0,

GetBroadcastInfo = 0x10F0,
SetBroadcastInfo = 0x10F1,

SFC_GET_CHANNEL_MAP_INFO = 0x1100,
SFC_SET_CHANNEL_MAP_INFO = 0x1101,

RawDataNeedsEndswap = 0x1110,

/* Support for Wavex Ambisonics Format */
WavexSetAmbisonic = 0x1200,
WavexGetAmbisonic = 0x1201,

/*
** RF64 files can be set so that on-close, writable files that have less
** than 4GB of data in them are converted to RIFF/WAV, as per EBU
** recommendations.
*/
Rf64AutoDowngrade = 0x1210,

SetVbrEncodingQuality = 0x1300,
SetCompressionLevel = 0x1301,

/* Cart Chunk support */
SetCartInfo = 0x1400,
GetCartInfo = 0x1401

/* Following commands for testing only. */
// SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001,

/*
** SFC_SET_ADD_* values are deprecated and will disappear at some
** time in the future. They are guaranteed to be here up to and
** including version 1.0.8 to avoid breakage of existing software.
** They currently do nothing and will continue to do nothing.
*/
// SFC_SET_ADD_DITHER_ON_WRITE = 0x1070,
// SFC_SET_ADD_DITHER_ON_READ = 0x1071
}
}
Loading

0 comments on commit 121aa4b

Please sign in to comment.