DSF2FLAC
|
#include <dsd_sample_reader.h>
dsf2flac - http://code.google.com/p/dsf2flac/
A file conversion tool for translating dsf dsd audio files into flac pcm audio files.
Copyright (c) 2013 by respective authors.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Acknowledgements
Many thanks to the following authors and projects whose work has greatly helped the development of this tool.
Sebastian Gesemann - dsd2pcm (http://code.google.com/p/dsd2pcm/) SACD Ripper (http://code.google.com/p/sacd-ripper/) Maxim V.Anisiutkin - foo_input_sacd (http://sourceforge.net/projects/sacddecoder/files/) Vladislav Goncharov - foo_input_sacd_hq (http://vladgsound.wordpress.com) Jesus R - www.sonore.us dsd_sample_reader.cpp
Implementation of class dsdSampleReader.
Abstract class defining anything which reads dsd samples from something. If someone feels like it they could write an implementation of this class and allow this convertor to work with other dsd sources (e.g. dsdiff files). dsdSampleReader::dsdSampleReader()
Constructor!
dsdSampleReader::~dsdSampleReader | ( | ) | [virtual] |
dsdSampleReader::dsdSampleReader()
Destructor, free the circular buffers.
void dsdSampleReader::allocateBuffer | ( | ) | [protected] |
void dsdSampleReader::allocateBuffer()
Protected function, allocate the buffer. MUST be called by implementors on construction.
void dsdSampleReader::clearBuffer | ( | ) | [protected] |
void dsdSampleReader::clearBuffer()
Protected function, clear the buffer - fill with idleSamples MUST be called by implementors on construction.
boost::circular_buffer< dsf2flac_uint8 > * dsdSampleReader::getBuffer | ( | ) |
boost::circular_buffer<dsf2flac_uint8>* dsdSampleReader::getBuffer()
Returns the circular buffers, one per channel in an array. When step() is called a new 1byte (8 dsd bits) sample is added to the start of the buffer and one is removed from the end. If you grab this buffer you can easily do some fir filtering by multiplying the contents by an impulse response, call step() to shift to the next dsd sample and do the same!
dsf2flac_uint32 dsdSampleReader::getBufferLength()
Returns the current length of the buffers.
std::string dsdSampleReader::getErrorMsg | ( | ) |
bool dsdSampleReader::getErrorMsg()
Returns a message describing the last error which caused the reader to become invalid.
ID3_Tag dsdSampleReader::getID3Tag | ( | ) | [inline] |
virtual ID3_Tag dsdSampleReader::getID3Tag | ( | dsf2flac_uint32 | trackNum | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader, and dsfFileReader.
virtual dsf2flac_uint8 dsdSampleReader::getIdleSample | ( | ) | [inline, virtual] |
virtual dsf2flac_int64 dsdSampleReader::getLength | ( | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader, and dsfFileReader.
dsf2flac_float64 dsdSampleReader::getLengthInSeconds()
Return the total length of the reader in seconds
virtual dsf2flac_uint32 dsdSampleReader::getNumChannels | ( | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader, and dsfFileReader.
virtual dsf2flac_uint32 dsdSampleReader::getNumTracks | ( | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader.
dsf2flac_int64 dsdSampleReader::getPosition | ( | ) | [inline] |
dsf2flac_int64 dsdSampleReader::getPosition | ( | dsf2flac_int64 | bufferPos | ) | [inline] |
dsf2flac_float64 dsdSampleReader::getPositionAsPercent()
Return the current position as a percent of the reader length.
dsf2flac_float64 dsdSampleReader::getPositionInSeconds()
Return the current position in seconds.
virtual dsf2flac_uint32 dsdSampleReader::getSamplingFreq | ( | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader, and dsfFileReader.
virtual dsf2flac_uint64 dsdSampleReader::getTrackEnd | ( | dsf2flac_uint32 | trackNum | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader.
virtual dsf2flac_uint64 dsdSampleReader::getTrackStart | ( | dsf2flac_uint32 | trackNum | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader.
bool dsdSampleReader::isValid | ( | ) |
bool dsdSampleReader::isValid()
Return false if the reader is invalid (format/file error for example).
static char* dsdSampleReader::latin1_to_utf8 | ( | char * | latin1 | ) | [static] |
virtual bool dsdSampleReader::msbIsPlayedFirst | ( | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader, and dsfFileReader.
void dsdSampleReader::resizeBuffer | ( | ) | [protected] |
void dsdSampleReader::resizeBuffer()
Protected function, resize the buffer and then clear the buffer. MUST be called by implementors on construction.
virtual void dsdSampleReader::rewind | ( | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader, and dsfFileReader.
virtual bool dsdSampleReader::samplesAvailable | ( | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader, and dsfFileReader.
void dsdSampleReader::setBufferLength(dsf2flac_uint32 b)
Sets the length of the buffers. WARNING! calling this will cause the dsd reader to be rewound to the beginning and the buffer will be filled by getIdleSample();
virtual bool dsdSampleReader::step | ( | ) | [inline, virtual] |
Reimplemented in dsdiffFileReader, and dsfFileReader.
dsf2flac_uint32 dsdSampleReader::bufferLength [private] |
boost::circular_buffer<dsf2flac_uint8>* dsdSampleReader::circularBuffers [protected] |
std::string dsdSampleReader::errorMsg [protected] |
bool dsdSampleReader::isBufferAllocated [private] |
dsf2flac_int64 dsdSampleReader::posMarker [protected] |
dsf2flac_uint32 dsdSampleReader::samplesPerChar [protected] |
bool dsdSampleReader::valid [protected] |