Jamoma API  0.6.0.a19
TTSoundfileRecorder.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspSoundFileLib
4  *
5  * @brief Jamoma DSP Soundfile Recorder
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_SOUNDFILERECORDER_H__
17 #define __TT_SOUNDFILERECORDER_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 record a soundfile to disk */
30 
31 protected:
32 
33  TTSymbol mFilePath; ///< full POSIX path to the file, including file name
34  TTSymbol mFormat; ///< format of the file, e.g. "WAV", "AIFF", "FLAC", "FLAC-16bit", etc.
35  SNDFILE* mSoundFile; ///< libsndfile handle for the actual file we open
36  SF_INFO mSoundFileInfo; ///< libsndfile metadata for the file we open
37  TTBoolean mRecord; ///< is actively recording the file?
38  TTUInt16 mNumChannels; ///< read-only: number of channels in the open file
39  TTUInt16 mNumBufferFrames; ///< number of frames in the buffer to be read from the file at a time
40  TTFloat64 mLength; ///< length of the file in ms
41  TTInt32 mLengthInSamples; ///< length of the file in samples
42  TTUInt16 mCycles;
43  TTSampleVector mBuffer; ///< buffer of mNumBufferFrames * mNumChannels;
44  sf_count_t numSamplesWritten;
45  /** Setter */
46  TTErr setRecord(const TTValue& value);
47  TTErr setLength(const TTValue& value);
48  TTErr setFilePath(const TTValue& value);
49 
50  // internal use: map human symbols to libsndfile's bitmask
51  int translateFormatFromName(TTSymbol& name);
52 
53  TTErr updateSampleRate(const TTValue& oldSampleRate);
54 
55  // internal use: opens the file for recording
56  TTErr openFile();
57 
58  // Block-based Audio Processing Methods
59  TTErr processAudioRecording(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
60  TTErr processTimedAudioRecording(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
61  TTErr processAudioBypass(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
62 
63 };
64 
65 
66 #endif // __TT_SOUNDFILERECORDER_H__
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
Enables user to record a soundfile to disk.
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
SNDFILE * mSoundFile
libsndfile handle for the actual file we open
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
Jamoma DSP Library.
TTSymbol mFormat
format of the file, e.g. "WAV", "AIFF", "FLAC", "FLAC-16bit", etc.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
TTSymbol mFilePath
full POSIX path to the file, including file name
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
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
TTFloat64 mLength
length of the file in ms
std::int32_t TTInt32
32 bit signed integer
Definition: TTBase.h:177
TTUInt16 mNumChannels
read-only: number of channels in the open file
A simple container for an array of TTAudioSignal pointers.
SF_INFO mSoundFileInfo
libsndfile metadata for the file we open
TTUInt16 mNumBufferFrames
number of frames in the buffer to be read from the file at a time
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTSampleVector mBuffer
buffer of mNumBufferFrames * mNumChannels;
TTBoolean mRecord
is actively recording the file?
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTInt32 mLengthInSamples
length of the file in samples
TTErr setRecord(const TTValue &value)
Setter.