synthclone  0.3.0
synthclone::SampleInputStream Class Reference

Used to read sample data from a sample file. More...

#include <synthclone/sampleinputstream.h>

Inheritance diagram for synthclone::SampleInputStream:
Collaboration diagram for synthclone::SampleInputStream:

Public Member Functions

 SampleInputStream (const Sample &sample, QObject *parent=0)
 Constructs a new sample input stream. More...
 
 ~SampleInputStream ()
 Destroys the stream. More...
 
SampleFrameCount read (float *buffer, SampleFrameCount frames)
 Reads data from the stream. More...
 
- Public Member Functions inherited from synthclone::SampleStream
void close ()
 Closes the sample stream, which causes any unwritten data to be written to the sample. More...
 
SampleChannelCount getChannels () const
 Gets the channel count for the sample. More...
 
EndianType getEndianType () const
 Gets the format endian type of the underlying sample. More...
 
SampleFrameCount getFrames ()
 Gets the total number of frames in this sample. More...
 
SampleRate getSampleRate () const
 Gets the sample rate for this sample. More...
 
SubType getSubType () const
 Gets the format sub-type of the underlying sample. More...
 
Type getType () const
 Gets the format type of the underlying sample. More...
 
bool isClosed () const
 Gets a boolean indicating whether or not the stream is closed. More...
 
SampleFrameCount seek (SampleFrameCount frames, Offset offset)
 Sets the position of the stream in the sample file. More...
 

Additional Inherited Members

- Public Types inherited from synthclone::SampleStream
enum  EndianType { ENDIANTYPE_FILE = 0, ENDIANTYPE_LITTLE, ENDIANTYPE_BIG, ENDIANTYPE_CPU }
 Contains format endian types supported by sample streams. More...
 
enum  Offset { OFFSET_CURRENT = 0, OFFSET_END = 1, OFFSET_START = 2 }
 Offsets are used to set the position of the stream using the seek() call. More...
 
enum  SubType {
  SUBTYPE_UNKNOWN = -1, SUBTYPE_PCM_S8 = 0, SUBTYPE_PCM_U8, SUBTYPE_PCM_16,
  SUBTYPE_PCM_24, SUBTYPE_PCM_32, SUBTYPE_FLOAT, SUBTYPE_DOUBLE,
  SUBTYPE_ULAW, SUBTYPE_ALAW, SUBTYPE_IMA_ADPCM, SUBTYPE_MS_ADPCM,
  SUBTYPE_GSM610, SUBTYPE_VOX_ADPCM, SUBTYPE_G721_32, SUBTYPE_G723_24,
  SUBTYPE_G723_40, SUBTYPE_DWVW_12, SUBTYPE_DWVW_16, SUBTYPE_DWVW_24,
  SUBTYPE_DWVW_N, SUBTYPE_DPCM_8, SUBTYPE_DPCM_16, SUBTYPE_VORBIS
}
 Contains format sub-types supported by sample streams. More...
 
enum  Type {
  TYPE_UNKNOWN = -1, TYPE_AIFF = 0, TYPE_AU, TYPE_AVR,
  TYPE_CAF, TYPE_FLAC, TYPE_HTK, TYPE_IRCAM,
  TYPE_MAT4, TYPE_MAT5, TYPE_MPC2K, TYPE_NIST,
  TYPE_OGG, TYPE_PAF, TYPE_PVF, TYPE_RAW,
  TYPE_RF64, TYPE_SD2, TYPE_SDS, TYPE_SVX,
  TYPE_VOC, TYPE_W64, TYPE_WAV, TYPE_WAVEX,
  TYPE_WVE, TYPE_XI
}
 Contains format types supported by sample streams. More...
 
- Protected Member Functions inherited from synthclone::SampleStream
 SampleStream (QObject *parent=0)
 
virtual ~SampleStream ()
 
- Protected Attributes inherited from synthclone::SampleStream
SampleFile * file
 

Detailed Description

Used to read sample data from a sample file.

The object uses the excellent libsndfile in its implementation, which can be found at http://www.mega-nerd.com/libsndfile/.

Constructor & Destructor Documentation

synthclone::SampleInputStream::SampleInputStream ( const Sample sample,
QObject *  parent = 0 
)
explicit

Constructs a new sample input stream.

Parameters
sampleThe sample to read data from.
parentThe parent object of the new stream object.
synthclone::SampleInputStream::~SampleInputStream ( )

Destroys the stream.

Member Function Documentation

SampleFrameCount synthclone::SampleInputStream::read ( float *  buffer,
SampleFrameCount  frames 
)

Reads data from the stream.

Parameters
bufferA buffer to read data into. The buffer's size should be greater than or equal to:
frames * channels * sizeof(float)
framesThe maximum number of frames to read into the buffer. If the stream is positioned less than the amount of frames from the end of the sample file, then less data will be read into the buffer.
Returns
The number of frames read into the buffer.

The documentation for this class was generated from the following file: