MusicKit  0.0.0
Public Member Functions | Protected Attributes
SndAudioProcessorRecorder Class Reference

Records the FX audio stream to disk. More...

#import <SndAudioProcessorRecorder.h>

Inheritance diagram for SndAudioProcessorRecorder:
SndAudioProcessor SndAudioProcessor

List of all members.

Public Member Functions

(BOOL) - prepareToRecordWithQueueDuration:
 Prepares the buffer used for recording.
(BOOL) - prepareToRecordWithQueueDuration:ofFormat:
 Prepares the buffer used for recording.
(BOOL) - isRecording
 Returns whether the receiver is currently recording.
(BOOL) - startRecording
 YES if recording started ok.
(BOOL) - setUpRecordFile:withFormat:
 Sets up recording of the file in the given format.
(BOOL) - startRecordingToFile:withDataFormat:channelCount:samplingRate:
 Begins recording to the named file in the given format.
(BOOL) - startRecordingToFile:withFormat:
 Begins recording to the named file in the given format.
(void) - stopRecording
 Stops the recording of the stream to file.
(long) - framesRecorded
 Returns the number of frames recorded.
(void) - setStartTriggerThreshold:
 Sets the linear amplitude the stream must rise above before recording begins.
(BOOL) - prepareToRecordWithQueueDuration:
 Prepares the buffer used for recording.
(BOOL) - prepareToRecordWithQueueDuration:ofFormat:
 Prepares the buffer used for recording.
(BOOL) - isRecording
 Returns whether the receiver is currently recording.
(BOOL) - startRecording
 YES if recording started ok.
(BOOL) - setUpRecordFile:withFormat:
 Sets up recording of the file in the given format.
(BOOL) - startRecordingToFile:withDataFormat:channelCount:samplingRate:
 Begins recording to the named file in the given format.
(BOOL) - startRecordingToFile:withFormat:
 Begins recording to the named file in the given format.
(void) - stopRecording
 Stops the recording of the stream to file.
(long) - framesRecorded
 Returns the number of frames recorded.
(void) - setStartTriggerThreshold:
 Sets the linear amplitude the stream must rise above before recording begins.

Protected Attributes

SndAudioBufferQueuewritingQueue
SndFormat fileFormat
BOOL isRecording
NSFileHandle * writingFileHandle
unsigned long framesRecorded
SNDFILE * recordFile
NSString * recordFileName
BOOL startedRecording
float startTriggerThreshold
BOOL stopSignal

Detailed Description

Records the FX audio stream to disk.

A threshold can be set to prevent silence being recorded prior to the sound. An automatic shutoff after a specifiable period of silence is also possible.


Member Function Documentation

- (long) framesRecorded

Returns the number of frames recorded.

Returns:
The number of frames recorded.
- (long) framesRecorded

Returns the number of frames recorded.

Returns:
The number of frames recorded.
- (BOOL) isRecording

Returns whether the receiver is currently recording.

Returns:
YES if currently recording.
- (BOOL) isRecording

Returns whether the receiver is currently recording.

Returns:
YES if currently recording.
- (BOOL) prepareToRecordWithQueueDuration: (double)  durationOfBuffering

Prepares the buffer used for recording.

Parameters:
durationOfBufferingThe duration (in seconds) of the buffering that should used in recording.
Returns:
Return YES if able to prepare correctly, NO if there was a problem.
- (BOOL) prepareToRecordWithQueueDuration: (double)  durationOfBuffering

Prepares the buffer used for recording.

