mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
bugfix for ape
This commit is contained in:
@@ -156,8 +156,8 @@ namespace APEDotNet {
|
|||||||
array<Int32,2>^ _sampleBuffer = gcnew array<Int32,2> (nBlocksRetrieved, 2);
|
array<Int32,2>^ _sampleBuffer = gcnew array<Int32,2> (nBlocksRetrieved, 2);
|
||||||
interior_ptr<Int32> pMyBuffer = &_sampleBuffer[0, 0];
|
interior_ptr<Int32> pMyBuffer = &_sampleBuffer[0, 0];
|
||||||
|
|
||||||
unsigned short * pAPEBuffer = (unsigned short *) pBuffer;
|
short * pAPEBuffer = (short *) pBuffer;
|
||||||
unsigned short * pAPEBufferEnd = (unsigned short *) pBuffer + 2 * nBlocksRetrieved;
|
short * pAPEBufferEnd = (short *) pBuffer + 2 * nBlocksRetrieved;
|
||||||
|
|
||||||
while (pAPEBuffer < pAPEBufferEnd) {
|
while (pAPEBuffer < pAPEBufferEnd) {
|
||||||
*(pMyBuffer++) = *(pAPEBuffer++);
|
*(pMyBuffer++) = *(pAPEBuffer++);
|
||||||
@@ -327,4 +327,39 @@ namespace APEDotNet {
|
|||||||
_initialized = true;
|
_initialized = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
BOOL GetMMXAvailable();
|
||||||
|
int CalculateDotProduct8(const short* pA, const short* pB, int nOrder);
|
||||||
|
};
|
||||||
|
|
||||||
|
public ref class SSE2Functions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SSE2Functions ()
|
||||||
|
{
|
||||||
|
_haveSSE2 = GetMMXAvailable();
|
||||||
|
}
|
||||||
|
int SumInts (short*a, short*b, int count)
|
||||||
|
{
|
||||||
|
if (_haveSSE2 && count == 8)
|
||||||
|
return CalculateDotProduct8(a, b, count);
|
||||||
|
int sum = 0;
|
||||||
|
for (int j = 0; j < count; j++)
|
||||||
|
sum += a[j] * b[j];
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
int SumInts (int*a, short*b, int count)
|
||||||
|
{
|
||||||
|
int sum = 0;
|
||||||
|
for (int j = 0; j < count; j++)
|
||||||
|
sum += a[j] * b[j];
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
bool _haveSSE2;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,8 +327,10 @@ namespace CUEToolsLib {
|
|||||||
|
|
||||||
copyCount = Math.Min(samplesNeeded, SamplesInBuffer);
|
copyCount = Math.Min(samplesNeeded, SamplesInBuffer);
|
||||||
|
|
||||||
APESamplesToFLACSamples(_sampleBuffer, _bufferOffset, buff, buffOffset,
|
|
||||||
copyCount, chanCount);
|
Array.Copy(_sampleBuffer, _bufferOffset * chanCount, buff, buffOffset * chanCount, copyCount * chanCount);
|
||||||
|
//APESamplesToFLACSamples(_sampleBuffer, _bufferOffset, buff, buffOffset,
|
||||||
|
// copyCount, chanCount);
|
||||||
|
|
||||||
samplesNeeded -= copyCount;
|
samplesNeeded -= copyCount;
|
||||||
buffOffset += copyCount;
|
buffOffset += copyCount;
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ namespace CUEToolsLib
|
|||||||
public bool decodeHDCD;
|
public bool decodeHDCD;
|
||||||
public bool wait750FramesForHDCD;
|
public bool wait750FramesForHDCD;
|
||||||
public bool createM3U;
|
public bool createM3U;
|
||||||
|
public bool createTOC;
|
||||||
public bool createCUEFileWhenEmbedded;
|
public bool createCUEFileWhenEmbedded;
|
||||||
public bool truncate4608ExtraSamples;
|
public bool truncate4608ExtraSamples;
|
||||||
public bool processPriorityIdle;
|
public bool processPriorityIdle;
|
||||||
@@ -272,6 +273,7 @@ namespace CUEToolsLib
|
|||||||
wait750FramesForHDCD = true;
|
wait750FramesForHDCD = true;
|
||||||
decodeHDCD = false;
|
decodeHDCD = false;
|
||||||
createM3U = false;
|
createM3U = false;
|
||||||
|
createTOC = false;
|
||||||
createCUEFileWhenEmbedded = false;
|
createCUEFileWhenEmbedded = false;
|
||||||
truncate4608ExtraSamples = true;
|
truncate4608ExtraSamples = true;
|
||||||
processPriorityIdle = true;
|
processPriorityIdle = true;
|
||||||
@@ -313,6 +315,7 @@ namespace CUEToolsLib
|
|||||||
sw.Save("Wait750FramesForHDCD", wait750FramesForHDCD);
|
sw.Save("Wait750FramesForHDCD", wait750FramesForHDCD);
|
||||||
sw.Save("DecodeHDCD", decodeHDCD);
|
sw.Save("DecodeHDCD", decodeHDCD);
|
||||||
sw.Save("CreateM3U", createM3U);
|
sw.Save("CreateM3U", createM3U);
|
||||||
|
sw.Save("CreateTOC", createTOC);
|
||||||
sw.Save("CreateCUEFileWhenEmbedded", createCUEFileWhenEmbedded);
|
sw.Save("CreateCUEFileWhenEmbedded", createCUEFileWhenEmbedded);
|
||||||
sw.Save("Truncate4608ExtraSamples", truncate4608ExtraSamples);
|
sw.Save("Truncate4608ExtraSamples", truncate4608ExtraSamples);
|
||||||
sw.Save("ProcessPriorityIdle", processPriorityIdle);
|
sw.Save("ProcessPriorityIdle", processPriorityIdle);
|
||||||
@@ -354,6 +357,7 @@ namespace CUEToolsLib
|
|||||||
wait750FramesForHDCD = sr.LoadBoolean("Wait750FramesForHDCD") ?? true;
|
wait750FramesForHDCD = sr.LoadBoolean("Wait750FramesForHDCD") ?? true;
|
||||||
decodeHDCD = sr.LoadBoolean("DecodeHDCD") ?? false;
|
decodeHDCD = sr.LoadBoolean("DecodeHDCD") ?? false;
|
||||||
createM3U = sr.LoadBoolean("CreateM3U") ?? false;
|
createM3U = sr.LoadBoolean("CreateM3U") ?? false;
|
||||||
|
createTOC = sr.LoadBoolean("CreateTOC") ?? false;
|
||||||
createCUEFileWhenEmbedded = sr.LoadBoolean("CreateCUEFileWhenEmbedded") ?? false;
|
createCUEFileWhenEmbedded = sr.LoadBoolean("CreateCUEFileWhenEmbedded") ?? false;
|
||||||
truncate4608ExtraSamples = sr.LoadBoolean("Truncate4608ExtraSamples") ?? true;
|
truncate4608ExtraSamples = sr.LoadBoolean("Truncate4608ExtraSamples") ?? true;
|
||||||
processPriorityIdle = sr.LoadBoolean("ProcessPriorityIdle") ?? true;
|
processPriorityIdle = sr.LoadBoolean("ProcessPriorityIdle") ?? true;
|
||||||
@@ -988,6 +992,25 @@ namespace CUEToolsLib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void WriteTOC(string path)
|
||||||
|
{
|
||||||
|
StreamWriter sw = new StreamWriter(path, false, CUESheet.Encoding);
|
||||||
|
WriteTOC(sw);
|
||||||
|
sw.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WriteTOC(TextWriter sw)
|
||||||
|
{
|
||||||
|
uint trackOffset = 150;
|
||||||
|
for (int iTrack = 0; iTrack < TrackCount; iTrack++)
|
||||||
|
{
|
||||||
|
trackOffset += _tracks[iTrack].IndexLengths[0];
|
||||||
|
WriteLine(sw, 0, "\t" + trackOffset);
|
||||||
|
for (int iIndex = 1; iIndex <= _tracks[iTrack].LastIndex; iIndex++)
|
||||||
|
trackOffset += _tracks[iTrack].IndexLengths[iIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Write(string path, CUEStyle style) {
|
public void Write(string path, CUEStyle style) {
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
Write(sw, style);
|
Write(sw, style);
|
||||||
@@ -1367,6 +1390,8 @@ namespace CUEToolsLib
|
|||||||
sw.WriteLine("Assuming a data track was present, length {0}.", General.TimeToString(_dataTrackLength.Value));
|
sw.WriteLine("Assuming a data track was present, length {0}.", General.TimeToString(_dataTrackLength.Value));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (_cddbDiscIdTag != null && _accurateRipId.Split('-')[2].ToUpper() != _cddbDiscIdTag.ToUpper())
|
||||||
|
sw.WriteLine("CDDBId mismatch: {0} vs {1}", _cddbDiscIdTag.ToUpper(), _accurateRipId.Split('-')[2].ToUpper());
|
||||||
if (_minDataTrackLength.HasValue)
|
if (_minDataTrackLength.HasValue)
|
||||||
sw.WriteLine("Data track was probably present, length {0}-{1}.", General.TimeToString(_minDataTrackLength.Value), General.TimeToString(_minDataTrackLength.Value + 74));
|
sw.WriteLine("Data track was probably present, length {0}-{1}.", General.TimeToString(_minDataTrackLength.Value), General.TimeToString(_minDataTrackLength.Value + 74));
|
||||||
if (_accurateRipIdActual != _accurateRipId)
|
if (_accurateRipIdActual != _accurateRipId)
|
||||||
@@ -1608,6 +1633,12 @@ namespace CUEToolsLib
|
|||||||
GenerateAccurateRipLog(sw);
|
GenerateAccurateRipLog(sw);
|
||||||
sw.Close();
|
sw.Close();
|
||||||
}
|
}
|
||||||
|
if (_config.createTOC)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(dir))
|
||||||
|
Directory.CreateDirectory(dir);
|
||||||
|
WriteTOC(Path.ChangeExtension(_cuePath, ".toc"));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1704,6 +1735,12 @@ namespace CUEToolsLib
|
|||||||
GenerateAccurateRipLog(sw);
|
GenerateAccurateRipLog(sw);
|
||||||
sw.Close();
|
sw.Close();
|
||||||
}
|
}
|
||||||
|
if (_config.createTOC)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(dir))
|
||||||
|
Directory.CreateDirectory(dir);
|
||||||
|
WriteTOC(Path.ChangeExtension(_cuePath, ".toc"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user