![]() |
Mixxx
|
00001 /*************************************************************************** 00002 enginerecord.h - description 00003 ------------------- 00004 copyright : (C) 2007 by John Sully 00005 email : 00006 ***************************************************************************/ 00007 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 00017 #ifndef ENGINERECORD_H 00018 #define ENGINERECORD_H 00019 00020 #include <QDataStream> 00021 #include <QFile> 00022 00023 #include <sndfile.h> 00024 00025 #include "controlobjectthread.h" 00026 #include "engine/engineabstractrecord.h" 00027 #include "configobject.h" 00028 #include "engine/engineobject.h" 00029 #include "encoder.h" 00030 #include "errordialoghandler.h" 00031 00032 #include "trackinfoobject.h" 00033 00034 #define THRESHOLD_REC 2. //high enough that its not triggered by white noise 00035 00036 class ControlLogpotmeter; 00037 class ConfigKey; 00038 class ControlObject; 00039 00040 class EngineRecord : public EngineAbstractRecord { 00041 Q_OBJECT 00042 public: 00043 EngineRecord(ConfigObject<ConfigValue> *_config); 00044 virtual ~EngineRecord(); 00045 void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); 00047 void write(unsigned char *header, unsigned char *body, int headerLen, int bodyLen); 00048 //creates or opens an audio file 00049 bool openFile(); 00050 //closes the audio file 00051 void closeFile(); 00052 void updateFromPreferences(); 00053 bool fileOpen(); 00054 bool openCueFile(); 00055 void closeCueFile(); 00056 00057 signals: 00058 // emitted to notify RecordingManager 00059 void bytesRecorded(int); 00060 void isRecording(bool); 00061 00062 private: 00063 int getActiveTracks(); 00064 bool metaDataHasChanged(); 00065 void writeCueLine(); 00066 00067 ConfigObject<ConfigValue> *m_config; 00068 Encoder *m_encoder; 00069 QByteArray m_OGGquality; 00070 QByteArray m_MP3quality; 00071 QByteArray m_Encoding; 00072 QString m_filename; 00073 QByteArray m_baTitle; 00074 QByteArray m_baAuthor; 00075 QByteArray m_baAlbum; 00076 00077 QFile m_file; 00078 QFile m_cuefile; 00079 QDataStream m_datastream; 00080 SNDFILE *m_sndfile; 00081 SF_INFO m_sfInfo; 00082 00083 ControlObjectThread* m_recReady; 00084 00085 ControlObjectThread* m_samplerate; 00086 00087 int m_iMetaDataLife; 00088 TrackPointer m_pCurrentTrack; 00089 int m_iNumChannels; 00090 double m_dLatency; 00091 00092 QByteArray m_cuefilename; 00093 unsigned long m_cuesamplepos; 00094 unsigned long m_cuetrack; 00095 bool m_bCueIsEnabled; 00096 }; 00097 00098 #endif