Refactoring codecs infrastructure:

AudioWriterSettings passed to IAdioDest constructors now
AudioWriterSettings now includes AudioPCMConfig
This commit is contained in:
Grigory Chudov
2013-04-07 20:41:58 -04:00
parent b44e482dee
commit 9670c6c891
43 changed files with 652 additions and 723 deletions

View File

@@ -10,6 +10,7 @@ namespace CUETools.DSP.Mixer
private long samplePos;
private MixingBuffer mixbuff;
private float volume;
private AudioEncoderSettings m_settings;
public long Position
{
@@ -26,18 +27,8 @@ namespace CUETools.DSP.Mixer
{
get
{
return new AudioEncoderSettings();
return m_settings;
}
set
{
if (value != null && value.GetType() != typeof(AudioEncoderSettings))
throw new Exception("Unsupported options " + value);
}
}
public AudioPCMConfig PCM
{
get { return mixer.PCM; }
}
public float Volume
@@ -50,6 +41,7 @@ namespace CUETools.DSP.Mixer
public MixingWriter(MixingSource mixer, int iSource)
{
this.m_settings = new AudioEncoderSettings(mixer.PCM);
this.mixer = mixer;
this.iSource = iSource;
this.samplePos = 0;
@@ -76,7 +68,7 @@ namespace CUETools.DSP.Mixer
if (mixbuff != null)
{
if (mixbuff.source[iSource].Length < mixbuff.source[iSource].Size)
AudioSamples.MemSet(mixbuff.source[iSource].Bytes, 0, mixbuff.source[iSource].Length * PCM.BlockAlign, (mixbuff.source[iSource].Size - mixbuff.source[iSource].Length) * PCM.BlockAlign);
AudioSamples.MemSet(mixbuff.source[iSource].Bytes, 0, mixbuff.source[iSource].Length * Settings.PCM.BlockAlign, (mixbuff.source[iSource].Size - mixbuff.source[iSource].Length) * Settings.PCM.BlockAlign);
mixer.UnlockEmptyBuffer(mixbuff, iSource, volume);
mixbuff = null;
}
@@ -84,7 +76,7 @@ namespace CUETools.DSP.Mixer
public void Write(AudioBuffer buff)
{
int bs = PCM.BlockAlign;
int bs = Settings.PCM.BlockAlign;
int buff_offs = 0;
while (buff_offs < buff.Length)