DSF2FLAC
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions
DsdiffFileReader Class Reference

This class extends dsdSampleReader providing access to dsf samples and other info from dsdff files. More...

#include <dsdiff_file_reader.h>

Inheritance diagram for DsdiffFileReader:
DsdSampleReader

List of all members.

Public Member Functions

 DsdiffFileReader (char *filePath)
 Class constructor.
virtual ~DsdiffFileReader ()
 Class destructor.
bool step ()
 Step the reader forward by 8 DSD samples.
void rewind ()
 Set the reader position back to the start of the DSD data.
dsf2flac_int64 getLength ()
 Returns the total number of DSD samples in the reader.
dsf2flac_uint32 getNumChannels ()
 Returns the number of channels in the reader.
dsf2flac_uint32 getSamplingFreq ()
 Returns the DSD sampling rate of this reader (Hz).
bool msbIsPlayedFirst ()
 Describes the order that the samples are packed into the int8 buffer entries.
bool samplesAvailable ()
 Returns false if there are no more samples left in the reader.
ID3_Tag getID3Tag (dsf2flac_uint32 trackNum)
 Return the ID3 tag corresponding to the provided track number.
dsf2flac_uint32 getNumTracks ()
 Returns the number of audio tracks in the reader.
dsf2flac_uint64 getTrackStart (dsf2flac_uint32 trackNum)
 Returns the start position of the specified track.
dsf2flac_uint64 getTrackEnd (dsf2flac_uint32 trackNum)
 Returns the end position of the specified track.
void dispFileInfo ()
 Can be called to display some useful info to stdout.
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.
dsf2flac_float64 getLengthInSeconds ()
 Returns the total length of the reader in seconds.
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.
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).
ID3_Tag getID3Tag ()
 Return the ID3 tag of the first track in this reader.
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.

Private Member Functions

void allocateSampleBuffer ()
 Allocate the buffer to hold samples.
bool readNextBlock ()
 Read the next block of samples into the buffer.
void processTracks ()
 Finds the number, start and end points of the tracks in the file.
bool readChunkHeader (dsf2flac_int8 *ident, dsf2flac_uint64 chunkStart)
 A little helper to read chunk headers info.
bool readChunkHeader (dsf2flac_int8 *ident, dsf2flac_uint64 chunkStart, dsf2flac_uint64 *chunkSz)
 A little helper to read chunk headers info.
bool readChunk_FRM8 (dsf2flac_uint64 chunkStart)
 read data from a FRM8 chunk
bool readChunk_FVER (dsf2flac_uint64 chunkStart)
 read data from a FVER chunk
bool readChunk_PROP (dsf2flac_uint64 chunkStart)
 read data from a PROP chunk
bool readChunk_FS (dsf2flac_uint64 chunkStart)
 read data from a FS chunk
bool readChunk_CHNL (dsf2flac_uint64 chunkStart)
 read data from a CHNL chunk
bool readChunk_CMPR (dsf2flac_uint64 chunkStart)
 read data from a CMPR chunk
bool readChunk_ABSS (dsf2flac_uint64 chunkStart)
 read data from a ABSS chunk
bool readChunk_DSD (dsf2flac_uint64 chunkStart)
 read data from a DSD chunk
bool readChunk_DST (dsf2flac_uint64 chunkStart)
 read data from a DST chunk
bool readChunk_DSTF (dsf2flac_uint64 chunkStart)
 read data from a DSTF chunk
bool readChunk_COMT (dsf2flac_uint64 chunkStart)
 read data from a COMT chunk
bool readChunk_LSCO (dsf2flac_uint64 chunkStart)
 read data from a LSCO chunk
bool readChunk_ID3 (dsf2flac_uint64 chunkStart)
 read data from a ID3 chunk
bool readChunk_DIIN (dsf2flac_uint64 chunkStart)
 read data from a DIIN chunk
bool readChunk_EMID (dsf2flac_uint64 chunkStart)
 read data from a EMID chunk
bool readChunk_MARK (dsf2flac_uint64 chunkStart)
 read data from a MARK chunk
