00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef WRITESOURCE_H
00023 #define WRITESOURCE_H
00024
00025 #include "AudioSource.h"
00026
00027 #include "gdither.h"
00028 #include <samplerate.h>
00029
00030 struct ExportSpecification;
00031 class Peak;
00032 class DiskIO;
00033 class AbstractAudioWriter;
00034
00036 class WriteSource : public AudioSource
00037 {
00038 Q_OBJECT
00039
00040 public :
00041 WriteSource(ExportSpecification* spec);
00042 ~WriteSource();
00043
00044 int rb_write(audio_sample_t** src, nframes_t cnt);
00045 int rb_file_write(nframes_t cnt);
00046 void process_ringbuffer(audio_sample_t* buffer);
00047 int get_processable_buffer_space() const;
00048 int get_chunck_size() const {return m_chunkSize;}
00049 int get_buffer_size() const {return m_bufferSize;}
00050 Peak* get_peak() {return m_peak;}
00051
00052 int process(nframes_t nframes);
00053
00054 int prepare_export();
00055 int finish_export();
00056 void set_process_peaks(bool process);
00057 void set_recording(int rec);
00058
00059 size_t is_recording() const;
00060
00061 void set_diskio(DiskIO* io );
00062
00063 private:
00064 AbstractAudioWriter* m_writer;
00065 ExportSpecification* m_spec;
00066 Peak* m_peak;
00067
00068 DiskIO* m_diskio;
00069 GDither m_dither;
00070 bool m_processPeaks;
00071 size_t m_isRecording;
00072 nframes_t m_sampleRate;
00073 uint32_t m_sample_bytes;
00074
00075
00076 nframes_t m_out_samples_max;
00077 nframes_t m_leftover_frames;
00078 SRC_DATA m_src_data;
00079 SRC_STATE* m_src_state;
00080 nframes_t m_max_leftover_frames;
00081 float* m_leftoverF;
00082 float* m_dataF2;
00083 void* m_output_data;
00084
00085
00086 void prepare_rt_buffers();
00087
00088 signals:
00089 void exportFinished();
00090 };
00091
00092
00093 inline int WriteSource::get_processable_buffer_space( ) const
00094 {
00095 return m_buffers.at(0)->read_space();
00096 }
00097
00098 inline size_t WriteSource::is_recording( ) const
00099 {
00100 return m_isRecording;
00101 }
00102
00103 #endif
00104
00105
00106
00107