Parameters:
durationOfBufferingThe duration (in seconds) of the buffering that should used in recording.
Returns:
Return YES if able to prepare correctly, NO if there was a problem.
- (BOOL) prepareToRecordWithQueueDuration: (double)  durationOfBuffering
ofFormat: (SndFormat queueFormat 

Prepares the buffer used for recording.

Parameters:
durationOfBufferingThe duration (in seconds) of the buffering that should used in recording.
queueFormatThe format of the buffers to be expected.
Returns:
Return YES if able to prepare correctly, NO if there was a problem.
- (BOOL) prepareToRecordWithQueueDuration: (double)  durationOfBuffering
ofFormat: (SndFormat queueFormat 

Prepares the buffer used for recording.

Parameters:
durationOfBufferingThe duration (in seconds) of the buffering that should used in recording.
queueFormatThe format of the buffers to be expected.
Returns:
Return YES if able to prepare correctly, NO if there was a problem.
- (void) setStartTriggerThreshold: (float)  amplitudeThreshold

Sets the linear amplitude the stream must rise above before recording begins.

To record all samples, including leading silence, set a negative amplitude, i.e -1.0.

Parameters:
amplitudeThresholdThe amplitude is a normalised value between silence (0.0) and maximum dynamic range (1.0).
- (void) setStartTriggerThreshold: (float)  amplitudeThreshold

Sets the linear amplitude the stream must rise above before recording begins.

To record all samples, including leading silence, set a negative amplitude, i.e -1.0.

Parameters:
amplitudeThresholdThe amplitude is a normalised value between silence (0.0) and maximum dynamic range (1.0).
- (BOOL) setUpRecordFile: (NSString *)  filename
withFormat: (SndFormat format 

Sets up recording of the file in the given format.

This method is not normally called, use startRecordingToFile:withDataFormat:channelCount:samplingRate: instead. This method, setUpRecordFile:withFormat: is defined here in order to facilitate overriding in subclasses.

Parameters:
filenamepath of the file to record to.
formatThe format of the file. The frameCount field is ignored.
Returns:
Returns YES if able to open the file for writing, NO if there is an error.
- (BOOL) setUpRecordFile: (NSString *)  filename
withFormat: (SndFormat format 

Sets up recording of the file in the given format.

This method is not normally called, use startRecordingToFile:withDataFormat:channelCount:samplingRate: instead. This method, setUpRecordFile:withFormat: is defined here in order to facilitate overriding in subclasses.

Parameters:
filenamepath of the file to record to.
formatThe format of the file. The frameCount field is ignored.
Returns:
Returns YES if able to open the file for writing, NO if there is an error.
- (BOOL) startRecording

YES if recording started ok.

Returns:
YES if recording started ok.
- (BOOL) startRecording

YES if recording started ok.

Returns:
YES if recording started ok.
- (BOOL) startRecordingToFile: (NSString *)  filename
withDataFormat: (SndSampleFormat)  dataFormat
channelCount: (int)  chanCount
samplingRate: (int)  sampleRate 

Begins recording to the named file in the given format.

Parameters:
filenamepath of the file to record to.
dataFormatThe data format specifying dynamic range.
channelCountThe number of channels to write.
sampleRateThe sample rate in Hz.
Returns:
Returns YES if able to open the file for writing, NO if there is an error.
- (BOOL) startRecordingToFile: (NSString *)  filename
withDataFormat: (SndSampleFormat)  dataFormat
channelCount: (int)  chanCount
samplingRate: (int)  sampleRate 

Begins recording to the named file in the given format.

Parameters:
filenamepath of the file to record to.
dataFormatThe data format specifying dynamic range.
channelCountThe number of channels to write.
sampleRateThe sample rate in Hz.
Returns:
Returns YES if able to open the file for writing, NO if there is an error.
- (BOOL) startRecordingToFile: (NSString *)  filename
withFormat: (SndFormat newFileFormat 

Begins recording to the named file in the given format.

Parameters:
filenamepath of the file to record to.
newFileFormatThe file format to write to. The field frameCount should match the audio processor chain.
Returns:
Returns YES if able to open the file for writing, NO if there is an error.
- (BOOL) startRecordingToFile: (NSString *)  filename
withFormat: (SndFormat newFileFormat 

Begins recording to the named file in the given format.

Parameters:
filenamepath of the file to record to.
newFileFormatThe file format to write to. The field frameCount should match the audio processor chain.
Returns:
Returns YES if able to open the file for writing, NO if there is an error.
- (void) stopRecording

Stops the recording of the stream to file.

Waits until the queue clears.

- (void) stopRecording

Stops the recording of the stream to file.

Waits until the queue clears.


Member Data Documentation

- (SndFormat) fileFormat [protected]

The format of the data to be stored in the file.

- (unsigned long) framesRecorded [protected]

Number of sample frames written

- (BOOL) isRecording [protected]

Indicates if recording is currently active.

- (SNDFILE *) recordFile [protected]

The libsndfile handle referring to the open file. NULL if not open.

- (NSString *) recordFileName [protected]

Full pathname of the file being or about to be written.

- (BOOL) startedRecording [protected]

Indicates if a minimum threshold or time trigger has passed and recording has begun.

- (float) startTriggerThreshold [protected]

A normalised absolute value threshold to begin the recording of sound.

- (BOOL) stopSignal [protected]

A boolean variable to indicate that recording should stop and the file should be closed.

- (NSFileHandle *) writingFileHandle [protected]

Holds the file handle used in writing.

- (SndAudioBufferQueue *) writingQueue [protected]

A queue of buffers copied from those received by processReplacingInputBuffer: ready for writing.


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