bool readChunk_DSTI (dsf2flac_uint64 chunkStart)
 read data from a DSTI chunk
bool readChunk_FRTE (dsf2flac_uint64 chunkStart)
 read data from a FRTE chunk
void dispComment (DsdiffComment c)
 Can be called to display a DsdiffComment to stdout.
void dispMarker (DsdiffMarker m)
 Can be called to display DsdiffMarker marker info to stdout.

Detailed Description

This class extends dsdSampleReader providing access to dsf samples and other info from dsdff files.

Editied master files are supported, as is the undocumented ID3 chunk. DST compression is also supported.


Constructor & Destructor Documentation

DsdiffFileReader::DsdiffFileReader ( char *  filePath)

Class constructor.

filePath must be a valid dsdff file location. If there is an issue reading or loading the file then isValid() will be false.

Class destructor.

Closes the file and frees the internal buffers.


Member Function Documentation

void DsdSampleReader::allocateBuffer ( ) [protected, inherited]

Allocates the circular buffers.

Child classes need to call this once they know the number of channels!

Allocate the buffer to hold samples.

void DsdSampleReader::clearBuffer ( ) [protected, inherited]

Clear the buffers and fill with idleSample.

void DsdiffFileReader::dispComment ( DsdiffComment  c) [private]

Can be called to display a DsdiffComment to stdout.

Can be called to display some useful info to stdout.

void DsdiffFileReader::dispMarker ( DsdiffMarker  m) [private]

Can be called to display DsdiffMarker marker info to stdout.

boost::circular_buffer< dsf2flac_uint8 > * DsdSampleReader::getBuffer ( ) [inherited]

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 ( ) [inherited]

Returns the length of the buffers (the number of uint8 numbers, NOT the number of DSD samples).

std::string DsdSampleReader::getErrorMsg ( ) [inherited]

Returns a message explaining why the reader is invalid.

ID3_Tag DsdSampleReader::getID3Tag ( ) [inline, inherited]

Return the ID3 tag of the first track in this reader.

Useful for when there is only a single track in the reader.

ID3_Tag DsdiffFileReader::getID3Tag ( dsf2flac_uint32  trackNum) [virtual]

Return the ID3 tag corresponding to the provided track number.

Reimplemented from DsdSampleReader.

virtual dsf2flac_uint8 DsdSampleReader::getIdleSample ( ) [inline, virtual, inherited]

Return the idle tone used by this reader, by default the buffers are populated with this idle tone.

dsf2flac_int64 DsdiffFileReader::getLength ( ) [inline, virtual]

Returns the total number of DSD samples in the reader.

Implements DsdSampleReader.

dsf2flac_float64 DsdSampleReader::getLengthInSeconds ( ) [inherited]

Returns the total length of the reader in seconds.

dsf2flac_uint32 DsdiffFileReader::getNumChannels ( ) [inline, virtual]

Returns the number of channels in the reader.

Implements DsdSampleReader.

dsf2flac_uint32 DsdiffFileReader::getNumTracks ( ) [inline, virtual]

Returns the number of audio tracks in the reader.

Reimplemented from DsdSampleReader.

dsf2flac_int64 DsdSampleReader::getPosition ( ) [inline, inherited]

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 ( ) [inherited]

Return the current position of the reader as a percent of the total length.

dsf2flac_float64 DsdSampleReader::getPositionInSeconds ( ) [inherited]

Return the current position of the reader in seconds.

dsf2flac_uint32 DsdiffFileReader::getSamplingFreq ( ) [inline, virtual]

Returns the DSD sampling rate of this reader (Hz).

Implements DsdSampleReader.

dsf2flac_uint64 DsdiffFileReader::getTrackEnd ( dsf2flac_uint32  trackNum) [virtual]

Returns the end position of the specified track.

Reimplemented from DsdSampleReader.

dsf2flac_uint64 DsdiffFileReader::getTrackStart ( dsf2flac_uint32  trackNum) [virtual]

Returns the start position of the specified track.

Reimplemented from DsdSampleReader.

bool DsdSampleReader::isValid ( ) [inherited]

