Jamoma API  0.6.0.a19
TTSoundfilePlayer.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspSoundFileLib
4  *
5  * @brief Jamoma DSP Soundfile Player
6  *
7  * @details
8  *
9  * @authors Timothy Place
10  *
11  * @copyright Copyright © 2010 by Timothy Place @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 #ifndef __TT_SOUNDFILEPLAYER_H__
17 #define __TT_SOUNDFILEPLAYER_H__
18 
19 #include "TTDSP.h"
20 
21 #ifdef uint
22 #undef uint
23 #endif
24 #include "../libsndfile/sndfile.h"
25 
26 
27 /** Enables user to play a soundfile from disk */
30 
31 protected:
32 
33  TTSymbol mFilePath; ///< full POSIX path to the file, including file name
34  TTSymbol mTitle, mAnnotation, mArtist, mDate;
35  SNDFILE* mSoundFile; ///< libsndfile handle for the actual file we open
36  SF_INFO mSoundFileInfo; ///< libsndfile metadata for the file we open
37  sf_count_t mSeekInFrames;
38  TTBoolean mPlay; ///< is actively playing back the file?
39  TTBoolean mLoop; ///< Loop flag
40  TTFloat64 mSeek; ///< Cue time start
41  TTFloat64 mDuration; ///< Length of the loaded soundfile - readonly
42  TTBoolean mContinue; ///< Pause/Resume flag
43  TTUInt16 mNumChannels; ///< read-only: number of channels in the open file
44  TTUInt16 mNumBufferFrames; ///< number of frames in the buffer to be read from the file at a time
45  TTSampleVector mBuffer; ///< buffer of mNumBufferFrames * mNumChannels;
46 
47 
48 
49  /** Setter for the mode attribute.
50  This also sets the audio processing method. */
51  TTErr setFilePath(const TTValue& value);
52  TTErr setPlay(const TTValue& value);
53  TTErr setSeek(const TTValue& value);
54  TTErr pause();
55  TTErr resume();
56 
57  // Block-based Audio Processing Methods
58  TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
59 };
60 
61 
62 #endif // __TT_SOUNDFILEPLAYER_H__
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
SF_INFO mSoundFileInfo
libsndfile metadata for the file we open
TTUInt16 mNumChannels
read-only: number of channels in the open file
SNDFILE * mSoundFile
libsndfile handle for the actual file we open
TTBoolean mPlay
is actively playing back the file?
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTUInt16 mNumBufferFrames
number of frames in the buffer to be read from the file at a time
TTFloat64 mDuration
Length of the loaded soundfile - readonly.
Jamoma DSP Library.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
TTFloat64 mSeek
Cue time start.
TTSymbol mFilePath
full POSIX path to the file, including file name
std::vector< TTSampleValue > TTSampleVector
A TTSampleVector is simply a pointer to the first of an array of TTSampleValues.
Definition: TTBase.h:233
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTBoolean mContinue
Pause/Resume flag.
TTBoolean mLoop
Loop flag.
A simple container for an array of TTAudioSignal pointers.
TTSampleVector mBuffer
buffer of mNumBufferFrames * mNumChannels;
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTErr setFilePath(const TTValue &value)
Setter for the mode attribute.
Enables user to play a soundfile from disk.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34