DSF2FLAC
|
Abstract class defining anything which reads dsd samples from something. More...
#include <dsd_sample_reader.h>
Public Member Functions | |
DsdSampleReader () | |
Constructor. | |
virtual | ~DsdSampleReader () |
Deconstructor. | |
bool | isValid () |
Return false if the reader is invalid (format/file error for example). | |
std::string | getErrorMsg () |
Returns a message explaining why the reader is invalid. | |
virtual dsf2flac_uint32 | getSamplingFreq ()=0 |
Returns the DSD sampling rate of this reader (Hz). | |
virtual dsf2flac_uint32 | getNumChannels ()=0 |
Returns the number of channels in the reader. | |
virtual dsf2flac_int64 | getLength ()=0 |
Returns the total number of DSD samples in the reader. | |
dsf2flac_float64 | getLengthInSeconds () |
Returns the total length of the reader in seconds. | |
virtual dsf2flac_uint32 | getNumTracks () |
Returns the number of audio tracks in the reader. | |
virtual dsf2flac_uint64 | getTrackStart (dsf2flac_uint32 trackNum) |
Returns the start position of the specified track. | |
virtual dsf2flac_uint64 | getTrackEnd (dsf2flac_uint32 trackNum) |
Returns the end position of the specified track. | |
virtual bool | step ()=0 |
Step the reader forward by 8 DSD samples. | |
virtual bool | samplesAvailable () |
Returns false if there are no more samples left in the reader. | |
dsf2flac_int64 | getPosition () |
Return the current position of the reader in DSD samples. | |
dsf2flac_float64 | getPositionInSeconds () |
Return the current position of the reader in seconds. | |
dsf2flac_float64 | getPositionAsPercent () |
Return the current position of the reader as a percent of the total length. | |
virtual void | rewind ()=0 |
Set the reader position back to the start of the DSD data. | |
boost::circular_buffer < dsf2flac_uint8 > * | getBuffer () |
Returns an array of circular buffers, one for each track. | |
dsf2flac_uint32 | getBufferLength () |
Returns the length of the buffers (the number of uint8 numbers, NOT the number of DSD samples). | |
bool | setBufferLength (dsf2flac_uint32 bufferLength) |
Sets the length of the buffers (the number of uint8 numbers, NOT the number of DSD samples). | |
virtual bool | msbIsPlayedFirst ()=0 |
Describes the order that the samples are packed into the int8 buffer entries. | |
ID3_Tag | getID3Tag () |
Return the ID3 tag of the first track in this reader. | |
virtual ID3_Tag | getID3Tag (dsf2flac_uint32 trackNum) |
Return the ID3 tag corresponding to the provided track number. | |
virtual dsf2flac_uint8 | getIdleSample () |
Return the idle tone used by this reader, by default the buffers are populated with this idle tone. | |
Static Public Member Functions | |
static char * | latin1_to_utf8 (char *latin1) |
convert latin1 encoded char into utf8. | |
Protected Member Functions | |
void | allocateBuffer () |
Allocates the circular buffers. | |
void | clearBuffer () |
Clear the buffers and fill with idleSample. |
Abstract class defining anything which reads dsd samples from something.
Constructor.
DsdSampleReader::~DsdSampleReader | ( | ) | [virtual] |
Deconstructor.
void DsdSampleReader::allocateBuffer | ( | ) | [protected] |
Allocates the circular buffers.
Child classes need to call this once they know the number of channels!
void DsdSampleReader::clearBuffer | ( | ) | [protected] |
Clear the buffers and fill with idleSample.
boost::circular_buffer< dsf2flac_uint8 > * DsdSampleReader::getBuffer | ( | ) |
Returns an array of circular buffers, one for each track.
Each circular buffer contains getBufferLength() uint8 numbers. The DSD samples are packed into these uint8 numbers. The next uint8 set of 8 DSD samples is added into position 0 when step() is called. By default the buffer is filled with getIdleSample().
dsf2flac_uint32 DsdSampleReader::getBufferLength | ( | ) |
Returns the length of the buffers (the number of uint8 numbers, NOT the number of DSD samples).
std::string DsdSampleReader::getErrorMsg | ( | ) |
Returns a message explaining why the reader is invalid.
ID3_Tag DsdSampleReader::getID3Tag | ( | ) | [inline] |
Return the ID3 tag of the first track in this reader.
Useful for when there is only a single track in the reader.
virtual ID3_Tag DsdSampleReader::getID3Tag | ( | dsf2flac_uint32 | trackNum | ) | [inline, virtual] |
Return the ID3 tag corresponding to the provided track number.
Reimplemented in DsdiffFileReader, and DsfFileReader.
virtual dsf2flac_uint8 DsdSampleReader::getIdleSample | ( | ) | [inline, virtual] |
Return the idle tone used by this reader, by default the buffers are populated with this idle tone.
virtual dsf2flac_int64 DsdSampleReader::getLength | ( | ) | [pure virtual] |
Returns the total number of DSD samples in the reader.
Implemented in DsdiffFileReader, and DsfFileReader.
dsf2flac_float64 DsdSampleReader::getLengthInSeconds | ( | ) |
Returns the total length of the reader in seconds.
virtual dsf2flac_uint32 DsdSampleReader::getNumChannels | ( | ) | [pure virtual] |
Returns the number of channels in the reader.
Implemented in DsdiffFileReader, and DsfFileReader.
virtual dsf2flac_uint32 DsdSampleReader::getNumTracks | ( | ) | [inline, virtual] |
Returns the number of audio tracks in the reader.
Reimplemented in DsdiffFileReader.
dsf2flac_int64 DsdSampleReader::getPosition | ( | ) | [inline] |
Return the current position of the reader in DSD samples.
This is the position of the first entry in the circular buffers.
dsf2flac_float64 DsdSampleReader::getPositionAsPercent | ( | ) |
Return the current position of the reader as a percent of the total length.
dsf2flac_float64 DsdSampleReader::getPositionInSeconds | ( | ) |
Return the current position of the reader in seconds.
virtual dsf2flac_uint32 DsdSampleReader::getSamplingFreq | ( | ) | [pure virtual] |
Returns the DSD sampling rate of this reader (Hz).
Implemented in DsdiffFileReader, and DsfFileReader.
virtual dsf2flac_uint64 DsdSampleReader::getTrackEnd | ( | dsf2flac_uint32 | trackNum | ) | [inline, virtual] |
Returns the end position of the specified track.
Reimplemented in DsdiffFileReader.
virtual dsf2flac_uint64 DsdSampleReader::getTrackStart | ( | dsf2flac_uint32 | trackNum | ) | [inline, virtual] |
Returns the start position of the specified track.
Reimplemented in DsdiffFileReader.
bool DsdSampleReader::isValid | ( | ) |
Return false if the reader is invalid (format/file error for example).
static char* DsdSampleReader::latin1_to_utf8 | ( | char * | latin1 | ) | [static] |
convert latin1 encoded char into utf8.
virtual bool DsdSampleReader::msbIsPlayedFirst | ( | ) | [pure virtual] |
Describes the order that the samples are packed into the int8 buffer entries.
Implemented in DsdiffFileReader, and DsfFileReader.
virtual void DsdSampleReader::rewind | ( | ) | [pure virtual] |
Set the reader position back to the start of the DSD data.
Note that child classes implementing this method must call clearBuffer();
Implemented in DsdiffFileReader, and DsfFileReader.
virtual bool DsdSampleReader::samplesAvailable | ( | ) | [inline, virtual] |
Returns false if there are no more samples left in the reader.
Reimplemented in DsdiffFileReader, and DsfFileReader.
bool DsdSampleReader::setBufferLength | ( | dsf2flac_uint32 | bufferLength | ) |
Sets the length of the buffers (the number of uint8 numbers, NOT the number of DSD samples).
Note that this will cause rewind() to be called.
virtual bool DsdSampleReader::step | ( | ) | [pure virtual] |
Step the reader forward by 8 DSD samples.
This causes the next 8 DSD samples to be added into the front of the circular buffers (one uint8).
Implemented in DsdiffFileReader, and DsfFileReader.