Code cleanup; Reader classes renamed to Decoders, Writers to Encoders, every Decoder must have a corresponding Settings class now just like Encoders. UserDefinedEncoders renamed to CommandLineEncoders, etc.

This commit is contained in:
Grigory Chudov
2018-03-23 20:26:28 -04:00
parent 16fccfe5c9
commit ca8bb2fff6
22 changed files with 1301 additions and 1292 deletions

View File

@@ -0,0 +1,61 @@
namespace CUETools.Codecs.NULL
{
public class AudioDecoder : IAudioSource
{
private long _sampleOffset, _sampleCount;
private AudioPCMConfig pcm;
private int _sampleVal;
public AudioDecoderSettings Settings { get { return null; } }
public long Length
{
get { return _sampleCount; }
}
public long Remaining
{
get { return _sampleCount - _sampleOffset; }
}
public long Position
{
get { return _sampleOffset; }
set { _sampleOffset = value; }
}
public AudioPCMConfig PCM { get { return pcm; } }
public string Path { get { return null; } }
public AudioDecoder(AudioPCMConfig pcm, long sampleCount, int sampleVal)
{
this._sampleVal = sampleVal;
this._sampleOffset = 0;
this._sampleCount = sampleCount;
this.pcm = pcm;
}
public AudioDecoder(long sampleCount)
: this(AudioPCMConfig.RedBook, sampleCount, 0)
{
}
public int Read(AudioBuffer buff, int maxLength)
{
buff.Prepare(this, maxLength);
int[,] samples = buff.Samples;
for (int i = 0; i < buff.Length; i++)
for (int j = 0; j < PCM.ChannelCount; j++)
samples[i, j] = _sampleVal;
_sampleOffset += buff.Length;
return buff.Length;
}
public void Close()
{
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
namespace CUETools.Codecs.NULL
{
public class AudioEncoder : IAudioDest
{
AudioEncoderSettings m_settings;
public AudioEncoder(string path, AudioEncoderSettings settings)
{
m_settings = settings;
}
public void Close()
{
}
public void Delete()
{
}
public long FinalSampleCount
{
set { }
}
public AudioEncoderSettings Settings => m_settings;
public void Write(AudioBuffer buff)
{
}
public string Path => null;
}
}