synthclone
0.3.0
|
Used to read sample data from a sample file. More...
#include <synthclone/sampleinputstream.h>
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... | |
![]() | |
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... | |
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/.
|
explicit |
Constructs a new sample input stream.
sample | The sample to read data from. |
parent | The parent object of the new stream object. |
synthclone::SampleInputStream::~SampleInputStream | ( | ) |
Destroys the stream.
SampleFrameCount synthclone::SampleInputStream::read | ( | float * | buffer, |
SampleFrameCount | frames | ||
) |
Reads data from the stream.
buffer | A buffer to read data into. The buffer's size should be greater than or equal to: frames * channels * sizeof(float) |
frames | The 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. |