pcm/Export: add CalcOutputSampleRate(), CalcInputSampleRate()

Prepare for DSD sample rate fixups.
This commit is contained in:
Max Kellermann
2017-01-10 23:48:26 +01:00
parent 142fdc8d86
commit c143adba91
4 changed files with 51 additions and 5 deletions

View File

@@ -98,6 +98,18 @@ PcmExport::GetFrameSize(const AudioFormat &audio_format) const
return audio_format.GetFrameSize();
}
unsigned
PcmExport::Params::CalcOutputSampleRate(unsigned sample_rate) const
{
return sample_rate;
}
unsigned
PcmExport::Params::CalcInputSampleRate(unsigned sample_rate) const
{
return sample_rate;
}
ConstBuffer<void>
PcmExport::Export(ConstBuffer<void> data)
{

View File

@@ -41,6 +41,21 @@ struct PcmExport {
bool shift8 = false;
bool pack24 = false;
bool reverse_endian = false;
/**
* Calculate the output sample rate, given a specific input
* sample rate. Usually, both are the same; however, with
* DSD_U32, four input bytes (= 4 * 8 bits) are combined to
* one output word (32 bits), dividing the sample rate by 4.
*/
gcc_pure
unsigned CalcOutputSampleRate(unsigned input_sample_rate) const;
/**
* The inverse of CalcOutputSampleRate().
*/
gcc_pure
unsigned CalcInputSampleRate(unsigned output_sample_rate) const;
};
/**