Skip to content

Commit 0eca94b

Browse files
committed
Initial upload to GitHub
1 parent 980cf61 commit 0eca94b

30 files changed

+4824
-0
lines changed

AssemblyInfo.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
4+
// General Information about an assembly is controlled through the following
5+
// set of attributes. Change these attribute values to modify the information
6+
// associated with an assembly.
7+
8+
// TODO: Review the values of the assembly attributes
9+
10+
[assembly: AssemblyTitle("")]
11+
[assembly: AssemblyDescription("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("")]
14+
[assembly: AssemblyCopyright("")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Revision
24+
// Build Number
25+
//
26+
// You can specify all the values or you can default the Revision and Build Numbers
27+
// by using the '*' as shown below:
28+
29+
[assembly: AssemblyVersion("1.0.*")]
30+
31+
//
32+
// In order to sign your assembly you must specify a key to use. Refer to the
33+
// Microsoft .NET Framework documentation for more information on assembly signing.
34+
//
35+
// Use the attributes below to control which key is used for signing.
36+
//
37+
// Notes:
38+
// (*) If no key is specified, the assembly is not signed.
39+
// (*) KeyName refers to a key that has been installed in the Crypto Service
40+
// Provider (CSP) on your machine. KeyFile refers to a file which contains
41+
// a key.
42+
// (*) If the KeyFile and the KeyName values are both specified, the
43+
// following processing occurs:
44+
// (1) If the KeyName can be found in the CSP, that key is used.
45+
// (2) If the KeyName does not exist and the KeyFile does exist, the key
46+
// in the KeyFile is installed into the CSP and used.
47+
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48+
// When specifying the KeyFile, the location of the KeyFile should be
49+
// relative to the project output directory which is
50+
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
51+
// located in the project directory, you would specify the AssemblyKeyFile
52+
// attribute as [assembly: AssemblyKeyFile("..\..\mykey.snk")]
53+
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54+
// documentation for more information on this.
55+
//
56+
57+
[assembly: AssemblyConfiguration("")]
58+
[assembly: AssemblyDelaySign(false)]
59+
[assembly: AssemblyKeyFile("")]
60+
[assembly: AssemblyKeyName("")]
61+
62+

BitsUtils.cs

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
using System;
2+
/*
3+
** BitsUtils.cs
4+
**
5+
** Copyright (c) 2010-2016 Peter McQuillan
6+
**
7+
** All Rights Reserved.
8+
**
9+
** Distributed under the BSD Software License (see license.txt)
10+
***/
11+
12+
class BitsUtils
13+
{
14+
internal static Bitstream getbit(Bitstream bs)
15+
{
16+
if (bs.bc > 0)
17+
{
18+
bs.bc--;
19+
}
20+
else
21+
{
22+
bs.ptr++;
23+
bs.buf_index++;
24+
bs.bc = 7;
25+
26+
if (bs.ptr == bs.end)
27+
{
28+
// wrap call here
29+
bs = bs_read(bs);
30+
}
31+
bs.sr = (bs.buf[bs.buf_index] & 0xff);
32+
}
33+
34+
bs.bitval = (int)(bs.sr & 1);
35+
bs.sr = bs.sr >> 1;
36+
return bs;
37+
}
38+
39+
internal static long getbits(int nbits, Bitstream bs)
40+
{
41+
int uns_buf;
42+
long retval;
43+
44+
while ((nbits) > bs.bc)
45+
{
46+
bs.ptr++;
47+
bs.buf_index++;
48+
49+
if (bs.ptr == bs.end)
50+
{
51+
bs = bs_read(bs);
52+
}
53+
uns_buf = (int) (bs.buf[bs.buf_index] & 0xff);
54+
bs.sr = bs.sr | (uns_buf << bs.bc); // values in buffer must be unsigned
55+
56+
bs.sr = bs.sr & 0xFFFFFFFFL; // sr is an unsigned 32 bit variable
57+
58+
bs.bc += 8;
59+
}
60+
61+
retval = bs.sr;
62+
63+
if (bs.bc > 32)
64+
{
65+
bs.bc -= (nbits);
66+
bs.sr = (bs.buf[bs.buf_index] & 0xff) >> (8 - bs.bc);
67+
}
68+
else
69+
{
70+
bs.bc -= (nbits);
71+
bs.sr >>= (nbits);
72+
}
73+
74+
return (retval);
75+
}
76+
77+
internal static Bitstream bs_open_read(byte[] stream, short buffer_start, short buffer_end, System.IO.BinaryReader file, int file_bytes, int passed)
78+
{
79+
// CLEAR (*bs);
80+
Bitstream bs = new Bitstream();
81+
82+
bs.buf = stream;
83+
bs.buf_index = buffer_start;
84+
bs.end = buffer_end;
85+
bs.sr = 0;
86+
bs.bc = 0;
87+
88+
if (passed != 0)
89+
{
90+
bs.ptr = (short) (bs.end - 1);
91+
bs.file_bytes = file_bytes;
92+
bs.file = file;
93+
}
94+
else
95+
{
96+
/* Strange to set an index to -1, but the very first call to getbit will iterate this */
97+
bs.buf_index = - 1;
98+
bs.ptr = (short) (- 1);
99+
}
100+
101+
return bs;
102+
}
103+
104+
internal static Bitstream bs_read(Bitstream bs)
105+
{
106+
if (bs.file_bytes > 0)
107+
{
108+
int bytes_to_read;
109+
int bytes_read;
110+
111+
bytes_to_read = Defines.BITSTREAM_BUFFER_SIZE;
112+
113+
if (bytes_to_read > bs.file_bytes)
114+
bytes_to_read = bs.file_bytes;
115+
116+
try
117+
{
118+
bytes_read = bs.file.BaseStream.Read(bs.buf, 0, bytes_to_read);
119+
120+
bs.buf_index = 0;
121+
}
122+
catch (System.Exception e)
123+
{
124+
System.Console.Error.WriteLine("Big error while reading file: " + e);
125+
bytes_read = 0;
126+
}
127+
128+
if (bytes_read > 0)
129+
{
130+
bs.end = (short) (bytes_read);
131+
bs.file_bytes -= bytes_read;
132+
}
133+
else
134+
{
135+
for (int i = 0; i < Defines.BITSTREAM_BUFFER_SIZE; i++)
136+
{
137+
bs.buf[i] = unchecked((byte)-1);
138+
}
139+
bs.error = 1;
140+
}
141+
}
142+
else
143+
{
144+
bs.error = 1;
145+
146+
for (int i = 0; i < Defines.BITSTREAM_BUFFER_SIZE; i++)
147+
{
148+
bs.buf[i] = unchecked((byte)-1);
149+
}
150+
}
151+
152+
153+
bs.ptr = 0;
154+
bs.buf_index = 0;
155+
156+
return bs;
157+
}
158+
}

Bitstream.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
/*
3+
** Bitstream.cs
4+
**
5+
** Copyright (c) 2010-2016 Peter McQuillan
6+
**
7+
** All Rights Reserved.
8+
**
9+
** Distributed under the BSD Software License (see license.txt)
10+
***/
11+
12+
class Bitstream
13+
{
14+
internal short end, ptr; // was uchar in c
15+
internal long sr;
16+
internal int file_bytes;
17+
internal int error, bc;
18+
internal System.IO.BinaryReader file;
19+
internal int bitval = 0;
20+
internal byte[] buf = new byte[Defines.BITSTREAM_BUFFER_SIZE];
21+
internal int buf_index = 0;
22+
}

CSharpWavPackDecoder.application

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<assemblyIdentity name="CSharpWavPackDecoder.application" version="1.1.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
4+
<description asmv2:publisher="CSharpWavPackDecoder" asmv2:product="CSharpWavPackDecoder" xmlns="urn:schemas-microsoft-com:asm.v1" />
5+
<deployment install="true" mapFileExtensions="true" />
6+
<dependency>
7+
<dependentAssembly dependencyType="install" codebase="CSharpWavPackDecoder.exe.manifest" size="6087">
8+
<assemblyIdentity name="CSharpWavPackDecoder.exe" version="1.1.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
9+
<hash>
10+
<dsig:Transforms>
11+
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
12+
</dsig:Transforms>
13+
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
14+
<dsig:DigestValue>cB9XwrUuuay8pS5bD6VZeprNw3I=</dsig:DigestValue>
15+
</hash>
16+
</dependentAssembly>
17+
</dependency>
18+
</asmv1:assembly>

0 commit comments

Comments
 (0)