Return false if the reader is invalid (format/file error for example).

static char* DsdSampleReader::latin1_to_utf8 ( char *  latin1) [static, inherited]

convert latin1 encoded char into utf8.

bool DsdiffFileReader::msbIsPlayedFirst ( ) [inline, virtual]

Describes the order that the samples are packed into the int8 buffer entries.

Implements DsdSampleReader.

void DsdiffFileReader::processTracks ( ) [private]

Finds the number, start and end points of the tracks in the file.

Must be called after the marker chunks have been read.

bool DsdiffFileReader::readChunk_ABSS ( dsf2flac_uint64  chunkStart) [private]

read data from a ABSS chunk

bool DsdiffFileReader::readChunk_CHNL ( dsf2flac_uint64  chunkStart) [private]

read data from a CHNL chunk

bool DsdiffFileReader::readChunk_CMPR ( dsf2flac_uint64  chunkStart) [private]

read data from a CMPR chunk

bool DsdiffFileReader::readChunk_COMT ( dsf2flac_uint64  chunkStart) [private]

read data from a COMT chunk

bool DsdiffFileReader::readChunk_DIIN ( dsf2flac_uint64  chunkStart) [private]

read data from a DIIN chunk

bool DsdiffFileReader::readChunk_DSD ( dsf2flac_uint64  chunkStart) [private]

read data from a DSD chunk

bool DsdiffFileReader::readChunk_DST ( dsf2flac_uint64  chunkStart) [private]

read data from a DST chunk

bool DsdiffFileReader::readChunk_DSTF ( dsf2flac_uint64  chunkStart) [private]

read data from a DSTF chunk

bool DsdiffFileReader::readChunk_DSTI ( dsf2flac_uint64  chunkStart) [private]

read data from a DSTI chunk

bool DsdiffFileReader::readChunk_EMID ( dsf2flac_uint64  chunkStart) [private]

read data from a EMID chunk

bool DsdiffFileReader::readChunk_FRM8 ( dsf2flac_uint64  chunkStart) [private]

read data from a FRM8 chunk

bool DsdiffFileReader::readChunk_FRTE ( dsf2flac_uint64  chunkStart) [private]

read data from a FRTE chunk

bool DsdiffFileReader::readChunk_FS ( dsf2flac_uint64  chunkStart) [private]

read data from a FS chunk

bool DsdiffFileReader::readChunk_FVER ( dsf2flac_uint64  chunkStart) [private]

read data from a FVER chunk

bool DsdiffFileReader::readChunk_ID3 ( dsf2flac_uint64  chunkStart) [private]

read data from a ID3 chunk

bool DsdiffFileReader::readChunk_LSCO ( dsf2flac_uint64  chunkStart) [private]

read data from a LSCO chunk

bool DsdiffFileReader::readChunk_MARK ( dsf2flac_uint64  chunkStart) [private]

read data from a MARK chunk

bool DsdiffFileReader::readChunk_PROP ( dsf2flac_uint64  chunkStart) [private]

read data from a PROP chunk

bool DsdiffFileReader::readChunkHeader ( dsf2flac_int8 *  ident,
dsf2flac_uint64  chunkStart 
) [private]

A little helper to read chunk headers info.

bool DsdiffFileReader::readChunkHeader ( dsf2flac_int8 *  ident,
dsf2flac_uint64  chunkStart,
dsf2flac_uint64 *  chunkSz 
) [private]

A little helper to read chunk headers info.

bool DsdiffFileReader::readNextBlock ( ) [private]

Read the next block of samples into the buffer.

void DsdiffFileReader::rewind ( ) [virtual]

Set the reader position back to the start of the DSD data.

Note that child classes implementing this method must call clearBuffer();

Implements DsdSampleReader.

bool DsdiffFileReader::samplesAvailable ( ) [inline, virtual]

Returns false if there are no more samples left in the reader.

Reimplemented from DsdSampleReader.

bool DsdSampleReader::setBufferLength ( dsf2flac_uint32  bufferLength) [inherited]

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.

bool DsdiffFileReader::step ( ) [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).

Implements DsdSampleReader.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables