MusicKit  0.0.0
SndAudioProcessorRecorder.h
00001 
00002 //
00003 //  $Id$
00004 //
00005 //  Description:
00006 //    See the headerdoc below.
00007 //
00008 //  Original Author: SKoT McDonald, <skot@tomandandy.com>
00009 //
00010 //  Copyright (c) 2001, The MusicKit Project.  All rights reserved.
00011 //
00012 //  Permission is granted to use and modify this code for commercial and
00013 //  non-commercial purposes so long as the author attribution and copyright
00014 //  messages remain intact and accompany all relevant code.
00015 //
00017 
00018 #ifndef __SNDKIT_SNDAUDIOPROCESSORRECORDER_H__
00019 #define __SNDKIT_SNDAUDIOPROCESSORRECORDER_H__
00020 
00021 /* We #include this file regardless of the setting of
00022    HAVE_CONFIG_H so that other applications compiling against this
00023    header don't have to define it. If you are seeing errors for
00024    SndKitConfig.h not found when compiling the MusicKit, you haven't
00025    run ./configure 
00026 */
00027 #import "SndKitConfig.h"
00028 
00029 #import <Foundation/Foundation.h>
00030 #import "SndAudioProcessor.h"
00031 
00032 #if HAVE_LIBSNDFILE
00033 # import <sndfile.h>
00034 #else
00035 #define SNDFILE void
00036 #endif
00037 
00038 @class SndAudioBuffer;
00039 @class SndAudioBufferQueue;
00040 
00048 enum SndRecorderParam {
00049     recorder_StartTriggerThreshold = 0,
00050     recorder_RecordFile            = 1,
00051     recorder_NumParams             = 2
00052 };
00053 
00055 
00063 @interface SndAudioProcessorRecorder : SndAudioProcessor {
00064 
00065 @protected
00067     SndAudioBufferQueue *writingQueue;
00069     SndFormat fileFormat;
00071     BOOL isRecording;
00073     NSFileHandle *writingFileHandle;
00075     unsigned long framesRecorded;  
00077     SNDFILE *recordFile;
00079     NSString *recordFileName;
00081     BOOL startedRecording;
00083     float startTriggerThreshold;
00085     BOOL stopSignal;
00086 }
00087 
00093 - (BOOL) prepareToRecordWithQueueDuration: (double) durationOfBuffering;
00094 
00101 - (BOOL) prepareToRecordWithQueueDuration: (double) durationOfBuffering
00102                                  ofFormat: (SndFormat) queueFormat;
00103 
00108 - (BOOL) isRecording;
00109 
00114 - (BOOL) startRecording;
00115 
00126 - (BOOL) setUpRecordFile: (NSString *) filename
00127               withFormat: (SndFormat) format;
00128 
00137 - (BOOL) startRecordingToFile: (NSString*) filename
00138                withDataFormat: (SndSampleFormat) dataFormat
00139                  channelCount: (int) chanCount
00140                  samplingRate: (int) sampleRate;
00141 
00148 - (BOOL) startRecordingToFile: (NSString *) filename
00149                    withFormat: (SndFormat) newFileFormat;
00150 
00156 - (void) stopRecording;
00157 
00162 - (long) framesRecorded;
00163 
00171 - (void) setStartTriggerThreshold: (float) amplitudeThreshold;
00172 
00173 - copyWithZone: (NSZone *) zone;
00174 
00175 @end
00176 
00178 
00179 #endif