DSF2FLAC
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
dsdSampleReader Class Reference

#include <dsd_sample_reader.h>

Inheritance diagram for dsdSampleReader:
dsdiffFileReader dsfFileReader

List of all members.

Public Member Functions

 dsdSampleReader ()
virtual ~dsdSampleReader ()
virtual bool step ()
virtual void rewind ()
virtual dsf2flac_int64 getLength ()
virtual dsf2flac_uint32 getNumChannels ()
virtual dsf2flac_uint32 getSamplingFreq ()
ID3_Tag getID3Tag ()
virtual ID3_Tag getID3Tag (dsf2flac_uint32 trackNum)
virtual bool msbIsPlayedFirst ()
virtual dsf2flac_uint8 getIdleSample ()
virtual bool samplesAvailable ()
virtual dsf2flac_uint32 getNumTracks ()
virtual dsf2flac_uint64 getTrackStart (dsf2flac_uint32 trackNum)
virtual dsf2flac_uint64 getTrackEnd (dsf2flac_uint32 trackNum)
boost::circular_buffer
< dsf2flac_uint8 > * 
getBuffer ()
bool setBufferLength (dsf2flac_uint32 bufferLength)
dsf2flac_uint32 getBufferLength ()
dsf2flac_int64 getPosition ()
dsf2flac_int64 getPosition (dsf2flac_int64 bufferPos)
dsf2flac_float64 getPositionInSeconds ()
dsf2flac_float64 getPositionAsPercent ()
dsf2flac_float64 getLengthInSeconds ()
bool isValid ()
std::string getErrorMsg ()

Static Public Member Functions

static char * latin1_to_utf8 (char *latin1)

Protected Member Functions

void allocateBuffer ()
void clearBuffer ()
void resizeBuffer ()

Protected Attributes

boost::circular_buffer
< dsf2flac_uint8 > * 
circularBuffers
dsf2flac_int64 posMarker
dsf2flac_uint32 samplesPerChar
bool valid
std::string errorMsg

Private Attributes

dsf2flac_uint32 bufferLength
bool isBufferAllocated

Constructor & Destructor Documentation

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()

Destructor, free the circular buffers.


Member Function Documentation

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.

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_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()

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.


Member Data Documentation

boost::circular_buffer<dsf2flac_uint8>* dsdSampleReader::circularBuffers [protected]
std::string dsdSampleReader::errorMsg [protected]
bool dsdSampleReader::valid [protected]

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