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.
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 get rid of repetitive code!
bool readChunkHeader (dsf2flac_int8 *ident, dsf2flac_uint64 chunkStart, dsf2flac_uint64 *chunkSz)
 A little helper to get rid of repetitive code!

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.


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.

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::readChunkHeader ( dsf2flac_int8 *  ident,
dsf2flac_uint64  chunkStart 
) [private]

A little helper to get rid of repetitive code!

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

A little helper to get rid of repetitive code!

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